diff --git a/nms-patches/AdvancementDataPlayer.patch b/nms-patches/AdvancementDataPlayer.patch index 2a3238688f..b3e70215b1 100644 --- a/nms-patches/AdvancementDataPlayer.patch +++ b/nms-patches/AdvancementDataPlayer.patch @@ -9,15 +9,6 @@ }; private final MinecraftServer d; private final File e; -@@ -68,7 +68,7 @@ - this.g.clear(); - this.h.clear(); - this.i.clear(); -- this.k = true; -+ // this.k = true; // CraftBukkit - don't change flag on reload - this.g(); - } - @@ -88,7 +88,7 @@ Iterator iterator = this.data.entrySet().iterator(); diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch index d7f5e216b2..dff26072fc 100644 --- a/nms-patches/CraftingManager.patch +++ b/nms-patches/CraftingManager.patch @@ -1,6 +1,22 @@ --- a/net/minecraft/server/CraftingManager.java +++ b/net/minecraft/server/CraftingManager.java -@@ -158,12 +158,14 @@ +@@ -34,6 +34,7 @@ + + public static boolean init() { + try { ++ CraftingManager.c = 0; // Reset recipe ID count + a("armordye", new RecipeArmorDye()); + a("bookcloning", new RecipeBookClone()); + a("mapcloning", new RecipeMapClone()); +@@ -147,6 +148,7 @@ + if (CraftingManager.recipes.d(minecraftkey)) { + throw new IllegalStateException("Duplicate recipe ignored with ID " + minecraftkey); + } else { ++ irecipe.key = minecraftkey; // CraftBukkit + CraftingManager.recipes.a(CraftingManager.c++, minecraftkey, irecipe); + } + } +@@ -158,12 +160,14 @@ do { if (!iterator.hasNext()) { @@ -15,7 +31,7 @@ return irecipe.craftItem(inventorycrafting); } -@@ -175,12 +177,14 @@ +@@ -175,12 +179,14 @@ do { if (!iterator.hasNext()) { @@ -30,7 +46,7 @@ return irecipe; } -@@ -210,7 +214,7 @@ +@@ -210,7 +216,7 @@ } public static int a(IRecipe irecipe) { diff --git a/nms-patches/IRecipe.patch b/nms-patches/IRecipe.patch index d4840d72a2..48c1ebc405 100644 --- a/nms-patches/IRecipe.patch +++ b/nms-patches/IRecipe.patch @@ -1,13 +1,37 @@ --- a/net/minecraft/server/IRecipe.java +++ b/net/minecraft/server/IRecipe.java -@@ -28,7 +28,9 @@ - return ((MinecraftKey) CraftingManager.recipes.b(this)).a((MinecraftKey) CraftingManager.recipes.b(irecipe)); +@@ -3,6 +3,7 @@ + public abstract class IRecipe implements Comparable { + + protected String a; ++ public MinecraftKey key; // CraftBukkit + + public IRecipe() { + this(""); +@@ -25,10 +26,24 @@ + } + + public int a(IRecipe irecipe) { +- return ((MinecraftKey) CraftingManager.recipes.b(this)).a((MinecraftKey) CraftingManager.recipes.b(irecipe)); ++ return this.key.a(irecipe.key); // CraftBukkit } - public int compareTo(Object object) { -+ public int compareTo(IRecipe object) { // CraftBukkit = decompile error ++ public int compareTo(IRecipe object) { // CraftBukkit - decompile error return this.a((IRecipe) object); } + -+ public abstract org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit ++ // CraftBukkit start ++ @Override ++ public boolean equals(Object obj) { ++ return obj instanceof IRecipe && key.equals(((IRecipe) obj).key); ++ } ++ ++ @Override ++ public int hashCode() { ++ return key.hashCode(); ++ } ++ ++ public abstract org.bukkit.inventory.Recipe toBukkitRecipe(); ++ // CraftBukkit end } diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index 953095632a..e78caad175 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -601,13 +601,13 @@ + double d1 = enter.getZ(); + double d2 = 8.0D; + /* - double d0 = entity.locX; - double d1 = entity.locZ; - double d2 = 8.0D; - float f = entity.yaw; ++ double d0 = entity.locX; ++ double d1 = entity.locZ; ++ double d2 = 8.0D; ++ float f = entity.yaw; + */ - - worldserver.methodProfiler.a("moving"); ++ ++ worldserver.methodProfiler.a("moving"); + if (worldserver1.dimension == -1) { + d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b()+ 16.0D, worldserver1.getWorldBorder().d() - 16.0D); + d1 = MathHelper.a(d1 / d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D); @@ -676,13 +676,13 @@ + int i = worldserver.dimension; + + /* -+ double d0 = entity.locX; -+ double d1 = entity.locZ; -+ double d2 = 8.0D; -+ float f = entity.yaw; + double d0 = entity.locX; + double d1 = entity.locZ; + double d2 = 8.0D; + float f = entity.yaw; + */ -+ -+ worldserver.methodProfiler.a("moving"); + + worldserver.methodProfiler.a("moving"); + entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); + if (entity.isAlive()) { + worldserver.entityJoinedWorld(entity, false); @@ -918,3 +918,15 @@ if (worldserver != null) { worldserver.getPlayerChunkMap().a(i); +@@ -941,6 +1411,11 @@ + + advancementdataplayer.b(); + } ++ // CraftBukkit start - trigger immediate flush of advancements ++ for (EntityPlayer player : players) { ++ player.getAdvancementData().b(player); ++ } ++ // CraftBukkit end + + } + } diff --git a/nms-patches/ShapelessRecipes.patch b/nms-patches/ShapelessRecipes.patch index ff95bff682..cbe208aa84 100644 --- a/nms-patches/ShapelessRecipes.patch +++ b/nms-patches/ShapelessRecipes.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ShapelessRecipes.java +++ b/net/minecraft/server/ShapelessRecipes.java -@@ -5,11 +5,16 @@ +@@ -5,6 +5,10 @@ import com.google.gson.JsonObject; import java.util.ArrayList; import java.util.Iterator; @@ -11,13 +11,7 @@ public class ShapelessRecipes extends IRecipe { - private final ItemStack result; - private final NonNullList ingredients; -+ public MinecraftKey key; // CraftBukkit - - public ShapelessRecipes(String s, ItemStack itemstack, NonNullList nonnulllist) { - super(s); -@@ -17,6 +22,21 @@ +@@ -17,6 +21,21 @@ this.ingredients = nonnulllist; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 28725451e5..fc92b912f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1077,10 +1077,6 @@ public final class CraftServer implements Server { @Override public void resetRecipes() { - // See SPIGOT-3240 - if (true) { - return; - } CraftingManager.recipes = new RegistryMaterials(); CraftingManager.init(); RecipesFurnace.getInstance().recipes = new RecipesFurnace().recipes; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java index fd3aa7c0c5..26e945586e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java @@ -21,7 +21,7 @@ public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe { } public CraftShapedRecipe(ItemStack result, ShapedRecipes recipe) { - this(CraftNamespacedKey.fromMinecraft(CraftingManager.recipes.b(recipe)), result); + this(CraftNamespacedKey.fromMinecraft(recipe.key), result); this.recipe = recipe; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java index 93719c501a..7ba9502ad8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java @@ -21,7 +21,7 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe } public CraftShapelessRecipe(ItemStack result, ShapelessRecipes recipe) { - this(CraftNamespacedKey.fromMinecraft(recipe.key != null ? recipe.key : CraftingManager.recipes.b(recipe)), result); + this(CraftNamespacedKey.fromMinecraft(recipe.key), result); this.recipe = recipe; }