Made the enderporter only work in the overworld

This commit is contained in:
Adubbz 2013-04-07 08:23:37 +10:00
parent 7bea89c24f
commit ae0e250891

View file

@ -38,6 +38,8 @@ public class ItemEnderporter extends Item
return par1ItemStack; return par1ItemStack;
} }
else else
{
if (par3EntityPlayer.dimension == 0)
{ {
par1ItemStack.damageItem(1, par3EntityPlayer); par1ItemStack.damageItem(1, par3EntityPlayer);
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 999)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 999));
@ -46,6 +48,14 @@ public class ItemEnderporter extends Item
par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 3)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 3));
par3EntityPlayer.setPosition(par2World.getSpawnPoint().posX, 256, par2World.getSpawnPoint().posZ); par3EntityPlayer.setPosition(par2World.getSpawnPoint().posX, 256, par2World.getSpawnPoint().posZ);
par2World.playSoundAtEntity(par3EntityPlayer, "random.levelup", 1.0F, 5.0F); par2World.playSoundAtEntity(par3EntityPlayer, "random.levelup", 1.0F, 5.0F);
}
else
{
if (!par3EntityPlayer.worldObj.isRemote)
{
par3EntityPlayer.addChatMessage("\u00a75A mystical energy is preventing you from using this in the current world.");
}
}
return par1ItemStack; return par1ItemStack;
} }