Correctly call BlockFadeEvents (#12141)

This commit is contained in:
Epic 2025-02-17 23:19:30 +00:00 committed by GitHub
parent 142695eb00
commit e494f2894e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/FarmBlock.java --- a/net/minecraft/world/level/block/FarmBlock.java
+++ b/net/minecraft/world/level/block/FarmBlock.java +++ b/net/minecraft/world/level/block/FarmBlock.java
@@ -95,31 +_,56 @@ @@ -95,31 +_,59 @@
@Override @Override
protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
int moistureValue = state.getValue(MOISTURE); int moistureValue = state.getValue(MOISTURE);
@ -53,9 +53,12 @@
public static void turnToDirt(@Nullable Entity entity, BlockState state, Level level, BlockPos pos) { public static void turnToDirt(@Nullable Entity entity, BlockState state, Level level, BlockPos pos) {
+ // CraftBukkit start + // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(level, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) { + if (entity == null) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory
+ .callBlockFadeEvent(level, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
+ return; + return;
+ } + }
+ }
+ // CraftBukkit end + // CraftBukkit end
BlockState blockState = pushEntitiesUp(state, Blocks.DIRT.defaultBlockState(), level, pos); BlockState blockState = pushEntitiesUp(state, Blocks.DIRT.defaultBlockState(), level, pos);
level.setBlockAndUpdate(pos, blockState); level.setBlockAndUpdate(pos, blockState);