Move this up I guess?

Closes #160
This commit is contained in:
Ellpeck 2016-07-19 09:15:09 +02:00
parent 15a0608055
commit 8ea5a3a330

View file

@ -350,15 +350,21 @@ public final class WorldUtil{
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
Block block = state.getBlock(); Block block = state.getBlock();
if(!world.isRemote){
world.playEvent(player, 2001, pos, Block.getStateId(state));
}
else{
world.playEvent(2001, pos, Block.getStateId(state));
}
if(player.capabilities.isCreativeMode){ if(player.capabilities.isCreativeMode){
block.onBlockHarvested(world, pos, state, player); block.onBlockHarvested(world, pos, state, player);
if(block.removedByPlayer(state, world, pos, player, false)){ if(block.removedByPlayer(state, world, pos, player, false)){
block.onBlockDestroyedByPlayer(world, pos, state); block.onBlockDestroyedByPlayer(world, pos, state);
} }
if(!world.isRemote){ if(!world.isRemote){
world.playEvent(player, 2001, pos, Block.getStateId(state));
if(player instanceof EntityPlayerMP){ if(player instanceof EntityPlayerMP){
((EntityPlayerMP)player).connection.sendPacket(new SPacketBlockChange(world, pos)); ((EntityPlayerMP)player).connection.sendPacket(new SPacketBlockChange(world, pos));
} }
@ -385,7 +391,6 @@ public final class WorldUtil{
block.dropXpOnBlockBreak(world, pos, xp); block.dropXpOnBlockBreak(world, pos, xp);
} }
world.playEvent(player, 2001, pos, Block.getStateId(state));
playerMp.connection.sendPacket(new SPacketBlockChange(world, pos)); playerMp.connection.sendPacket(new SPacketBlockChange(world, pos));
return true; return true;
} }
@ -395,9 +400,6 @@ public final class WorldUtil{
block.onBlockDestroyedByPlayer(world, pos, state); block.onBlockDestroyedByPlayer(world, pos, state);
} }
stack.onBlockDestroyed(world, state, pos, player);
world.playEvent(2001, pos, Block.getStateId(state));
if(stack.stackSize <= 0 && stack == player.getHeldItemMainhand()){ if(stack.stackSize <= 0 && stack == player.getHeldItemMainhand()){
ForgeEventFactory.onPlayerDestroyItem(player, stack, EnumHand.MAIN_HAND); ForgeEventFactory.onPlayerDestroyItem(player, stack, EnumHand.MAIN_HAND);
player.setHeldItem(EnumHand.MAIN_HAND, null); player.setHeldItem(EnumHand.MAIN_HAND, null);