aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/inventory/ResultContainer.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/inventory/ResultContainer.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/inventory/ResultContainer.java.patch118
1 files changed, 118 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/inventory/ResultContainer.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/inventory/ResultContainer.java.patch
new file mode 100644
index 0000000000..49eb45cd80
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/inventory/ResultContainer.java.patch
@@ -0,0 +1,118 @@
+--- a/net/minecraft/world/inventory/ResultContainer.java
++++ b/net/minecraft/world/inventory/ResultContainer.java
+@@ -1,5 +1,6 @@
+ package net.minecraft.world.inventory;
+
++import java.util.Iterator;
+ import javax.annotation.Nullable;
+ import net.minecraft.core.NonNullList;
+ import net.minecraft.world.Container;
+@@ -8,30 +9,80 @@
+ import net.minecraft.world.item.ItemStack;
+ import net.minecraft.world.item.crafting.RecipeHolder;
+
++// CraftBukkit start
++import org.bukkit.Location;
++import org.bukkit.craftbukkit.entity.CraftHumanEntity;
++import org.bukkit.entity.HumanEntity;
++// CraftBukkit end
++
+ public class ResultContainer implements Container, RecipeCraftingHolder {
+- private final NonNullList<ItemStack> itemStacks = NonNullList.withSize(1, ItemStack.EMPTY);
++
++ private final NonNullList<ItemStack> itemStacks;
+ @Nullable
+ private RecipeHolder<?> recipeUsed;
+
++ // CraftBukkit start
++ private int maxStack = MAX_STACK;
++
++ public java.util.List<ItemStack> getContents() {
++ return this.itemStacks;
++ }
++
++ public org.bukkit.inventory.InventoryHolder getOwner() {
++ return null; // Result slots don't get an owner
++ }
++
++ // Don't need a transaction; the InventoryCrafting keeps track of it for us
++ public void onOpen(CraftHumanEntity who) {}
++ public void onClose(CraftHumanEntity who) {}
++ public java.util.List<HumanEntity> getViewers() {
++ return new java.util.ArrayList<HumanEntity>();
++ }
++
+ @Override
++ public int getMaxStackSize() {
++ return maxStack;
++ }
++
++ public void setMaxStackSize(int size) {
++ maxStack = size;
++ }
++
++ @Override
++ public Location getLocation() {
++ return null;
++ }
++ // CraftBukkit end
++
++ public ResultContainer() {
++ this.itemStacks = NonNullList.withSize(1, ItemStack.EMPTY);
++ }
++
++ @Override
+ public int getContainerSize() {
+ return 1;
+ }
+
+ @Override
+ public boolean isEmpty() {
+- for (ItemStack itemStack : this.itemStacks) {
+- if (!itemStack.isEmpty()) {
+- return false;
++ Iterator iterator = this.itemStacks.iterator();
++
++ ItemStack itemstack;
++
++ do {
++ if (!iterator.hasNext()) {
++ return true;
+ }
+- }
+
+- return true;
++ itemstack = (ItemStack) iterator.next();
++ } while (itemstack.isEmpty());
++
++ return false;
+ }
+
+ @Override
+ public ItemStack getItem(int index) {
+- return this.itemStacks.get(0);
++ return (ItemStack) this.itemStacks.get(0);
+ }
+
+ @Override
+@@ -50,8 +101,7 @@
+ }
+
+ @Override
+- public void setChanged() {
+- }
++ public void setChanged() {}
+
+ @Override
+ public boolean stillValid(Player player) {
+@@ -64,8 +114,8 @@
+ }
+
+ @Override
+- public void setRecipeUsed(@Nullable RecipeHolder<?> recipeHolder) {
+- this.recipeUsed = recipeHolder;
++ public void setRecipeUsed(@Nullable RecipeHolder<?> recipeholder) {
++ this.recipeUsed = recipeholder;
+ }
+
+ @Nullable