mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-04 04:18:33 +01:00
Added playerWillDestroy call to WorldUtil.breakExtraBlock
This commit is contained in:
parent
d0f8c24a6d
commit
bb06b24af3
1 changed files with 11 additions and 2 deletions
|
@ -287,10 +287,11 @@ public final class WorldUtil {
|
|||
* @return If the break was successful.
|
||||
*/
|
||||
public static boolean breakExtraBlock(ItemStack stack, Level level, Player player, BlockPos pos) {
|
||||
BlockState state = level.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
|
||||
if (player.isCreative()) {
|
||||
BlockState state = level.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (block.onDestroyedByPlayer(state, level, pos, player, false, state.getFluidState())) {
|
||||
block.destroy(level, pos, state);
|
||||
}
|
||||
|
@ -302,6 +303,14 @@ public final class WorldUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
BlockState tempstate = level.getBlockState(pos);
|
||||
BlockState state = tempstate.getBlock().playerWillDestroy(level, pos, tempstate, player);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if (state.isAir()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// callback to the tool the player uses. Called on both sides. This damages the tool n stuff.
|
||||
stack.mineBlock(level, state, pos, player);
|
||||
|
||||
|
|
Loading…
Reference in a new issue