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
This commit is contained in:
simibubi 2020-12-21 16:05:32 +01:00
parent 0fe8a24041
commit ebf980b33c
5 changed files with 15 additions and 7 deletions

View file

@ -76,6 +76,8 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
ItemStack container = fhi.getContainer(); ItemStack container = fhi.getContainer();
if (container.isItemEqual(copy)) if (container.isItemEqual(copy))
return; return;
if (container.isEmpty())
return;
Ingredient bucket = Ingredient.fromStacks(stack); Ingredient bucket = Ingredient.fromStacks(stack);
ResourceLocation itemName = stack.getItem() ResourceLocation itemName = stack.getItem()

View file

@ -205,7 +205,10 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
indexStart = 0; indexStart = 0;
ItemStack toDistribute = null; ItemStack toDistribute = null;
int leftovers = 0;
for (boolean simulate : Iterate.trueAndFalse) { for (boolean simulate : Iterate.trueAndFalse) {
leftovers = 0;
int index = indexStart; int index = indexStart;
int stackSize = stackToDistribute.getCount(); int stackSize = stackToDistribute.getCount();
int splitStackSize = stackSize / amountTargets; int splitStackSize = stackSize / amountTargets;
@ -226,13 +229,13 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
ItemStack toOutput = ItemHandlerHelper.copyStackWithSize(toDistribute, count); ItemStack toOutput = ItemHandlerHelper.copyStackWithSize(toDistribute, count);
ItemStack remainder = insertIntoTunnel(tunnel, side, toOutput, simulate); ItemStack remainder = insertIntoTunnel(tunnel, side, toOutput, simulate);
if (remainder == null || !remainder.isEmpty()) { if (remainder == null || remainder.getCount() == count) {
if (force) if (force)
return; return;
toDistribute = remainder;
continue; continue;
} }
leftovers += remainder.getCount();
toDistribute.shrink(count); toDistribute.shrink(count);
if (toDistribute.isEmpty()) if (toDistribute.isEmpty())
break; break;
@ -242,7 +245,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity {
} }
} }
stackToDistribute = toDistribute.copy(); stackToDistribute = ItemHandlerHelper.copyStackWithSize(stackToDistribute, toDistribute.getCount() + leftovers);
previousOutputIndex++; previousOutputIndex++;
previousOutputIndex %= amountTargets; previousOutputIndex %= amountTargets;
notifyUpdate(); notifyUpdate();

View file

@ -36,6 +36,7 @@ public class SchematicWorld extends WrappedWorld {
private Map<BlockPos, BlockState> blocks; private Map<BlockPos, BlockState> blocks;
private Map<BlockPos, TileEntity> tileEntities; private Map<BlockPos, TileEntity> tileEntities;
private List<TileEntity> renderedTileEntities;
private List<Entity> entities; private List<Entity> entities;
private MutableBoundingBox bounds; private MutableBoundingBox bounds;
public BlockPos anchor; public BlockPos anchor;
@ -52,6 +53,7 @@ public class SchematicWorld extends WrappedWorld {
this.bounds = new MutableBoundingBox(); this.bounds = new MutableBoundingBox();
this.anchor = anchor; this.anchor = anchor;
this.entities = new ArrayList<>(); this.entities = new ArrayList<>();
this.renderedTileEntities = new ArrayList<>();
} }
public Set<BlockPos> getAllPositions() { public Set<BlockPos> getAllPositions() {
@ -92,6 +94,7 @@ public class SchematicWorld extends WrappedWorld {
if (tileEntity != null) { if (tileEntity != null) {
tileEntity.setLocation(this, pos); tileEntity.setLocation(this, pos);
tileEntities.put(pos, tileEntity); tileEntities.put(pos, tileEntity);
renderedTileEntities.add(tileEntity);
} }
return tileEntity; return tileEntity;
} catch (Exception e) { } catch (Exception e) {
@ -193,8 +196,8 @@ public class SchematicWorld extends WrappedWorld {
return bounds; return bounds;
} }
public Iterable<TileEntity> getTileEntities() { public Iterable<TileEntity> getRenderedTileEntities() {
return tileEntities.values(); return renderedTileEntities;
} }
} }

View file

@ -130,7 +130,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
* MathHelper.lerp(partialTicks, lastChasingProgress, chasingProgress)); * MathHelper.lerp(partialTicks, lastChasingProgress, chasingProgress));
int height = SCHEMATIC_TABLE_PROGRESS.height; int height = SCHEMATIC_TABLE_PROGRESS.height;
RenderSystem.disableLighting(); RenderSystem.disableLighting();
blit(mainLeft + 70, mainTop + 58, SCHEMATIC_TABLE_PROGRESS.startX, SCHEMATIC_TABLE_PROGRESS.startY, width, blit(mainLeft + 70, mainTop + 57, SCHEMATIC_TABLE_PROGRESS.startX, SCHEMATIC_TABLE_PROGRESS.startY, width,
height); height);
} }

View file

@ -77,7 +77,7 @@ public class SchematicRenderer {
SuperByteBuffer superByteBuffer = bufferCache.get(layer); SuperByteBuffer superByteBuffer = bufferCache.get(layer);
superByteBuffer.renderInto(ms, buffer.getBuffer(layer)); superByteBuffer.renderInto(ms, buffer.getBuffer(layer));
} }
TileEntityRenderHelper.renderTileEntities(schematic, schematic.getTileEntities(), ms, new MatrixStack(), TileEntityRenderHelper.renderTileEntities(schematic, schematic.getRenderedTileEntities(), ms, new MatrixStack(),
buffer); buffer);
} }