Correct various weirdness with personal doors in pocket dimensions

This commit is contained in:
CannibalVox 2015-03-15 22:19:13 -05:00
parent bb2525d94e
commit 44a0d4b3ec
5 changed files with 25 additions and 9 deletions

View file

@ -1,5 +1,6 @@
package StevenDimDoors.mod_pocketDim.blocks;
import StevenDimDoors.mod_pocketDim.world.PersonalPocketProvider;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.world.World;
@ -28,7 +29,10 @@ public class PersonalDimDoor extends BaseDimDoor
DimLink link = dimension.getLink(x, y, z);
if (link == null)
{
dimension.createLink(x, y, z, LinkType.PERSONAL, world.getBlockMetadata(x, y - 1, z));
if (world.provider instanceof PersonalPocketProvider)
dimension.createLink(x, y, z, LinkType.LIMBO, world.getBlockMetadata(x, y-1, z));
else
dimension.createLink(x, y, z, LinkType.PERSONAL, world.getBlockMetadata(x, y - 1, z));
}
}
}

View file

@ -3,6 +3,7 @@ package StevenDimDoors.mod_pocketDim.core;
import java.util.ArrayList;
import java.util.Random;
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import net.minecraft.block.Block;
@ -499,13 +500,22 @@ public class DDTeleporter
case POCKET:
return PocketBuilder.generateNewPocket(link, properties, door, DimensionType.POCKET);
case PERSONAL:
return setupPersonalLink(link, properties, (EntityPlayer)entity, door);
return setupPersonalLink(link, properties, entity, door);
case SAFE_EXIT:
return generateSafeExit(link, properties);
case DUNGEON_EXIT:
return generateDungeonExit(link, properties);
case UNSAFE_EXIT:
return generateUnsafeExit(link);
case LIMBO:
if(!(entity instanceof EntityPlayer))
{
return false;
}
Point4D dest = LimboProvider.getLimboSkySpawn((EntityPlayer)entity, DDProperties.instance());
link.tail.setDestination(dest);
return true;
case NORMAL:
case REVERSE:
case RANDOM:
@ -515,13 +525,14 @@ public class DDTeleporter
}
}
private static boolean setupPersonalLink(DimLink link, DDProperties properties,EntityPlayer player, Block door)
private static boolean setupPersonalLink(DimLink link, DDProperties properties,Entity entity, Block door)
{
if(!(player instanceof EntityPlayer))
if(!(entity instanceof EntityPlayer))
{
return false;
}
EntityPlayer player = (EntityPlayer)entity;
NewDimData dim = PocketManager.getPersonalDimensionForPlayer(player.getGameProfile().getId().toString());
if(dim == null)
{
@ -533,8 +544,7 @@ public class DDTeleporter
{
PocketManager.getDimensionData(link.source().getDimension()).setLinkDestination(personalHomeLink, link.source().getX(), link.source().getY(), link.source().getZ());
}
dim.setLinkDestination(link, dim.origin.getX(), dim.origin.getY(), dim.origin.getZ());
return true;
}

View file

@ -14,6 +14,7 @@ public enum LinkType
UNSAFE_EXIT(6),
REVERSE(7),
PERSONAL(8),
LIMBO(9),
CLIENT(-1337);
LinkType(int index)

View file

@ -428,7 +428,8 @@ public abstract class NewDimData implements IPackable<PackedDimData>
}
// Raise deletion event
linkWatcher.onDeleted(new ClientLinkData(link));
if (linkWatcher != null)
linkWatcher.onDeleted(new ClientLinkData(link));
target.clear();
modified = true;
}

View file

@ -164,7 +164,7 @@ public class TileEntityRift extends DDTileEntityBase
if (growth <= 0 && !worldObj.isRemote)
{
DimLink link = PocketManager.getLink(this.xCoord, this.yCoord, this.zCoord, worldObj);
if (link != null)
if (link != null && !worldObj.isRemote)
{
dimension.deleteLink(link);
}