From ebf980b33c92893379bf3a9288874a56ac4bab30 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 21 Dec 2020 16:05:32 +0100 Subject: [PATCH] Itetraitor - Fixed crash for schematics containing TE's that have no custom renderer attached - Fixed broken filling recipes with virtual fluids of other mods - Fixed Brass tunnels duplicating/deleting items --- .../create/compat/jei/category/SpoutCategory.java | 2 ++ .../block/belts/tunnel/BrassTunnelTileEntity.java | 9 ++++++--- .../create/content/schematics/SchematicWorld.java | 7 +++++-- .../content/schematics/block/SchematicTableScreen.java | 2 +- .../content/schematics/client/SchematicRenderer.java | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java index b9f16dfdd..f5c109186 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/SpoutCategory.java @@ -76,6 +76,8 @@ public class SpoutCategory extends CreateRecipeCategory { ItemStack container = fhi.getContainer(); if (container.isItemEqual(copy)) return; + if (container.isEmpty()) + return; Ingredient bucket = Ingredient.fromStacks(stack); ResourceLocation itemName = stack.getItem() diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java index a78512586..e0ae67f56 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java @@ -205,7 +205,10 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity { indexStart = 0; ItemStack toDistribute = null; + int leftovers = 0; + for (boolean simulate : Iterate.trueAndFalse) { + leftovers = 0; int index = indexStart; int stackSize = stackToDistribute.getCount(); int splitStackSize = stackSize / amountTargets; @@ -226,13 +229,13 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity { ItemStack toOutput = ItemHandlerHelper.copyStackWithSize(toDistribute, count); ItemStack remainder = insertIntoTunnel(tunnel, side, toOutput, simulate); - if (remainder == null || !remainder.isEmpty()) { + if (remainder == null || remainder.getCount() == count) { if (force) return; - toDistribute = remainder; continue; } + leftovers += remainder.getCount(); toDistribute.shrink(count); if (toDistribute.isEmpty()) break; @@ -242,7 +245,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity { } } - stackToDistribute = toDistribute.copy(); + stackToDistribute = ItemHandlerHelper.copyStackWithSize(stackToDistribute, toDistribute.getCount() + leftovers); previousOutputIndex++; previousOutputIndex %= amountTargets; notifyUpdate(); diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java index 4a445a13f..b7855b4b5 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -36,6 +36,7 @@ public class SchematicWorld extends WrappedWorld { private Map blocks; private Map tileEntities; + private List renderedTileEntities; private List entities; private MutableBoundingBox bounds; public BlockPos anchor; @@ -52,6 +53,7 @@ public class SchematicWorld extends WrappedWorld { this.bounds = new MutableBoundingBox(); this.anchor = anchor; this.entities = new ArrayList<>(); + this.renderedTileEntities = new ArrayList<>(); } public Set getAllPositions() { @@ -92,6 +94,7 @@ public class SchematicWorld extends WrappedWorld { if (tileEntity != null) { tileEntity.setLocation(this, pos); tileEntities.put(pos, tileEntity); + renderedTileEntities.add(tileEntity); } return tileEntity; } catch (Exception e) { @@ -193,8 +196,8 @@ public class SchematicWorld extends WrappedWorld { return bounds; } - public Iterable getTileEntities() { - return tileEntities.values(); + public Iterable getRenderedTileEntities() { + return renderedTileEntities; } } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java index c627dc07d..9d89dd340 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java @@ -130,7 +130,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen