Jump to content

xaedblade

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by xaedblade

  1. Ok so I've been racking my brain on this one for some time. I have a block that takes damage and is destroyed by mobs. This all works fine. But my problem is that when a mob breaks the block the particles happen on the player and not the block. Any help would be much appreciated. I know that I could use the setBlockAir but I'd rather get the particles... it's so odd because the pos works for the block to update it's state but not to add particles... Code below public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (!worldIn.isRemote) { entityIn.setInWeb(); if(!(entityIn instanceof EntityItem)) { entityIn.attackEntityFrom(DamageSource.CACTUS, 1.0F); int currentDamage = worldIn.getBlockState(pos).getValue(DAMAGE_VALUE); Random randNum = new Random(); if((currentDamage+1) < 5 && randNum.nextInt(100) == 34) { System.out.println(currentDamage); worldIn.setBlockState(pos, this.getDefaultState().withProperty(DAMAGE_VALUE, currentDamage+1)); worldIn.playSound(null, pos, SoundEvents.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, SoundCategory.BLOCKS, 1.0F, 2.0F);; } else if((currentDamage+1) >= 5) { worldIn.playSound(null, pos, SoundEvents.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, SoundCategory.BLOCKS, 1.0F, 2.0F); worldIn.destroyBlock(pos, false); } } } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.