mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-04 22:22:18 -07:00
Correctly call BlockFadeEvents (#12141)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -95,31 +_,56 @@
|
||||
@@ -95,31 +_,59 @@
|
||||
@Override
|
||||
protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
||||
int moistureValue = state.getValue(MOISTURE);
|
||||
@@ -53,9 +53,12 @@
|
||||
|
||||
public static void turnToDirt(@Nullable Entity entity, BlockState state, Level level, BlockPos pos) {
|
||||
+ // 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;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
BlockState blockState = pushEntitiesUp(state, Blocks.DIRT.defaultBlockState(), level, pos);
|
||||
level.setBlockAndUpdate(pos, blockState);
|
||||
|
Reference in New Issue
Block a user