aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/Container.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/Container.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/Container.java.patch119
1 files changed, 119 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/Container.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/Container.java.patch
new file mode 100644
index 0000000000..a1120efc62
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/Container.java.patch
@@ -0,0 +1,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
+ }