Update to Minecraft 1.13-pre7

This commit is contained in:
md_5
2018-07-15 10:00:00 +10:00
parent 57ab4cfc6f
commit 421c1728c8
608 changed files with 17788 additions and 9378 deletions

View File

@@ -1,38 +1,38 @@
--- a/net/minecraft/server/RecipeRepair.java
+++ b/net/minecraft/server/RecipeRepair.java
@@ -3,9 +3,13 @@
@@ -2,12 +2,15 @@
import com.google.common.collect.Lists;
import java.util.ArrayList;
+import java.util.stream.Stream;
-public class RecipeRepair implements IRecipe {
-public class RecipeRepair extends IRecipeComplex {
+public class RecipeRepair extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
- public RecipeRepair() {}
+ // CraftBukkit start - Delegate to new parent class
+ public RecipeRepair() {
+ super("", new ItemStack(Items.LEATHER_HELMET), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.LEATHER_HELMET)));
+ }
public RecipeRepair(MinecraftKey minecraftkey) {
- super(minecraftkey);
+ super(minecraftkey, "", new ItemStack(Items.LEATHER_HELMET), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.LEATHER_HELMET)));
}
+ // CraftBukkit end
public boolean a(InventoryCrafting inventorycrafting, World world) {
ArrayList arraylist = Lists.newArrayList();
@@ -62,7 +66,18 @@
i1 = 0;
}
public boolean a(IInventory iinventory, World world) {
if (!(iinventory instanceof InventoryCrafting)) {
@@ -71,6 +74,17 @@
ItemStack itemstack3 = new ItemStack(itemstack2.getItem());
- return new ItemStack(itemstack2.getItem(), 1, i1);
itemstack3.setDamage(i1);
+ // CraftBukkit start - Construct a dummy repair recipe
+ ItemStack result = new ItemStack(itemstack.getItem(), 1, i1);
+ NonNullList<RecipeItemStack> ingredients = NonNullList.a();
+ ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack2.cloneItemStack()}));
+ ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack.cloneItemStack()}));
+ ShapelessRecipes recipe = new ShapelessRecipes("", result.cloneItemStack(), ingredients);
+ recipe.key = new MinecraftKey("repairitem");
+ inventorycrafting.currentRecipe = recipe;
+ result = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, result, inventorycrafting.container.getBukkitView(), true);
+ return result;
+ // return new ItemStack(itemstack2.getItem(), 1, i1);
+ if (iinventory instanceof InventoryCrafting) {
+ InventoryCrafting inventorycrafting = (InventoryCrafting) iinventory;
+ NonNullList<RecipeItemStack> ingredients = NonNullList.a();
+ ingredients.add(new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(itemstack2.cloneItemStack()))));
+ ingredients.add(new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(itemstack.cloneItemStack()))));
+ ShapelessRecipes recipe = new ShapelessRecipes(new MinecraftKey("repairitem"), "", itemstack3.cloneItemStack(), ingredients);
+ inventorycrafting.setCurrentRecipe(recipe);
+ itemstack3 = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycrafting.resultInventory, itemstack3, inventorycrafting.container.getBukkitView(), true);
+ }
+ // CraftBukkit end
return itemstack3;
}
}