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

34 lines
1.2 KiB
Java
Raw Normal View History

2015-12-27 19:38:12 -05:00
package WayofTime.bloodmagic.item.sigil;
import java.util.List;
2015-12-28 19:09:51 -05: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.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModPotions;
2015-12-28 19:09:51 -05:00
public class ItemSigilEnderSeverance extends ItemSigilToggleable
{
public ItemSigilEnderSeverance()
{
2015-12-28 19:09:51 -05:00
super("enderSeverance", 200);
setRegistryName(Constants.BloodMagicItem.SIGIL_ENDER_SEVERANCE.getRegName());
2015-12-28 19:09:51 -05:00
}
@Override
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
{
2015-12-28 19:09:51 -05:00
List<Entity> entityList = world.getEntitiesWithinAABB(Entity.class, new 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-28 19:09:51 -05:00
if (entity instanceof EntityEnderman)
((EntityEnderman) entity).addPotionEffect(new PotionEffect(ModPotions.planarBinding.id, 40, 0));
}
}
2015-12-27 19:38:12 -05:00
}