BloodMagic/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilEnderSeverance.java

33 lines
1.2 KiB
Java
Raw Normal View History

2015-12-28 00:38:12 +00:00
package WayofTime.bloodmagic.item.sigil;
2016-03-18 19:38:26 +00:00
import java.util.List;
2015-12-29 00:09:51 +00:00
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
2016-03-18 19:38:26 +00:00
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModPotions;
2015-12-29 00:09:51 +00:00
public class ItemSigilEnderSeverance extends ItemSigilToggleable
{
public ItemSigilEnderSeverance()
{
2015-12-29 00:09:51 +00:00
super("enderSeverance", 200);
setRegistryName(Constants.BloodMagicItem.SIGIL_ENDER_SEVERANCE.getRegName());
2015-12-29 00:09:51 +00:00
}
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
2016-03-18 19:38:26 +00:00
List<Entity> entityList = world.getEntitiesWithinAABB(Entity.class, new net.minecraft.util.math.AxisAlignedBB(player.posX - 4.5, player.posY - 4.5, player.posZ - 4.5, player.posX + 4.5, player.posY + 4.5, player.posZ + 4.5));
for (Entity entity : entityList)
{
2015-12-29 00:09:51 +00:00
if (entity instanceof EntityEnderman)
2016-03-18 19:38:26 +00:00
((EntityEnderman) entity).addPotionEffect(new PotionEffect(ModPotions.planarBinding, 40, 0));
2015-12-29 00:09:51 +00:00
}
}
2015-12-28 00:38:12 +00:00
}