Add BlockBreakBlockEvent
This commit is contained in:
@@ -62,7 +62,24 @@
|
||||
FluidState fluid = iblockdata1.getFluidState();
|
||||
|
||||
if (fluid.getType().isSame(this) && FlowingFluid.canPassThroughWall(enumdirection, world, pos, state, blockposition_mutableblockposition1, iblockdata1)) {
|
||||
@@ -306,7 +335,8 @@
|
||||
@@ -287,7 +316,7 @@
|
||||
ifluidcontainer.placeLiquid(world, pos, state, fluidState);
|
||||
} else {
|
||||
if (!state.isAir()) {
|
||||
- this.beforeDestroyingBlock(world, pos, state);
|
||||
+ this.beforeDestroyingBlock(world, pos, state, pos.relative(direction.getOpposite())); // Paper - Add BlockBreakBlockEvent
|
||||
}
|
||||
|
||||
world.setBlock(pos, fluidState.createLegacyBlock(), 3);
|
||||
@@ -295,6 +324,7 @@
|
||||
|
||||
}
|
||||
|
||||
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(world, pos, state); } // Paper - Add BlockBreakBlockEvent
|
||||
protected abstract void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state);
|
||||
|
||||
protected int getSlopeDistance(LevelReader world, BlockPos pos, int i, Direction direction, BlockState state, FlowingFluid.SpreadContext spreadCache) {
|
||||
@@ -306,7 +336,8 @@
|
||||
|
||||
if (enumdirection1 != direction) {
|
||||
BlockPos blockposition1 = pos.relative(enumdirection1);
|
||||
@@ -72,7 +89,7 @@
|
||||
FluidState fluid = iblockdata1.getFluidState();
|
||||
|
||||
if (this.canPassThrough(world, this.getFlowing(), pos, state, enumdirection1, blockposition1, iblockdata1, fluid)) {
|
||||
@@ -372,7 +402,8 @@
|
||||
@@ -372,7 +403,8 @@
|
||||
while (iterator.hasNext()) {
|
||||
Direction enumdirection = (Direction) iterator.next();
|
||||
BlockPos blockposition1 = pos.relative(enumdirection);
|
||||
@@ -82,7 +99,7 @@
|
||||
FluidState fluid = iblockdata1.getFluidState();
|
||||
|
||||
if (this.canMaybePassThrough(world, pos, state, enumdirection, blockposition1, iblockdata1, fluid)) {
|
||||
@@ -444,10 +475,24 @@
|
||||
@@ -444,10 +476,24 @@
|
||||
if (fluid1.isEmpty()) {
|
||||
fluidState = fluid1;
|
||||
blockState = Blocks.AIR.defaultBlockState();
|
||||
@@ -107,7 +124,7 @@
|
||||
world.setBlock(pos, blockState, 3);
|
||||
world.scheduleTick(pos, fluid1.getType(), i);
|
||||
}
|
||||
@@ -524,12 +569,27 @@
|
||||
@@ -524,12 +570,27 @@
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
return this.getBlockState(pos, this.getCacheKey(pos));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/world/level/material/WaterFluid.java
|
||||
+++ b/net/minecraft/world/level/material/WaterFluid.java
|
||||
@@ -81,7 +81,14 @@
|
||||
return world.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION);
|
||||
}
|
||||
|
||||
+ // Paper start - Add BlockBreakBlockEvent
|
||||
@Override
|
||||
+ protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state, BlockPos source) {
|
||||
+ BlockEntity tileentity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;
|
||||
+ Block.dropResources(state, world, pos, tileentity, source);
|
||||
+ }
|
||||
+ // Paper end - Add BlockBreakBlockEvent
|
||||
+ @Override
|
||||
protected void beforeDestroyingBlock(LevelAccessor world, BlockPos pos, BlockState state) {
|
||||
BlockEntity blockEntity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;
|
||||
Block.dropResources(state, world, pos, blockEntity);
|
||||
Reference in New Issue
Block a user