use of stevekung.mods.moreplanets.util.entity.ISpaceMob in project MorePlanets by SteveKunG.
the class BlockInfectedVines method onEntityCollidedWithBlock.
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
if (entity instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) entity;
if (living instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
InventoryPlayer inventory = player.inventory;
for (int i = 0; i < 4; i++) {
if (!(inventory.armorInventory.get(i) != null && inventory.armorInventory.get(i).getItem() instanceof ItemArmor)) {
if (!player.capabilities.isCreativeMode) {
player.attackEntityFrom(DamageSourceMP.INFECTED_GAS, (int) (4.0D * 0.1D + 1.0D));
player.addPotionEffect(new PotionEffect(MobEffects.POISON, 50, 1));
}
}
}
}
if (!(living instanceof EntityPlayer) && !(entity instanceof ISpaceMob && ((ISpaceMob) entity).getMobType() == EnumMobType.NIBIRU)) {
living.attackEntityFrom(DamageSourceMP.INFECTED_GAS, (int) (4.0D * 0.1D + 1.0D));
living.addPotionEffect(new PotionEffect(MobEffects.POISON, 50, 1));
}
}
}
Aggregations