|
22 | 22 | import gregtech.api.render.Textures; |
23 | 23 | import gregtech.api.util.GTFluidUtils; |
24 | 24 | import gregtech.api.util.GTUtility; |
25 | | -import gregtech.api.util.InventoryUtils; |
26 | 25 | import net.minecraft.block.Block; |
27 | 26 | import net.minecraft.block.state.BlockFaceShape; |
28 | 27 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; |
|
57 | 56 | import java.util.List; |
58 | 57 | import java.util.function.Consumer; |
59 | 58 |
|
| 59 | +import static gregtech.api.util.InventoryUtils.simulateItemStackMerge; |
| 60 | + |
60 | 61 | public abstract class MetaTileEntity implements ICoverable { |
61 | 62 |
|
62 | 63 | public static final int DEFAULT_PAINTING_COLOR = 0xFFFFFF; |
@@ -990,14 +991,8 @@ public static boolean addItemsToItemHandler(final IItemHandler handler, |
990 | 991 | final boolean simulate, |
991 | 992 | final List<ItemStack> items) { |
992 | 993 | // determine if there is sufficient room to insert all items into the target inventory |
993 | | - boolean canMerge; |
994 | | - if (items.size() == 1) { |
995 | | - canMerge = ItemHandlerHelper.insertItemStacked(handler, items.get(0), true).isEmpty(); |
996 | | - } else { |
997 | | - // merging 2 or more stacks may change the slots available for merging, |
998 | | - // needing full simulation of the state of the inventory after every merge |
999 | | - canMerge = InventoryUtils.simulateItemStackMerge(items, handler); |
1000 | | - } |
| 994 | + final boolean canMerge = simulateItemStackMerge(items, handler); |
| 995 | + |
1001 | 996 | // if we're not simulating and the merge should succeed, perform the merge. |
1002 | 997 | if (!simulate && canMerge) |
1003 | 998 | items.forEach(stack -> { |
|
0 commit comments