mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
Misc advancement / recipe reload fixes including SPIGOT-3240
This commit is contained in:
parent
c410240567
commit
45102fcf28
@ -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();
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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<IRecipe> {
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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<RecipeItemStack> ingredients;
|
||||
+ public MinecraftKey key; // CraftBukkit
|
||||
|
||||
public ShapelessRecipes(String s, ItemStack itemstack, NonNullList<RecipeItemStack> nonnulllist) {
|
||||
super(s);
|
||||
@@ -17,6 +22,21 @@
|
||||
@@ -17,6 +21,21 @@
|
||||
this.ingredients = nonnulllist;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user