0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-25 13:56:14 +00:00
craftbukkit/nms-patches/net/minecraft/world/level/block/BlockCrops.patch
2024-10-23 02:15:00 +11:00

39 lines
1.8 KiB
Diff

--- a/net/minecraft/world/level/block/BlockCrops.java
+++ b/net/minecraft/world/level/block/BlockCrops.java
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
public static final MapCodec<BlockCrops> CODEC = simpleCodec(BlockCrops::new);
@@ -83,7 +85,7 @@
float f = getGrowthSpeed(this, worldserver, blockposition);
if (randomsource.nextInt((int) (25.0F / f) + 1) == 0) {
- worldserver.setBlock(blockposition, this.getStateForAge(i + 1), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getStateForAge(i + 1), 2); // CraftBukkit
}
}
}
@@ -98,7 +100,7 @@
i = j;
}
- world.setBlock(blockposition, this.getStateForAge(i), 2);
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getStateForAge(i), 2); // CraftBukkit
}
protected int getBonemealAgeIncrease(World world) {
@@ -161,7 +163,7 @@
@Override
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (world instanceof WorldServer worldserver) {
- if (entity instanceof EntityRavager && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (entity instanceof EntityRavager && CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState(), !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
worldserver.destroyBlock(blockposition, true, entity);
}
}