From c25ddf063a808e3adb749e22017661f403c5fb7e Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 17 Nov 2016 12:41:03 +1100 Subject: Update to Minecraft 1.11 --- nms-patches/EntityVillager.patch | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'nms-patches/EntityVillager.patch') diff --git a/nms-patches/EntityVillager.patch b/nms-patches/EntityVillager.patch index 85102eec..697cdc03 100644 --- a/nms-patches/EntityVillager.patch +++ b/nms-patches/EntityVillager.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/server/EntityVillager.java +++ b/net/minecraft/server/EntityVillager.java -@@ -3,6 +3,14 @@ - import java.util.Iterator; - import java.util.Random; +@@ -6,6 +6,14 @@ import javax.annotation.Nullable; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +// CraftBukkit start +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.entity.CraftVillager; @@ -13,9 +13,9 @@ +import org.bukkit.event.entity.VillagerReplenishTradeEvent; +// CraftBukkit end - public class EntityVillager extends EntityAgeable implements IMerchant, NPC { + public class EntityVillager extends EntityAgeable implements NPC, IMerchant { -@@ -31,7 +39,7 @@ +@@ -36,7 +44,7 @@ public EntityVillager(World world, int i) { super(world); @@ -24,7 +24,7 @@ this.setProfession(i); this.setSize(0.6F, 1.95F); ((Navigation) this.getNavigation()).a(true); -@@ -110,7 +118,14 @@ +@@ -118,7 +126,14 @@ MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); if (merchantrecipe.h()) { @@ -40,25 +40,25 @@ } } -@@ -429,7 +444,20 @@ - for (int l = 0; l < k; ++l) { - EntityVillager.IMerchantRecipeOption entityvillager_imerchantrecipeoption = aentityvillager_imerchantrecipeoption3[l]; +@@ -454,7 +469,20 @@ + for (int l = 0; l < k; ++l) { + EntityVillager.IMerchantRecipeOption entityvillager_imerchantrecipeoption = aentityvillager_imerchantrecipeoption3[l]; -- entityvillager_imerchantrecipeoption.a(this.trades, this.random); -+ // CraftBukkit start -+ // this is a hack. this must be done because otherwise, if -+ // mojang adds a new type of villager merchant option, it will need to -+ // have event handling added manually. this is better than having to do that. -+ MerchantRecipeList list = new MerchantRecipeList(); -+ entityvillager_imerchantrecipeoption.a(list, this.random); -+ for (MerchantRecipe recipe : list) { -+ VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((Villager) getBukkitEntity(), recipe.asBukkit()); -+ Bukkit.getPluginManager().callEvent(event); -+ if (!event.isCancelled()) { -+ this.trades.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft()); +- entityvillager_imerchantrecipeoption.a(this, this.trades, this.random); ++ // CraftBukkit start ++ // this is a hack. this must be done because otherwise, if ++ // mojang adds a new type of villager merchant option, it will need to ++ // have event handling added manually. this is better than having to do that. ++ MerchantRecipeList list = new MerchantRecipeList(); ++ entityvillager_imerchantrecipeoption.a(this, list, this.random); ++ for (MerchantRecipe recipe : list) { ++ VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((Villager) getBukkitEntity(), recipe.asBukkit()); ++ Bukkit.getPluginManager().callEvent(event); ++ if (!event.isCancelled()) { ++ this.trades.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft()); ++ } + } -+ } -+ // CraftBukkit end ++ // CraftBukkit end + } } - } -- cgit v1.2.3