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();
if (container.isItemEqual(copy))
return;
if (container.isEmpty())
return;
Ingredient bucket = Ingredient.fromStacks(stack);
ResourceLocation itemName = stack.getItem()

View file

@ -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();

View file

@ -36,6 +36,7 @@ public class SchematicWorld extends WrappedWorld {
private Map<BlockPos, BlockState> blocks;
private Map<BlockPos, TileEntity> tileEntities;
private List<TileEntity> renderedTileEntities;
private List<Entity> 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<BlockPos> 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<TileEntity> getTileEntities() {
return tileEntities.values();
public Iterable<TileEntity> getRenderedTileEntities() {
return renderedTileEntities;
}
}

View file

@ -130,7 +130,7 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
* MathHelper.lerp(partialTicks, lastChasingProgress, chasingProgress));
int height = SCHEMATIC_TABLE_PROGRESS.height;
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);
}

View file

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