@Override protected boolean isValidTarget(Entity ent) { if (ent instanceof TargetEntity) return ((TargetEntity) ent).shouldTarget(this, placerUUID); if (!(ent instanceof EntityLivingBase)) return false; EntityLivingBase elb = (EntityLivingBase) ent; if (elb.isDead || elb.getHealth() <= 0) return false; if (ent.onGround || ent.isInWater() || ent.isInsideOfMaterial(Material.lava)) return false; if (elb instanceof EntityFlying && ReikaEntityHelper.isHostile(elb)) { return ReikaMathLibrary.py3d( ent.posX - xCoord - 0.5, ent.posY - yCoord - 0.5, ent.posZ - zCoord - 0.5) > 2; } if (ent instanceof EntityBlaze || ent instanceof EntityWither || ent instanceof EntityDragon) { return ReikaMathLibrary.py3d( ent.posX - xCoord - 0.5, ent.posY - yCoord - 0.5, ent.posZ - zCoord - 0.5) > 2; } if (ent instanceof FlyingMob) { FlyingMob fm = (FlyingMob) ent; return fm.isCurrentlyFlying() && fm.isHostile() && ReikaMathLibrary.py3d( ent.posX - xCoord - 0.5, ent.posY - yCoord - 0.5, ent.posZ - zCoord - 0.5) > 2; } if (InterfaceCache.BCROBOT.instanceOf(ent)) { return true; } return false; }
/** * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, * y, z, entity */ @Override public void onEntityCollidedWithBlock(World par1World, int x, int y, int z, Entity par5Entity) { if (par5Entity instanceof EntityLiving) { if (par5Entity.isInsideOfMaterial(this.blockMaterial)) { ((EntityLiving) par5Entity).addPotionEffect(new PotionEffect(Potion.blindness.id, 20, 2)); } } }
@Override public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag) { super.onUpdate(itemstack, world, entity, i, flag); if (entity instanceof EntityPlayer && ((EntityPlayer) entity).inventory.getCurrentItem() == itemstack) if (!entity.isInsideOfMaterial(Material.water)) { float f = 1F; float f1 = 27F; float particleX = -MathHelper.sin(((entity.rotationYaw + f1) / 180F) * 3.141593F) * MathHelper.cos((entity.rotationPitch / 180F) * 3.141593F) * f; float particleY = -MathHelper.sin((entity.rotationPitch / 180F) * 3.141593F) - 0.1F; float particleZ = MathHelper.cos(((entity.rotationYaw + f1) / 180F) * 3.141593F) * MathHelper.cos((entity.rotationPitch / 180F) * 3.141593F) * f; if (weapon.getItemRand().nextInt(5) == 0) { world.spawnParticle( EnumParticleTypes.FLAME, entity.posX + particleX, entity.posY + particleY, entity.posZ + particleZ, 0.0D, 0.0D, 0.0D); } if (weapon.getItemRand().nextInt(5) == 0) { world.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, entity.posX + particleX, entity.posY + particleY, entity.posZ + particleZ, 0.0D, 0.0D, 0.0D); } } }