aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/Container.java.patch
blob: a1120efc62a31aec61cfa01b7bf1681702d4e79a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
--- a/net/minecraft/world/Container.java
+++ b/net/minecraft/world/Container.java
@@ -6,10 +6,15 @@
 import net.minecraft.world.entity.player.Player;
 import net.minecraft.world.item.Item;
 import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import net.minecraft.world.item.crafting.RecipeHolder;
 import net.minecraft.world.level.Level;
 import net.minecraft.world.level.block.entity.BlockEntity;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+// CraftBukkit end
 
 public interface Container extends Clearable {
+
     int LARGE_MAX_STACK_SIZE = 64;
     int DEFAULT_DISTANCE_LIMIT = 8;
 
@@ -25,19 +30,15 @@
 
     void setItem(int slot, ItemStack stack);
 
-    default int getMaxStackSize() {
-        return 64;
-    }
+    int getMaxStackSize(); // CraftBukkit
 
     void setChanged();
 
     boolean stillValid(Player player);
 
-    default void startOpen(Player player) {
-    }
+    default void startOpen(Player player) {}
 
-    default void stopOpen(Player player) {
-    }
+    default void stopOpen(Player player) {}
 
     default boolean canPlaceItem(int index, ItemStack stack) {
         return true;
@@ -50,10 +51,11 @@
     default int countItem(Item item) {
         int i = 0;
 
-        for (int i1 = 0; i1 < this.getContainerSize(); i1++) {
-            ItemStack item1 = this.getItem(i1);
-            if (item1.getItem().equals(item)) {
-                i += item1.getCount();
+        for (int j = 0; j < this.getContainerSize(); ++j) {
+            ItemStack itemstack = this.getItem(j);
+
+            if (itemstack.getItem().equals(item)) {
+                i += itemstack.getCount();
             }
         }
 
@@ -61,13 +63,16 @@
     }
 
     default boolean hasAnyOf(Set<Item> set) {
-        return this.hasAnyMatching(item -> !item.isEmpty() && set.contains(item.getItem()));
+        return this.hasAnyMatching((itemstack) -> {
+            return !itemstack.isEmpty() && set.contains(itemstack.getItem());
+        });
     }
 
     default boolean hasAnyMatching(Predicate<ItemStack> predicate) {
-        for (int i = 0; i < this.getContainerSize(); i++) {
-            ItemStack item = this.getItem(i);
-            if (predicate.test(item)) {
+        for (int i = 0; i < this.getContainerSize(); ++i) {
+            ItemStack itemstack = this.getItem(i);
+
+            if (predicate.test(itemstack)) {
                 return true;
             }
         }
@@ -80,11 +85,34 @@
     }
 
     static boolean stillValidBlockEntity(BlockEntity blockEntity, Player player, int maxDistance) {
-        Level level = blockEntity.getLevel();
-        BlockPos blockPos = blockEntity.getBlockPos();
-        return level != null
-            && level.getBlockEntity(blockPos) == blockEntity
-            && player.distanceToSqr((double)blockPos.getX() + 0.5, (double)blockPos.getY() + 0.5, (double)blockPos.getZ() + 0.5)
-                <= (double)(maxDistance * maxDistance);
+        Level world = blockEntity.getLevel();
+        BlockPos blockposition = blockEntity.getBlockPos();
+
+        return world == null ? false : (world.getBlockEntity(blockposition) != blockEntity ? false : player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= (double) (maxDistance * maxDistance));
     }
+
+    // CraftBukkit start
+    java.util.List<ItemStack> getContents();
+
+    void onOpen(CraftHumanEntity who);
+
+    void onClose(CraftHumanEntity who);
+
+    java.util.List<org.bukkit.entity.HumanEntity> getViewers();
+
+    org.bukkit.inventory.InventoryHolder getOwner();
+
+    void setMaxStackSize(int size);
+
+    org.bukkit.Location getLocation();
+
+    default RecipeHolder<?> getCurrentRecipe() {
+        return null;
+    }
+
+    default void setCurrentRecipe(RecipeHolder<?> recipe) {
+    }
+
+    int MAX_STACK = 64;
+    // CraftBukkit end
 }