Fix pipe brackets not rendering on contraptions

This commit is contained in:
simibubi 2020-12-02 22:34:26 +01:00
parent e3bef624a0
commit 00b01cac55
3 changed files with 11 additions and 7 deletions

View File

@ -112,7 +112,8 @@ public abstract class Contraption {
private List<BlockFace> pendingSubContraptions;
// Client
public Map<BlockPos, TileEntity> renderedTileEntities;
public Map<BlockPos, TileEntity> presentTileEntities;
public List<TileEntity> renderedTileEntities;
public Contraption() {
blocks = new HashMap<>();
@ -124,7 +125,8 @@ public abstract class Contraption {
fluidStorage = new HashMap<>();
glueToRemove = new ArrayList<>();
initialPassengers = new HashMap<>();
renderedTileEntities = new HashMap<>();
presentTileEntities = new HashMap<>();
renderedTileEntities = new ArrayList<>();
pendingSubContraptions = new ArrayList<>();
stabilizedSubContraptions = new HashMap<>();
}
@ -512,6 +514,7 @@ public abstract class Contraption {
public void readNBT(World world, CompoundNBT nbt, boolean spawnData) {
blocks.clear();
presentTileEntities.clear();
renderedTileEntities.clear();
nbt.getList("Blocks", 10)
@ -549,7 +552,8 @@ public abstract class Contraption {
if (te instanceof KineticTileEntity)
((KineticTileEntity) te).setSpeed(0);
te.getBlockState();
renderedTileEntities.put(info.pos, te);
presentTileEntities.put(info.pos, te);
renderedTileEntities.add(te);
}
});
@ -587,7 +591,7 @@ public abstract class Contraption {
if (spawnData)
fluidStorage.forEach((pos, mfs) -> {
TileEntity tileEntity = renderedTileEntities.get(pos);
TileEntity tileEntity = presentTileEntities.get(pos);
if (!(tileEntity instanceof FluidTankTileEntity))
return;
FluidTankTileEntity tank = (FluidTankTileEntity) tileEntity;

View File

@ -71,7 +71,7 @@ public class ContraptionRenderer {
private static void renderTileEntities(World world, Contraption c, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {
TileEntityRenderHelper.renderTileEntities(world, c.renderedTileEntities.values(), ms, msLocal, buffer);
TileEntityRenderHelper.renderTileEntities(world, c.renderedTileEntities, ms, msLocal, buffer);
}
private static SuperByteBuffer buildStructureBuffer(Contraption c, RenderType layer) {
@ -86,7 +86,7 @@ public class ContraptionRenderer {
Random random = new Random();
BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize());
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
renderWorld.setTileEntities(c.renderedTileEntities.values());
renderWorld.setTileEntities(c.presentTileEntities.values());
for (BlockInfo info : c.getBlocks()
.values())

View File

@ -52,7 +52,7 @@ public class BasinMovementBehaviour extends MovementBehaviour {
}
context.tileData.put(key, itemStackHandler.serializeNBT());
});
TileEntity tileEntity = context.contraption.renderedTileEntities.get(context.localPos);
TileEntity tileEntity = context.contraption.presentTileEntities.get(context.localPos);
if (tileEntity instanceof BasinTileEntity)
((BasinTileEntity) tileEntity).readOnlyItems(context.tileData);
context.temporaryData = false; // did already dump, so can't any more