Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-23 14:50:08 +01:00
49 Zeilen
2.5 KiB
Diff
49 Zeilen
2.5 KiB
Diff
--- a/net/minecraft/server/PathfinderGoalVillagerFarm.java
|
|
+++ b/net/minecraft/server/PathfinderGoalVillagerFarm.java
|
|
@@ -40,7 +40,11 @@
|
|
Block block = iblockdata.getBlock();
|
|
|
|
if (this.i == 0 && block instanceof BlockCrops && ((BlockCrops) block).w(iblockdata)) {
|
|
- world.setAir(blockposition, true);
|
|
+ // CraftBukkit start
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.f, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
|
+ world.setAir(blockposition, true);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
} else if (this.i == 1 && iblockdata.isAir()) {
|
|
InventorySubcontainer inventorysubcontainer = this.f.dD();
|
|
|
|
@@ -49,19 +53,28 @@
|
|
boolean flag = false;
|
|
|
|
if (!itemstack.isEmpty()) {
|
|
+ // CraftBukkit start
|
|
+ Block planted = null;
|
|
if (itemstack.getItem() == Items.WHEAT_SEEDS) {
|
|
- world.setTypeAndData(blockposition, Blocks.WHEAT.getBlockData(), 3);
|
|
+ planted = Blocks.WHEAT;
|
|
flag = true;
|
|
} else if (itemstack.getItem() == Items.POTATO) {
|
|
- world.setTypeAndData(blockposition, Blocks.POTATOES.getBlockData(), 3);
|
|
+ planted = Blocks.POTATOES;
|
|
flag = true;
|
|
} else if (itemstack.getItem() == Items.CARROT) {
|
|
- world.setTypeAndData(blockposition, Blocks.CARROTS.getBlockData(), 3);
|
|
+ planted = Blocks.CARROTS;
|
|
flag = true;
|
|
} else if (itemstack.getItem() == Items.BEETROOT_SEEDS) {
|
|
- world.setTypeAndData(blockposition, Blocks.BEETROOTS.getBlockData(), 3);
|
|
+ planted = Blocks.BEETROOTS;
|
|
flag = true;
|
|
}
|
|
+
|
|
+ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.f, blockposition, planted.getBlockData()).isCancelled()) {
|
|
+ world.setTypeAndData(blockposition, planted.getBlockData(), 3);
|
|
+ } else {
|
|
+ flag = false;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
if (flag) {
|