|
2104 | 2104 | + ItemStack cursor = this.player.containerMenu.getCarried();
|
2105 | 2105 | + if (clickedItem.isEmpty()) {
|
2106 | 2106 | + if (!cursor.isEmpty()) {
|
2107 |
| -+ if (cursor.getItem() instanceof net.minecraft.world.item.BundleItem && packet.getButtonNum() != 0) { |
| 2107 | ++ if (cursor.getItem() instanceof net.minecraft.world.item.BundleItem && cursor.has(DataComponents.BUNDLE_CONTENTS) && packet.getButtonNum() != 0) { |
2108 | 2108 | + action = cursor.get(DataComponents.BUNDLE_CONTENTS).isEmpty() ? InventoryAction.NOTHING : InventoryAction.PLACE_FROM_BUNDLE;
|
2109 | 2109 | + } else {
|
2110 | 2110 | + action = packet.getButtonNum() == 0 ? InventoryAction.PLACE_ALL : InventoryAction.PLACE_ONE;
|
2111 | 2111 | + }
|
2112 | 2112 | + }
|
2113 | 2113 | + } else if (slot.mayPickup(this.player)) {
|
2114 | 2114 | + if (cursor.isEmpty()) {
|
2115 |
| -+ if (slot.getItem().getItem() instanceof net.minecraft.world.item.BundleItem && packet.getButtonNum() != 0) { |
| 2115 | ++ if (slot.getItem().getItem() instanceof net.minecraft.world.item.BundleItem && slot.getItem().has(DataComponents.BUNDLE_CONTENTS) && packet.getButtonNum() != 0) { |
2116 | 2116 | + action = slot.getItem().get(DataComponents.BUNDLE_CONTENTS).isEmpty() ? InventoryAction.NOTHING : InventoryAction.PICKUP_FROM_BUNDLE;
|
2117 | 2117 | + } else {
|
2118 | 2118 | + action = packet.getButtonNum() == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF;
|
|
2132 | 2132 | + action = InventoryAction.PLACE_SOME;
|
2133 | 2133 | + }
|
2134 | 2134 | + } else if (cursor.getCount() <= slot.getMaxStackSize()) {
|
2135 |
| -+ if (cursor.getItem() instanceof net.minecraft.world.item.BundleItem && packet.getButtonNum() == 0) { |
| 2135 | ++ if (cursor.getItem() instanceof net.minecraft.world.item.BundleItem && cursor.has(DataComponents.BUNDLE_CONTENTS) && packet.getButtonNum() == 0) { |
2136 | 2136 | + int toPickup = cursor.get(DataComponents.BUNDLE_CONTENTS).getMaxAmountToAdd(slot.getItem());
|
2137 | 2137 | + if (toPickup >= slot.getItem().getCount()) {
|
2138 | 2138 | + action = InventoryAction.PICKUP_ALL_INTO_BUNDLE;
|
|
2141 | 2141 | + } else {
|
2142 | 2142 | + action = InventoryAction.PICKUP_SOME_INTO_BUNDLE;
|
2143 | 2143 | + }
|
2144 |
| -+ } else if (slot.getItem().getItem() instanceof net.minecraft.world.item.BundleItem && packet.getButtonNum() == 0) { |
| 2144 | ++ } else if (slot.getItem().getItem() instanceof net.minecraft.world.item.BundleItem && slot.getItem().has(DataComponents.BUNDLE_CONTENTS) && packet.getButtonNum() == 0) { |
2145 | 2145 | + int toPickup = slot.getItem().get(DataComponents.BUNDLE_CONTENTS).getMaxAmountToAdd(cursor);
|
2146 | 2146 | + if (toPickup >= cursor.getCount()) {
|
2147 | 2147 | + action = InventoryAction.PLACE_ALL_INTO_BUNDLE;
|
|
0 commit comments