Minor Changes

Changed EventHookContainer.LivingDeathEvent() to use the player's max
health instead of a fixed health value. No magic numbers! Also cleaned
up the code a little.
This commit is contained in:
SenseiKiwi
2013-09-06 22:14:27 -04:00
parent a0454351d5
commit bac3caa5cc

View File

@@ -1,7 +1,6 @@
package StevenDimDoors.mod_pocketDim;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChunkCoordinates;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
@@ -70,15 +69,17 @@ public class EventHookContainer
public boolean LivingDeathEvent(LivingDeathEvent event)
{
Entity entity = event.entity;
if(entity instanceof EntityPlayer&&entity.worldObj.provider instanceof PocketProvider && this.properties.LimboEnabled)
if (entity instanceof EntityPlayer && entity.worldObj.provider instanceof PocketProvider
&& properties.LimboEnabled)
{
if(!this.properties.LimboReturnsInventoryEnabled)
EntityPlayer player = (EntityPlayer) entity;
if (!properties.LimboReturnsInventoryEnabled)
{
((EntityPlayer)entity).inventory.clearInventory(-1, -1);
player.inventory.clearInventory(-1, -1);
}
ChunkCoordinates coords = LimboProvider.getLimboSkySpawn(entity.worldObj.rand);
DDTeleporter.teleportEntity(entity, new Point4D(coords.posX,coords.posY,coords.posZ,mod_pocketDim.properties.LimboDimensionID));
((EntityLiving) entity).setEntityHealth(20);
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;
}