2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/block/BlockCrops.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockCrops.java
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -21,6 +21,8 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
|
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
public static final int MAX_AGE = 7;
|
|
|
|
@@ -76,7 +78,7 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
float f = getGrowthSpeed(this, worldserver, blockposition);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- worldserver.setBlock(blockposition, this.getStateForAge(i + 1), 2);
|
|
|
|
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, this.getStateForAge(i + 1), 2); // CraftBukkit
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -91,7 +93,7 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
i = j;
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- world.setBlock(blockposition, this.getStateForAge(i), 2);
|
|
|
|
+ CraftEventFactory.handleBlockGrowEvent(world, blockposition, this.getStateForAge(i), 2); // CraftBukkit
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
protected int getBonemealAgeIncrease(World world) {
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -149,7 +151,7 @@
|
2019-08-28 12:03:43 +02:00
|
|
|
|
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
2021-06-11 07:00:00 +02:00
|
|
|
- if (entity instanceof EntityRavager && world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (entity instanceof EntityRavager && !CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)).isCancelled()) { // CraftBukkit
|
|
|
|
world.destroyBlock(blockposition, true, entity);
|
2019-08-28 12:03:43 +02:00
|
|
|
}
|
|
|
|
|