summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-07-08 11:12:40 +1000
committermd_5 <git@md-5.net>2016-07-08 11:12:40 +1000
commitd7c257e120996eab1eab7d2bc5a31749ccbe274a (patch)
treebfc1583b58526fc6442e89b9d81d9e11b6986ca6 /nms-patches
parenta327d9f1da49d0ede770894d83e33d10fb6c19fd (diff)
downloadcraftbukkit-d7c257e120996eab1eab7d2bc5a31749ccbe274a.tar
craftbukkit-d7c257e120996eab1eab7d2bc5a31749ccbe274a.tar.gz
craftbukkit-d7c257e120996eab1eab7d2bc5a31749ccbe274a.tar.lz
craftbukkit-d7c257e120996eab1eab7d2bc5a31749ccbe274a.tar.xz
craftbukkit-d7c257e120996eab1eab7d2bc5a31749ccbe274a.zip
SPIGOT-2490: Villager farming event
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/BlockRedstoneOre.patch2
-rw-r--r--nms-patches/BlockSoil.patch2
-rw-r--r--nms-patches/BlockWaterLily.patch2
-rw-r--r--nms-patches/EntityEnderman.patch2
-rw-r--r--nms-patches/EntityFallingBlock.patch4
-rw-r--r--nms-patches/EntityPotion.patch2
-rw-r--r--nms-patches/EntityRabbit.patch4
-rw-r--r--nms-patches/EntitySilverfish.patch4
-rw-r--r--nms-patches/EntityWither.patch2
-rw-r--r--nms-patches/PathfinderGoalVillagerFarm.patch49
10 files changed, 61 insertions, 12 deletions
diff --git a/nms-patches/BlockRedstoneOre.patch b/nms-patches/BlockRedstoneOre.patch
index f209a284..417cd311 100644
--- a/nms-patches/BlockRedstoneOre.patch
+++ b/nms-patches/BlockRedstoneOre.patch
@@ -56,7 +56,7 @@
this.playEffect(world, blockposition);
if (this == Blocks.REDSTONE_ORE) {
+ // CraftBukkit start
-+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.LIT_REDSTONE_ORE, 0).isCancelled()) {
++ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.LIT_REDSTONE_ORE, 0).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
diff --git a/nms-patches/BlockSoil.patch b/nms-patches/BlockSoil.patch
index c8396b93..35c2fd56 100644
--- a/nms-patches/BlockSoil.patch
+++ b/nms-patches/BlockSoil.patch
@@ -45,7 +45,7 @@
+ return;
+ }
+
-+ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.DIRT, 0).isCancelled()) {
++ if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.DIRT, 0).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
diff --git a/nms-patches/BlockWaterLily.patch b/nms-patches/BlockWaterLily.patch
index 561facbf..83a6ae1d 100644
--- a/nms-patches/BlockWaterLily.patch
+++ b/nms-patches/BlockWaterLily.patch
@@ -5,7 +5,7 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
super.a(world, blockposition, iblockdata, entity);
- if (entity instanceof EntityBoat) {
-+ if (entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) { // CraftBukkit
++ if (entity instanceof EntityBoat && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR, 0).isCancelled()) { // CraftBukkit
world.setAir(new BlockPosition(blockposition), true);
}
diff --git a/nms-patches/EntityEnderman.patch b/nms-patches/EntityEnderman.patch
index 1c4a6acf..fbb2c661 100644
--- a/nms-patches/EntityEnderman.patch
+++ b/nms-patches/EntityEnderman.patch
@@ -56,7 +56,7 @@
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {
+ // CraftBukkit start - Place event
-+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a.getCarried().getBlock(), this.a.getCarried().getBlock().toLegacyData(this.a.getCarried())).isCancelled()) {
++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, this.a.getCarried().getBlock(), this.a.getCarried().getBlock().toLegacyData(this.a.getCarried())).isCancelled()) {
world.setTypeAndData(blockposition, iblockdata2, 3);
this.a.setCarried((IBlockData) null);
+ }
diff --git a/nms-patches/EntityFallingBlock.patch b/nms-patches/EntityFallingBlock.patch
index 2c1dcfd2..8dd4e980 100644
--- a/nms-patches/EntityFallingBlock.patch
+++ b/nms-patches/EntityFallingBlock.patch
@@ -14,7 +14,7 @@
if (this.ticksLived++ == 0) {
blockposition = new BlockPosition(this);
- if (this.world.getType(blockposition).getBlock() == block) {
-+ if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
++ if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR, 0).isCancelled()) {
this.world.setAir(blockposition);
} else if (!this.world.isClientSide) {
this.die();
@@ -34,7 +34,7 @@
- if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.i(this.world.getType(blockposition.down())) && this.world.setTypeAndData(blockposition, this.block, 3)) {
+ // CraftBukkit start
+ if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.i(this.world.getType(blockposition.down()))) {
-+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) {
++ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) {
+ return;
+ }
+ this.world.setTypeAndData(blockposition, this.block, 3);
diff --git a/nms-patches/EntityPotion.patch b/nms-patches/EntityPotion.patch
index b6831b1a..ef720315 100644
--- a/nms-patches/EntityPotion.patch
+++ b/nms-patches/EntityPotion.patch
@@ -128,7 +128,7 @@
private void a(BlockPosition blockposition) {
if (this.world.getType(blockposition).getBlock() == Blocks.FIRE) {
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) return; // CraftBukkit
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR, 0).isCancelled()) return; // CraftBukkit
this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 2);
}
diff --git a/nms-patches/EntityRabbit.patch b/nms-patches/EntityRabbit.patch
index 0ecf7855..ede26f1e 100644
--- a/nms-patches/EntityRabbit.patch
+++ b/nms-patches/EntityRabbit.patch
@@ -20,7 +20,7 @@
if (integer.intValue() == 0) {
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.c, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.c, blockposition, Blocks.AIR, 0).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
@@ -30,7 +30,7 @@
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
+ this.c,
-+ blockposition.getX(), blockposition.getY(), blockposition.getZ(),
++ blockposition,
+ block, block.toLegacyData(iblockdata.set(BlockCarrots.AGE, Integer.valueOf(integer.intValue() - 1)))
+ ).isCancelled()) {
+ return;
diff --git a/nms-patches/EntitySilverfish.patch b/nms-patches/EntitySilverfish.patch
index 8c698231..1763e175 100644
--- a/nms-patches/EntitySilverfish.patch
+++ b/nms-patches/EntitySilverfish.patch
@@ -5,7 +5,7 @@
if (BlockMonsterEggs.i(iblockdata)) {
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.MONSTER_EGG, Block.getId(BlockMonsterEggs.getById(iblockdata.getBlock().toLegacyData(iblockdata)))).isCancelled()) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition, Blocks.MONSTER_EGG, Block.getId(BlockMonsterEggs.getById(iblockdata.getBlock().toLegacyData(iblockdata)))).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
@@ -17,7 +17,7 @@
if (iblockdata.getBlock() == Blocks.MONSTER_EGG) {
+ // CraftBukkit start
-+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), Blocks.AIR, 0).isCancelled()) {
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, Blocks.AIR, 0).isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
diff --git a/nms-patches/EntityWither.patch b/nms-patches/EntityWither.patch
index 4ba2f41d..3e25bf5b 100644
--- a/nms-patches/EntityWither.patch
+++ b/nms-patches/EntityWither.patch
@@ -60,7 +60,7 @@
if (iblockdata.getMaterial() != Material.AIR && a(block)) {
+ // CraftBukkit start
-+ if (CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, Blocks.AIR, 0).isCancelled()) {
++ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR, 0).isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
diff --git a/nms-patches/PathfinderGoalVillagerFarm.patch b/nms-patches/PathfinderGoalVillagerFarm.patch
new file mode 100644
index 00000000..449a3a77
--- /dev/null
+++ b/nms-patches/PathfinderGoalVillagerFarm.patch
@@ -0,0 +1,49 @@
+--- a/net/minecraft/server/PathfinderGoalVillagerFarm.java
++++ b/net/minecraft/server/PathfinderGoalVillagerFarm.java
+@@ -48,7 +48,11 @@
+ Block block = iblockdata.getBlock();
+
+ if (this.f == 0 && block instanceof BlockCrops && ((BlockCrops) block).y(iblockdata)) {
+- world.setAir(blockposition, true);
++ // CraftBukkit start
++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.c, blockposition, Blocks.AIR, 0).isCancelled()) {
++ world.setAir(blockposition, true);
++ }
++ // CraftBukkit end
+ } else if (this.f == 1 && iblockdata.getMaterial() == Material.AIR) {
+ InventorySubcontainer inventorysubcontainer = this.c.dj();
+
+@@ -57,19 +61,29 @@
+ boolean flag = false;
+
+ if (itemstack != null) {
++ // 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.BEETROOT.getBlockData(), 3);
++ planted = Blocks.BEETROOT;
+ flag = true;
+ }
++
++ if (planted != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.c, blockposition, planted, 0).isCancelled()) {
++ world.setTypeAndData(blockposition, planted.getBlockData(), 3);
++ } else {
++ flag = false;
++ }
++ // CraftBukkit end
+ }
+
+ if (flag) {