Update to Minecraft 1.11

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2016-11-17 12:41:03 +11:00
parent 49bc1c57f9
commit 4e412ab4e3
279 changed files with 3722 additions and 2992 deletions

View File

@@ -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
}
}
}