|
|
|
@@ -5,37 +5,70 @@ Subject: [PATCH] Stackable ShulkerBoxes
|
|
|
|
|
|
|
|
|
|
|
|
This patch is Powered by fabric-carpet(https://github.com/gnembon/fabric-carpet) and plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
|
|
|
This patch is Powered by fabric-carpet(https://github.com/gnembon/fabric-carpet) and plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
|
|
diff --git a/net/minecraft/commands/arguments/item/ItemInput.java b/net/minecraft/commands/arguments/item/ItemInput.java
|
|
|
|
index 828fbe03e7beb860cd0816c7ac8adbffe196533b..513988c37de927ddf48f2bc9cf6905c70c41e75d 100644
|
|
|
|
index 643797124fe5a4489d0b7419b7e600c04f283ef2..44c10be00cc4265ea6688f9a1093ee7c9f6f50f1 100644
|
|
|
|
--- a/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
|
|
--- a/net/minecraft/commands/arguments/item/ItemInput.java
|
|
|
|
+++ b/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
|
|
+++ b/net/minecraft/commands/arguments/item/ItemInput.java
|
|
|
|
@@ -23,7 +23,7 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa
|
|
|
|
@@ -39,11 +39,13 @@ public class ItemInput {
|
|
|
|
this.items = NonNullList.withSize(items.size(), ItemStack.EMPTY);
|
|
|
|
public ItemStack createItemStack(int count, boolean allowOversizedStacks) throws CommandSyntaxException {
|
|
|
|
|
|
|
|
ItemStack itemStack = new ItemStack(this.item, count);
|
|
|
|
for (int i = 0; i < items.size(); i++) {
|
|
|
|
itemStack.applyComponents(this.components);
|
|
|
|
- this.items.set(i, items.get(i).copy());
|
|
|
|
- if (allowOversizedStacks && count > itemStack.getMaxStackSize()) {
|
|
|
|
+ this.items.set(i, org.leavesmc.leaves.util.ShulkerBoxUtils.correctItemStackMaxStackSize(items.get(i).copy())); // Leaves - stackable shulker boxes
|
|
|
|
- throw ERROR_STACK_TOO_BIG.create(this.getItemName(), itemStack.getMaxStackSize());
|
|
|
|
|
|
|
|
+ // Leaves start - stackable shulker boxes
|
|
|
|
|
|
|
|
+ if (allowOversizedStacks && count > org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemStack)) {
|
|
|
|
|
|
|
|
+ throw ERROR_STACK_TOO_BIG.create(this.getItemName(), org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemStack));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return itemStack;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Leaves end - stackable shulker boxes
|
|
|
|
this.carriedItem = carriedItem.copy();
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java b/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
|
|
|
|
|
|
|
index c1130f596cf3443eeb62eb1b12587172fe0859ee..ad51ad9f104f8f7238298b025e2d7485aa88a253 100644
|
|
|
|
|
|
|
|
--- a/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
|
|
|
|
|
|
|
+++ b/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
|
|
|
|
|
|
|
@@ -19,7 +19,7 @@ public class ClientboundContainerSetSlotPacket implements Packet<ClientGamePacke
|
|
|
|
|
|
|
|
this.containerId = containerId;
|
|
|
|
|
|
|
|
this.stateId = stateId;
|
|
|
|
|
|
|
|
this.slot = slot;
|
|
|
|
|
|
|
|
- this.itemStack = itemStack.copy();
|
|
|
|
|
|
|
|
+ this.itemStack = org.leavesmc.leaves.util.ShulkerBoxUtils.correctItemStackMaxStackSize(itemStack.copy()); // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ClientboundContainerSetSlotPacket(RegistryFriendlyByteBuf buffer) {
|
|
|
|
public String serialize(HolderLookup.Provider levelRegistry) {
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/server/commands/GiveCommand.java b/net/minecraft/server/commands/GiveCommand.java
|
|
|
|
|
|
|
|
index 8b7af734ca4ed3cafa810460b2cea6c1e6342a69..10d20e945a8f9e676137e752e357ad71b2ab1122 100644
|
|
|
|
|
|
|
|
--- a/net/minecraft/server/commands/GiveCommand.java
|
|
|
|
|
|
|
|
+++ b/net/minecraft/server/commands/GiveCommand.java
|
|
|
|
|
|
|
|
@@ -52,7 +52,7 @@ public class GiveCommand {
|
|
|
|
|
|
|
|
private static int giveItem(CommandSourceStack source, ItemInput item, Collection<ServerPlayer> targets, int count) throws CommandSyntaxException {
|
|
|
|
|
|
|
|
ItemStack itemStack = item.createItemStack(1, false);
|
|
|
|
|
|
|
|
final Component displayName = itemStack.getDisplayName(); // Paper - get display name early
|
|
|
|
|
|
|
|
- int maxStackSize = itemStack.getMaxStackSize();
|
|
|
|
|
|
|
|
+ int maxStackSize = org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemStack); // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
int i = maxStackSize * 100;
|
|
|
|
|
|
|
|
if (count > i) {
|
|
|
|
|
|
|
|
source.sendFailure(Component.translatable("commands.give.failed.toomanyitems", i, itemStack.getDisplayName()));
|
|
|
|
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
index 876d207996724727ca26b139af759eab2e6f4131..7ad093e90299b9d3d6667e7425ac1bf13c61e1a5 100644
|
|
|
|
index 876d207996724727ca26b139af759eab2e6f4131..c1d55857e4238e78703eebf62af8bf59c660e9ea 100644
|
|
|
|
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
@@ -3395,7 +3395,7 @@ public class ServerGamePacketListenerImpl
|
|
|
|
@@ -2987,7 +2987,7 @@ public class ServerGamePacketListenerImpl
|
|
|
|
|
|
|
|
} else if (slot.mayPlace(cursor)) {
|
|
|
|
|
|
|
|
if (ItemStack.isSameItemSameComponents(clickedItem, cursor)) {
|
|
|
|
|
|
|
|
int toPlace = packet.getButtonNum() == 0 ? cursor.getCount() : 1;
|
|
|
|
|
|
|
|
- toPlace = Math.min(toPlace, clickedItem.getMaxStackSize() - clickedItem.getCount());
|
|
|
|
|
|
|
|
+ toPlace = Math.min(toPlace, org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(clickedItem) - clickedItem.getCount()); // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
toPlace = Math.min(toPlace, slot.container.getMaxStackSize() - clickedItem.getCount());
|
|
|
|
|
|
|
|
if (toPlace == 1) {
|
|
|
|
|
|
|
|
action = InventoryAction.PLACE_ONE;
|
|
|
|
|
|
|
|
@@ -3023,7 +3023,7 @@ public class ServerGamePacketListenerImpl
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (ItemStack.isSameItemSameComponents(cursor, clickedItem)) {
|
|
|
|
|
|
|
|
if (clickedItem.getCount() >= 0) {
|
|
|
|
|
|
|
|
- if (clickedItem.getCount() + cursor.getCount() <= cursor.getMaxStackSize()) {
|
|
|
|
|
|
|
|
+ if (clickedItem.getCount() + cursor.getCount() <= org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(cursor)) { // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
// As of 1.5, this is result slots only
|
|
|
|
|
|
|
|
action = InventoryAction.PICKUP_ALL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3283,6 +3283,7 @@ public class ServerGamePacketListenerImpl
|
|
|
|
|
|
|
|
this.player.containerMenu.broadcastFullState();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.player.containerMenu.broadcastChanges();
|
|
|
|
|
|
|
|
+ this.player.containerMenu.broadcastCarriedItem(); // Leaves - stackable shulker boxes - force send carried item
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.updateEquipmentOnPlayerActions) this.player.detectEquipmentUpdatesPublic(); // Paper - Force update attributes.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3395,7 +3396,7 @@ public class ServerGamePacketListenerImpl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
boolean flag1 = packet.slotNum() >= 1 && packet.slotNum() <= 45;
|
|
|
|
boolean flag1 = packet.slotNum() >= 1 && packet.slotNum() <= 45;
|
|
|
|
@@ -62,7 +95,7 @@ index 2d3721e311851c1801b090e99d4f9d0daf4e5f99..f779d27603e6d81435c061214a2db3a1
|
|
|
|
|
|
|
|
|
|
|
|
boolean stillValid(Player player);
|
|
|
|
boolean stillValid(Player player);
|
|
|
|
diff --git a/net/minecraft/world/SimpleContainer.java b/net/minecraft/world/SimpleContainer.java
|
|
|
|
diff --git a/net/minecraft/world/SimpleContainer.java b/net/minecraft/world/SimpleContainer.java
|
|
|
|
index 190190463086f2fcbe28f00fa2f23795bf11f279..6ee5ecc89e360ca30ed5f7f355ae943c5a6337ca 100644
|
|
|
|
index 190190463086f2fcbe28f00fa2f23795bf11f279..f6ec7accba090aac87eeefba333440ceaf7e7c20 100644
|
|
|
|
--- a/net/minecraft/world/SimpleContainer.java
|
|
|
|
--- a/net/minecraft/world/SimpleContainer.java
|
|
|
|
+++ b/net/minecraft/world/SimpleContainer.java
|
|
|
|
+++ b/net/minecraft/world/SimpleContainer.java
|
|
|
|
@@ -205,7 +205,7 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
|
|
|
@@ -205,7 +205,7 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
|
|
|
@@ -70,7 +103,7 @@ index 190190463086f2fcbe28f00fa2f23795bf11f279..6ee5ecc89e360ca30ed5f7f355ae943c
|
|
|
|
public void setItem(int index, ItemStack stack) {
|
|
|
|
public void setItem(int index, ItemStack stack) {
|
|
|
|
this.items.set(index, stack);
|
|
|
|
this.items.set(index, stack);
|
|
|
|
- stack.limitSize(this.getMaxStackSize(stack));
|
|
|
|
- stack.limitSize(this.getMaxStackSize(stack));
|
|
|
|
+ stack.limitSize(this.getMaxStackLeaves(stack));
|
|
|
|
+ stack.limitSize(this.getMaxStackLeaves(stack)); // Leaves - stackable shulker boxes
|
|
|
|
this.setChanged();
|
|
|
|
this.setChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -196,6 +229,19 @@ index 839cbb67d3d38960d9114a4db5bab911b66a573c..9b628d553d3206a4881ed5e07fa6d255
|
|
|
|
if (this.add(slotWithRemainingSpace, stack.split(i)) && sendPacket && this.player instanceof ServerPlayer serverPlayer) {
|
|
|
|
if (this.add(slotWithRemainingSpace, stack.split(i)) && sendPacket && this.player instanceof ServerPlayer serverPlayer) {
|
|
|
|
serverPlayer.connection.send(this.createInventoryUpdatePacket(slotWithRemainingSpace));
|
|
|
|
serverPlayer.connection.send(this.createInventoryUpdatePacket(slotWithRemainingSpace));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/player/StackedItemContents.java b/net/minecraft/world/entity/player/StackedItemContents.java
|
|
|
|
|
|
|
|
index 83ccde54c625d40dc595e000c533f60aa929bd5a..1b92676459468d42931b84e5ceb19e8d30302f06 100644
|
|
|
|
|
|
|
|
--- a/net/minecraft/world/entity/player/StackedItemContents.java
|
|
|
|
|
|
|
|
+++ b/net/minecraft/world/entity/player/StackedItemContents.java
|
|
|
|
|
|
|
|
@@ -23,7 +23,7 @@ public class StackedItemContents {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void accountStack(ItemStack stack) {
|
|
|
|
|
|
|
|
- this.accountStack(stack, stack.getMaxStackSize());
|
|
|
|
|
|
|
|
+ this.accountStack(stack, org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(stack)); // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void accountStack(ItemStack stack, int maxStackSize) {
|
|
|
|
diff --git a/net/minecraft/world/entity/vehicle/ContainerEntity.java b/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
|
|
|
diff --git a/net/minecraft/world/entity/vehicle/ContainerEntity.java b/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
|
|
|
index c18aea2bb5ddddadbc858b253ff4c08d82178a18..6a24b442a21298ef3bdbcb76de9bdcf006890c5d 100644
|
|
|
|
index c18aea2bb5ddddadbc858b253ff4c08d82178a18..6a24b442a21298ef3bdbcb76de9bdcf006890c5d 100644
|
|
|
|
--- a/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
|
|
|
--- a/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
|
|
|
@@ -210,7 +256,7 @@ index c18aea2bb5ddddadbc858b253ff4c08d82178a18..6a24b442a21298ef3bdbcb76de9bdcf0
|
|
|
|
|
|
|
|
|
|
|
|
default SlotAccess getChestVehicleSlot(final int index) {
|
|
|
|
default SlotAccess getChestVehicleSlot(final int index) {
|
|
|
|
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
|
|
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
|
|
index b4721c4e81cc2ae989765d86bd51ebf0be41758c..f5a6d01037235b120e13cde9134e5ac0fc2d2c00 100644
|
|
|
|
index b4721c4e81cc2ae989765d86bd51ebf0be41758c..d03348c8139c398b65a2f4e4f960832c797e0443 100644
|
|
|
|
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
|
|
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
|
|
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
|
|
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
|
|
@@ -427,7 +427,7 @@ public abstract class AbstractContainerMenu {
|
|
|
|
@@ -427,7 +427,7 @@ public abstract class AbstractContainerMenu {
|
|
|
|
@@ -268,6 +314,33 @@ index b4721c4e81cc2ae989765d86bd51ebf0be41758c..f5a6d01037235b120e13cde9134e5ac0
|
|
|
|
while (!stack.isEmpty() && (reverseDirection ? i >= startIndex : i < endIndex)) {
|
|
|
|
while (!stack.isEmpty() && (reverseDirection ? i >= startIndex : i < endIndex)) {
|
|
|
|
Slot slot = this.slots.get(i);
|
|
|
|
Slot slot = this.slots.get(i);
|
|
|
|
ItemStack item = slot.getItem();
|
|
|
|
ItemStack item = slot.getItem();
|
|
|
|
|
|
|
|
@@ -861,7 +861,7 @@ public abstract class AbstractContainerMenu {
|
|
|
|
|
|
|
|
public static boolean canItemQuickReplace(@Nullable Slot slot, ItemStack stack, boolean stackSizeMatters) {
|
|
|
|
|
|
|
|
boolean flag = slot == null || !slot.hasItem();
|
|
|
|
|
|
|
|
return !flag && ItemStack.isSameItemSameComponents(stack, slot.getItem())
|
|
|
|
|
|
|
|
- ? slot.getItem().getCount() + (stackSizeMatters ? 0 : stack.getCount()) <= stack.getMaxStackSize()
|
|
|
|
|
|
|
|
+ ? slot.getItem().getCount() + (stackSizeMatters ? 0 : stack.getCount()) <= org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(stack) // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
: flag;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -869,7 +869,7 @@ public abstract class AbstractContainerMenu {
|
|
|
|
|
|
|
|
return switch (type) {
|
|
|
|
|
|
|
|
case 0 -> Mth.floor((float)stack.getCount() / slots.size());
|
|
|
|
|
|
|
|
case 1 -> 1;
|
|
|
|
|
|
|
|
- case 2 -> stack.getMaxStackSize();
|
|
|
|
|
|
|
|
+ case 2 -> org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(stack); // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
default -> stack.getCount();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -891,7 +891,7 @@ public abstract class AbstractContainerMenu {
|
|
|
|
|
|
|
|
for (int i = 0; i < container.getContainerSize(); i++) {
|
|
|
|
|
|
|
|
ItemStack item = container.getItem(i);
|
|
|
|
|
|
|
|
if (!item.isEmpty()) {
|
|
|
|
|
|
|
|
- f += (float)item.getCount() / container.getMaxStackSize(item);
|
|
|
|
|
|
|
|
+ f += (float)item.getCount() / container.getMaxStackLeaves(item); // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/world/inventory/MerchantContainer.java b/net/minecraft/world/inventory/MerchantContainer.java
|
|
|
|
diff --git a/net/minecraft/world/inventory/MerchantContainer.java b/net/minecraft/world/inventory/MerchantContainer.java
|
|
|
|
index a1576c3be00bdb19d02d52658c4b1818ea5c32db..be2f047bf1daab82473105865cd95955d4661a2a 100644
|
|
|
|
index a1576c3be00bdb19d02d52658c4b1818ea5c32db..be2f047bf1daab82473105865cd95955d4661a2a 100644
|
|
|
|
--- a/net/minecraft/world/inventory/MerchantContainer.java
|
|
|
|
--- a/net/minecraft/world/inventory/MerchantContainer.java
|
|
|
|
@@ -295,10 +368,34 @@ index 5ceb8964476b40db4511bec91ff13c4f522a1357..371bad86218971d6e031c6d74307b2ab
|
|
|
|
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
|
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
|
|
|
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
|
|
|
index 76f50437396f8f856381d0fbef52953ef7c263f6..6bc431cd0724de406c92830d618c26d69bcd1918 100644
|
|
|
|
index 76f50437396f8f856381d0fbef52953ef7c263f6..889a947cec81683cb7caa447dbf28b701fb38d0b 100644
|
|
|
|
--- a/net/minecraft/world/item/ItemStack.java
|
|
|
|
--- a/net/minecraft/world/item/ItemStack.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemStack.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemStack.java
|
|
|
|
@@ -199,7 +199,7 @@ public final class ItemStack implements DataComponentHolder {
|
|
|
|
@@ -151,16 +151,19 @@ public final class ItemStack implements DataComponentHolder {
|
|
|
|
|
|
|
|
if (value.isEmpty() || value.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
|
|
|
|
|
|
|
|
buffer.writeVarInt(0);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
- buffer.writeVarInt(io.papermc.paper.util.ItemComponentSanitizer.sanitizeCount(io.papermc.paper.util.ItemObfuscationSession.currentSession(), value, value.getCount())); // Paper - potentially sanitize count
|
|
|
|
|
|
|
|
- ITEM_STREAM_CODEC.encode(buffer, value.getItemHolder());
|
|
|
|
|
|
|
|
+ // Leaves start - stackable shulker boxes
|
|
|
|
|
|
|
|
+ final ItemStack itemStack = org.leavesmc.leaves.util.ShulkerBoxUtils.correctItemStackMaxStackSize(value.copy());
|
|
|
|
|
|
|
|
+ buffer.writeVarInt(io.papermc.paper.util.ItemComponentSanitizer.sanitizeCount(io.papermc.paper.util.ItemObfuscationSession.currentSession(), itemStack, itemStack.getCount())); // Paper - potentially sanitize count
|
|
|
|
|
|
|
|
+ ITEM_STREAM_CODEC.encode(buffer, itemStack.getItemHolder());
|
|
|
|
|
|
|
|
// Spigot start - filter
|
|
|
|
|
|
|
|
// value = value.copy();
|
|
|
|
|
|
|
|
// CraftItemStack.setItemMeta(value, CraftItemStack.getItemMeta(value)); // Paper - This is no longer with raw NBT being handled in metadata
|
|
|
|
|
|
|
|
// Paper start - adventure; conditionally render translatable components
|
|
|
|
|
|
|
|
boolean prev = net.minecraft.network.chat.ComponentSerialization.DONT_RENDER_TRANSLATABLES.get();
|
|
|
|
|
|
|
|
- try (final io.papermc.paper.util.SafeAutoClosable ignored = io.papermc.paper.util.ItemObfuscationSession.withContext(c -> c.itemStack(value))) { // pass the itemstack as context to the obfuscation session
|
|
|
|
|
|
|
|
+ try (final io.papermc.paper.util.SafeAutoClosable ignored = io.papermc.paper.util.ItemObfuscationSession.withContext(c -> c.itemStack(itemStack))) { // pass the itemstack as context to the obfuscation session // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
net.minecraft.network.chat.ComponentSerialization.DONT_RENDER_TRANSLATABLES.set(true);
|
|
|
|
|
|
|
|
- DataComponentPatch.STREAM_CODEC.encode(buffer, value.components.asPatch());
|
|
|
|
|
|
|
|
+ DataComponentPatch.STREAM_CODEC.encode(buffer, itemStack.components.asPatch());
|
|
|
|
|
|
|
|
+ // Leaves end - stackable shulker boxes
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
net.minecraft.network.chat.ComponentSerialization.DONT_RENDER_TRANSLATABLES.set(prev);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -199,7 +202,7 @@ public final class ItemStack implements DataComponentHolder {
|
|
|
|
@Deprecated
|
|
|
|
@Deprecated
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
|
private Item item;
|
|
|
|
private Item item;
|
|
|
|
@@ -307,6 +404,15 @@ index 76f50437396f8f856381d0fbef52953ef7c263f6..6bc431cd0724de406c92830d618c26d6
|
|
|
|
@Nullable
|
|
|
|
@Nullable
|
|
|
|
private Entity entityRepresentation;
|
|
|
|
private Entity entityRepresentation;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -299,7 +302,7 @@ public final class ItemStack implements DataComponentHolder {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (ItemStack itemStack : itemContainerContents.nonEmptyItems()) {
|
|
|
|
|
|
|
|
int count = itemStack.getCount();
|
|
|
|
|
|
|
|
- int maxStackSize = itemStack.getMaxStackSize();
|
|
|
|
|
|
|
|
+ int maxStackSize = org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemStack); // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
if (count > maxStackSize) {
|
|
|
|
|
|
|
|
return DataResult.error(() -> "Item stack with count of " + count + " was larger than maximum: " + maxStackSize);
|
|
|
|
|
|
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/level/block/AbstractCauldronBlock.java b/net/minecraft/world/level/block/AbstractCauldronBlock.java
|
|
|
|
diff --git a/net/minecraft/world/level/block/AbstractCauldronBlock.java b/net/minecraft/world/level/block/AbstractCauldronBlock.java
|
|
|
|
index 648d22cdfcf261494038d589f5a5e32704083076..47e480515715376f568b7cb7468edf2bff3d4307 100644
|
|
|
|
index 648d22cdfcf261494038d589f5a5e32704083076..47e480515715376f568b7cb7468edf2bff3d4307 100644
|
|
|
|
--- a/net/minecraft/world/level/block/AbstractCauldronBlock.java
|
|
|
|
--- a/net/minecraft/world/level/block/AbstractCauldronBlock.java
|
|
|
|
@@ -340,6 +446,19 @@ index 648d22cdfcf261494038d589f5a5e32704083076..47e480515715376f568b7cb7468edf2b
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
|
|
|
|
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
|
|
|
|
return SHAPE;
|
|
|
|
return SHAPE;
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/world/level/block/CrafterBlock.java b/net/minecraft/world/level/block/CrafterBlock.java
|
|
|
|
|
|
|
|
index 5f5966278faf86ed9b28955c80ba845c0cb75595..dcc503b3dca65ec2a72f6f3dc29589c6c295b181 100644
|
|
|
|
|
|
|
|
--- a/net/minecraft/world/level/block/CrafterBlock.java
|
|
|
|
|
|
|
|
+++ b/net/minecraft/world/level/block/CrafterBlock.java
|
|
|
|
|
|
|
|
@@ -200,7 +200,7 @@ public class CrafterBlock extends BaseEntityBlock {
|
|
|
|
|
|
|
|
Direction direction = state.getValue(ORIENTATION).front();
|
|
|
|
|
|
|
|
Container containerAt = HopperBlockEntity.getContainerAt(level, pos.relative(direction));
|
|
|
|
|
|
|
|
ItemStack itemStack = stack.copy();
|
|
|
|
|
|
|
|
- if (containerAt != null && (containerAt instanceof CrafterBlockEntity || stack.getCount() > containerAt.getMaxStackSize(stack))) {
|
|
|
|
|
|
|
|
+ if (containerAt != null && (containerAt instanceof CrafterBlockEntity || stack.getCount() > containerAt.getMaxStackLeaves(stack))) { // Leaves - stackable shulker boxes
|
|
|
|
|
|
|
|
// CraftBukkit start - InventoryMoveItemEvent
|
|
|
|
|
|
|
|
org.bukkit.craftbukkit.inventory.CraftItemStack oitemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack);
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
|
|
diff --git a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
|
|
index 77e7188180cce9ef881de64b263c704b219b610a..2f5fa4310f475ecbb29e69c0461c7d3276f8536d 100644
|
|
|
|
index 77e7188180cce9ef881de64b263c704b219b610a..2f5fa4310f475ecbb29e69c0461c7d3276f8536d 100644
|
|
|
|
--- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
|
|
--- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
|
|
@@ -377,7 +496,7 @@ index 42a29e700d2549de7cd905c373212e9757bcfcf1..3122753c96e98e57fa900cd15005ab48
|
|
|
|
- stack.limitSize(this.getMaxStackSize(stack));
|
|
|
|
- stack.limitSize(this.getMaxStackSize(stack));
|
|
|
|
+ stack.limitSize(this.getMaxStackLeaves(stack)); // Leaves - stackable shulker boxes
|
|
|
|
+ stack.limitSize(this.getMaxStackLeaves(stack)); // Leaves - stackable shulker boxes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@@ -688,9 +688,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
@@ -688,9 +688,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
if (item.isEmpty()) {
|
|
|
|
if (item.isEmpty()) {
|
|
|
|
|