Improved DDTeleporter
Made a minor change to DDTeleporter - added a flag so that we can specify that entities must be teleported to the destination without trying to shift them around based on destination orientation. This is important for the trapdoor, since otherwise entities might get shoved into walls. Also cleaned up some code in DDTeleporter. It's much more readable now. These changes are in preparation for completing Trans Trapdoor destination selection.
This commit is contained in:
@@ -10,11 +10,11 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator;
|
||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -69,19 +69,24 @@ public class EventHookContainer
|
||||
public boolean LivingDeathEvent(LivingDeathEvent event)
|
||||
{
|
||||
Entity entity = event.entity;
|
||||
if (entity instanceof EntityPlayer && entity.worldObj.provider instanceof PocketProvider
|
||||
&& properties.LimboEnabled)
|
||||
|
||||
if (entity instanceof EntityPlayer && properties.LimboEnabled)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
if (!properties.LimboReturnsInventoryEnabled)
|
||||
NewDimData dimension = PocketManager.getDimensionData(entity.worldObj);
|
||||
if (dimension.isDungeon())
|
||||
{
|
||||
player.inventory.clearInventory(-1, -1);
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
if (!properties.LimboReturnsInventoryEnabled)
|
||||
{
|
||||
player.inventory.clearInventory(-1, -1);
|
||||
}
|
||||
ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(player.worldObj.rand);
|
||||
Point4D destination = new Point4D(coords.posX, coords.posY, coords.posZ, mod_pocketDim.properties.LimboDimensionID);
|
||||
DDTeleporter.teleportEntity(player, destination, false);
|
||||
player.setEntityHealth(player.getMaxHealth());
|
||||
event.setCanceled(true);
|
||||
return false;
|
||||
}
|
||||
ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(player.worldObj.rand);
|
||||
DDTeleporter.teleportEntity(player, new Point4D(coords.posX, coords.posY, coords.posZ, mod_pocketDim.properties.LimboDimensionID));
|
||||
player.setEntityHealth(player.getMaxHealth());
|
||||
event.setCanceled(true);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user