@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
super.onEntityCollidedWithBlock(world, pos, state, entity);
if (!world.isRemote && !entity.isDead && entity instanceof EntityLivingBase) {
TileEntity tile = world.getTileEntity(pos);
ElectricFenceWireBlock block = (ElectricFenceWireBlock) state.getBlock();
if (tile instanceof ElectricFenceWireBlockEntity && ((ElectricFenceWireBlockEntity) tile).isPowered()) {
if(block.getType().equals(FenceType.LOW))
entity.attackEntityFrom(DamageSources.SHOCK, 1.0F);
if(block.getType().equals(FenceType.MED))
entity.attackEntityFrom(DamageSources.SHOCK, 2.0F);
if(block.getType().equals(FenceType.HIGH))
entity.attackEntityFrom(DamageSources.SHOCK, 3.0F);
if (entity instanceof DinosaurEntity) {
DinosaurEntity dinosaur = (DinosaurEntity) entity;
if (dinosaur.wireTicks < 2) {
dinosaur.wireTicks++;
dinosaur.disableHerdingTicks = 200;
}
}
if (entity.ticksExisted % 10 == 0) {
world.playSound(null, entity.posX, entity.posY, entity.posZ, SoundHandler.FENCE_SHOCK, SoundCategory.BLOCKS, 0.25F, 1.0F);
}
}
}
}