mirror of
https://github.com/LeavesMC/Leaves.git
synced 2026-01-06 15:51:33 +00:00
Start 1.20
This commit is contained in:
@@ -6,7 +6,7 @@ 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)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index d47b3ac633e7936d30abfda6fc46c2c7412d76fe..0aac54b25a0d42dc8eac1618d57c678a34f8da1d 100644
|
||||
index 3d41dbe0285f8fec8adae1e93010cf464df9b08c..7f5c131b16152c7817b0a29064dacdf405f6e6e5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -15,10 +15,12 @@ import net.minecraft.world.entity.EntityType;
|
||||
@@ -44,7 +44,7 @@ index d47b3ac633e7936d30abfda6fc46c2c7412d76fe..0aac54b25a0d42dc8eac1618d57c678a
|
||||
}
|
||||
|
||||
public ItemEntity(Level world, double x, double y, double z, ItemStack stack, double velocityX, double velocityY, double velocityZ) {
|
||||
@@ -283,10 +293,49 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -288,10 +298,49 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
private boolean isMergable() {
|
||||
ItemStack itemstack = this.getItem();
|
||||
|
||||
@@ -96,7 +96,7 @@ index d47b3ac633e7936d30abfda6fc46c2c7412d76fe..0aac54b25a0d42dc8eac1618d57c678a
|
||||
ItemStack itemstack1 = other.getItem();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
index 4a89ce4fbd8b19ce1cff5905d779d2e4c63e89c4..6a26f3f9ad821688564380f1a9d3a086531364b9 100644
|
||||
index fee876947e0c00f3e0d0914cf84b5969cc788696..625110623fc28f70c0076295e5f8c6d42db24322 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -114,7 +114,7 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -122,7 +122,7 @@ index 4a89ce4fbd8b19ce1cff5905d779d2e4c63e89c4..6a26f3f9ad821688564380f1a9d3a086
|
||||
|
||||
if (k > this.getMaxStackSize() - itemstack1.getCount()) {
|
||||
k = this.getMaxStackSize() - itemstack1.getCount();
|
||||
@@ -404,7 +406,7 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -403,7 +405,7 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
if (i != -1) {
|
||||
@@ -132,7 +132,7 @@ index 4a89ce4fbd8b19ce1cff5905d779d2e4c63e89c4..6a26f3f9ad821688564380f1a9d3a086
|
||||
if (this.add(i, stack.split(j)) && notifiesClient && this.player instanceof ServerPlayer) {
|
||||
((ServerPlayer) this.player).connection.send(new ClientboundContainerSetSlotPacket(-2, 0, i, this.getItem(i)));
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 4b0bdf8705eadd2ca6c0fd5a3494fd8742330ef6..2d9f35622be9a9e5f0cce8d18e6e5bb7bed1ab5c 100644
|
||||
index f13f21dbd50f63a71276837abbcf82e0a72ff52c..4ab69a9962bf7642446d952bc6c70c92d716311b 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -30,8 +30,10 @@ import net.minecraft.world.entity.SlotAccess;
|
||||
@@ -146,52 +146,52 @@ index 4b0bdf8705eadd2ca6c0fd5a3494fd8742330ef6..2d9f35622be9a9e5f0cce8d18e6e5bb7
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -453,7 +455,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -455,7 +457,7 @@ public abstract class AbstractContainerMenu {
|
||||
|
||||
if (slot1 != null && AbstractContainerMenu.canItemQuickReplace(slot1, itemstack2, true) && slot1.mayPlace(itemstack2) && (this.quickcraftType == 2 || itemstack2.getCount() >= this.quickcraftSlots.size()) && this.canDragTo(slot1)) {
|
||||
int j1 = slot1.hasItem() ? slot1.getItem().getCount() : 0;
|
||||
- int k1 = Math.min(itemstack1.getMaxStackSize(), slot1.getMaxStackSize(itemstack1));
|
||||
+ int k1 = Math.min(top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack1), slot1.getMaxStackSize(itemstack1)); // Leaves - stackable shulker boxes int l1 = Math.min(AbstractContainerMenu.getQuickCraftPlaceCount(this.quickcraftSlots, this.quickcraftType, itemstack1) + j1, k1);
|
||||
int l1 = Math.min(AbstractContainerMenu.getQuickCraftPlaceCount(this.quickcraftSlots, this.quickcraftType, itemstack1) + j1, k1);
|
||||
|
||||
AbstractContainerMenu.getQuickCraftSlotCount(this.quickcraftSlots, this.quickcraftType, itemstack3, j1);
|
||||
- int k1 = Math.min(itemstack3.getMaxStackSize(), slot1.getMaxStackSize(itemstack3));
|
||||
+ int k1 = Math.min(top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack3), slot1.getMaxStackSize(itemstack3)); // Leaves - stackable shulker boxes
|
||||
|
||||
if (itemstack3.getCount() > k1) {
|
||||
itemstack3.setCount(k1);
|
||||
@@ -575,7 +577,7 @@ public abstract class AbstractContainerMenu {
|
||||
slot.setByPlayer(itemstack4);
|
||||
l -= l1 - j1;
|
||||
@@ -574,7 +576,7 @@ public abstract class AbstractContainerMenu {
|
||||
slot.setByPlayer(itemstack3);
|
||||
}
|
||||
} else if (ItemStack.isSameItemSameTags(itemstack, itemstack4)) {
|
||||
- Optional<ItemStack> optional1 = slot.tryRemove(itemstack.getCount(), itemstack4.getMaxStackSize() - itemstack4.getCount(), player);
|
||||
+ Optional<ItemStack> optional1 = slot.tryRemove(itemstack.getCount(), top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack4) - itemstack4.getCount(), player); // Leaves - stackable shulker boxes
|
||||
} else if (ItemStack.isSameItemSameTags(itemstack, itemstack3)) {
|
||||
- Optional<ItemStack> optional1 = slot.tryRemove(itemstack.getCount(), itemstack3.getMaxStackSize() - itemstack3.getCount(), player);
|
||||
+ Optional<ItemStack> optional1 = slot.tryRemove(itemstack.getCount(), top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack3) - itemstack3.getCount(), player);
|
||||
|
||||
optional1.ifPresent((itemstack5) -> {
|
||||
itemstack4.grow(itemstack5.getCount());
|
||||
@@ -641,7 +643,7 @@ public abstract class AbstractContainerMenu {
|
||||
optional1.ifPresent((itemstack4) -> {
|
||||
itemstack3.grow(itemstack4.getCount());
|
||||
@@ -640,7 +642,7 @@ public abstract class AbstractContainerMenu {
|
||||
slot2 = (Slot) this.slots.get(slotIndex);
|
||||
if (slot2.hasItem()) {
|
||||
itemstack1 = slot2.getItem().copy();
|
||||
- itemstack1.setCount(itemstack1.getMaxStackSize());
|
||||
+ itemstack1.setCount(top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack1)); // Leaves - stackable shulker boxes
|
||||
this.setCarried(itemstack1);
|
||||
itemstack1 = slot2.getItem();
|
||||
- this.setCarried(itemstack1.copyWithCount(itemstack1.getMaxStackSize()));
|
||||
+ this.setCarried(itemstack1.copyWithCount(top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack1))); // Leaves - stackable shulker boxes
|
||||
}
|
||||
} else if (actionType == ClickType.THROW && this.getCarried().isEmpty() && slotIndex >= 0) {
|
||||
@@ -657,14 +659,14 @@ public abstract class AbstractContainerMenu {
|
||||
i2 = button == 0 ? 1 : -1;
|
||||
slot2 = (Slot) this.slots.get(slotIndex);
|
||||
@@ -655,14 +657,14 @@ public abstract class AbstractContainerMenu {
|
||||
j2 = button == 0 ? 1 : -1;
|
||||
|
||||
for (l1 = 0; l1 < 2; ++l1) {
|
||||
- for (int j2 = l; j2 >= 0 && j2 < this.slots.size() && itemstack1.getCount() < itemstack1.getMaxStackSize(); j2 += i2) {
|
||||
+ for (int j2 = l; j2 >= 0 && j2 < this.slots.size() && itemstack1.getCount() < top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack1); j2 += i2) { // Leaves - stackable shulker boxes
|
||||
Slot slot3 = (Slot) this.slots.get(j2);
|
||||
for (i2 = 0; i2 < 2; ++i2) {
|
||||
- for (int k2 = l; k2 >= 0 && k2 < this.slots.size() && itemstack1.getCount() < itemstack1.getMaxStackSize(); k2 += j2) {
|
||||
+ for (int k2 = l; k2 >= 0 && k2 < this.slots.size() && itemstack1.getCount() < top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack1); k2 += j2) { // Leaves - stackable shulker boxes
|
||||
Slot slot3 = (Slot) this.slots.get(k2);
|
||||
|
||||
if (slot3.hasItem() && AbstractContainerMenu.canItemQuickReplace(slot3, itemstack1, true) && slot3.mayPickup(player) && this.canTakeItemForPickAll(itemstack1, slot3)) {
|
||||
ItemStack itemstack5 = slot3.getItem();
|
||||
ItemStack itemstack4 = slot3.getItem();
|
||||
|
||||
- if (l1 != 0 || itemstack5.getCount() != itemstack5.getMaxStackSize()) {
|
||||
- ItemStack itemstack6 = slot3.safeTake(itemstack5.getCount(), itemstack1.getMaxStackSize() - itemstack1.getCount(), player);
|
||||
+ if (l1 != 0 || itemstack5.getCount() != top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack5)) { // Leaves - stackable shulker boxes
|
||||
+ ItemStack itemstack6 = slot3.safeTake(itemstack5.getCount(), top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack5) - itemstack1.getCount(), player); // Leaves - stackable shulker boxes
|
||||
- if (i2 != 0 || itemstack4.getCount() != itemstack4.getMaxStackSize()) {
|
||||
- ItemStack itemstack5 = slot3.safeTake(itemstack4.getCount(), itemstack1.getMaxStackSize() - itemstack1.getCount(), player);
|
||||
+ if (i2 != 0 || itemstack4.getCount() != top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack4)) { // Leaves - stackable shulker boxes
|
||||
+ ItemStack itemstack5 = slot3.safeTake(itemstack4.getCount(), top.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(itemstack1) - itemstack1.getCount(), player); // Leaves - stackable shulker boxes
|
||||
|
||||
itemstack1.grow(itemstack6.getCount());
|
||||
itemstack1.grow(itemstack5.getCount());
|
||||
}
|
||||
@@ -801,7 +803,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -799,7 +801,7 @@ public abstract class AbstractContainerMenu {
|
||||
Slot slot;
|
||||
ItemStack itemstack1;
|
||||
|
||||
@@ -200,7 +200,7 @@ index 4b0bdf8705eadd2ca6c0fd5a3494fd8742330ef6..2d9f35622be9a9e5f0cce8d18e6e5bb7
|
||||
while (!stack.isEmpty()) {
|
||||
if (fromLast) {
|
||||
if (k < startIndex) {
|
||||
@@ -821,16 +823,18 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -819,16 +821,18 @@ public abstract class AbstractContainerMenu {
|
||||
if (!itemstack1.isEmpty() && ItemStack.isSameItemSameTags(stack, itemstack1)) {
|
||||
int l = itemstack1.getCount() + stack.getCount();
|
||||
|
||||
@@ -224,7 +224,7 @@ index 4b0bdf8705eadd2ca6c0fd5a3494fd8742330ef6..2d9f35622be9a9e5f0cce8d18e6e5bb7
|
||||
slot.setChanged();
|
||||
} // Paper
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/Slot.java b/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
index 75d71b0b8a1f5b0712b76e52c8afded103f16b7b..dff796f3db78c89c82ea845ebdceaffce07139c1 100644
|
||||
index 92699f79f19b4dcd7d349976cedc0408836263a6..6c979ee6c7a12111fe4380bbb0abc285dc7c264b 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
@@ -73,7 +73,7 @@ public class Slot {
|
||||
|
||||
Reference in New Issue
Block a user