mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-29 11:59:17 +00:00
Allow SimpleContainer and ContainerEntity use num key to store OCE
This commit is contained in:
@@ -4,6 +4,39 @@ Date: Wed, 26 Jun 2024 17:59:56 +0800
|
||||
Subject: [PATCH] Allow grindstone overstacking
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/SimpleContainer.java b/net/minecraft/world/SimpleContainer.java
|
||||
index 75170c8d3be477a6ea2a1d62018a6ab630b0e54e..c449846f8ec41bc20e9df3c00ef0bf769f5c98d9 100644
|
||||
--- a/net/minecraft/world/SimpleContainer.java
|
||||
+++ b/net/minecraft/world/SimpleContainer.java
|
||||
@@ -211,6 +211,12 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
||||
@Override
|
||||
public void setItem(int index, ItemStack stack) {
|
||||
this.items.set(index, stack);
|
||||
+ // Leaves end - grindstone overstacking
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.allowGrindstoneOverstacking) {
|
||||
+ this.setChanged();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaves end - grindstone overstacking
|
||||
stack.limitSize(this.getMaxStackLeaves(stack)); // Leaves - item over-stack util
|
||||
this.setChanged();
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/vehicle/ContainerEntity.java b/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
index 99f109e2653eff10c011f380694bd77a76381cee..074e8fa037739f3a7720970d3c6a3980bfb48365 100644
|
||||
--- a/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
@@ -163,6 +163,11 @@ public interface ContainerEntity extends Container, MenuProvider {
|
||||
default void setChestVehicleItem(int slot, ItemStack stack) {
|
||||
this.unpackChestVehicleLootTable(null);
|
||||
this.getItemStacks().set(slot, stack);
|
||||
+ // Leaves end - grindstone overstacking
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.allowGrindstoneOverstacking) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaves end - grindstone overstacking
|
||||
stack.limitSize(this.getMaxStackLeaves(stack)); // Leaves - item over-stack util
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 49abae7db7d7a9ee967ea24b7503e1e9489d4005..0136f1286e81b4ef1efd8ed83bffc3a936619eee 100644
|
||||
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -96,3 +129,19 @@ index 63d6a43dab067aa4c8fb67095c455130196eef9f..4d3608c0f463c0fb8634c4b9ce5fb597
|
||||
stack.limitSize(this.getMaxStackLeaves(stack)); // Leaves - item over-stack util
|
||||
this.setChanged();
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 1a4326df24188918542349ba7c812578e78723ee..f05b32ef0d5d71ab35c7f2f7750b8da2c0060123 100644
|
||||
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -113,6 +113,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
public void setItem(int index, ItemStack stack) {
|
||||
this.unpackLootTable(null);
|
||||
this.getItems().set(index, stack);
|
||||
+ // Leaves end - grindstone overstacking
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.allowGrindstoneOverstacking) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaves end - grindstone overstacking
|
||||
stack.limitSize(this.getMaxStackLeaves(stack)); // Leaves - item over-stack util
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user