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; private List<BlockFace> pendingSubContraptions;
// Client // Client
public Map<BlockPos, TileEntity> renderedTileEntities; public Map<BlockPos, TileEntity> presentTileEntities;
public List<TileEntity> renderedTileEntities;
public Contraption() { public Contraption() {
blocks = new HashMap<>(); blocks = new HashMap<>();
@ -124,7 +125,8 @@ public abstract class Contraption {
fluidStorage = new HashMap<>(); fluidStorage = new HashMap<>();
glueToRemove = new ArrayList<>(); glueToRemove = new ArrayList<>();
initialPassengers = new HashMap<>(); initialPassengers = new HashMap<>();
renderedTileEntities = new HashMap<>(); presentTileEntities = new HashMap<>();
renderedTileEntities = new ArrayList<>();
pendingSubContraptions = new ArrayList<>(); pendingSubContraptions = new ArrayList<>();
stabilizedSubContraptions = new HashMap<>(); stabilizedSubContraptions = new HashMap<>();
} }
@ -512,6 +514,7 @@ public abstract class Contraption {
public void readNBT(World world, CompoundNBT nbt, boolean spawnData) { public void readNBT(World world, CompoundNBT nbt, boolean spawnData) {
blocks.clear(); blocks.clear();
presentTileEntities.clear();
renderedTileEntities.clear(); renderedTileEntities.clear();
nbt.getList("Blocks", 10) nbt.getList("Blocks", 10)
@ -549,7 +552,8 @@ public abstract class Contraption {
if (te instanceof KineticTileEntity) if (te instanceof KineticTileEntity)
((KineticTileEntity) te).setSpeed(0); ((KineticTileEntity) te).setSpeed(0);
te.getBlockState(); 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) if (spawnData)
fluidStorage.forEach((pos, mfs) -> { fluidStorage.forEach((pos, mfs) -> {
TileEntity tileEntity = renderedTileEntities.get(pos); TileEntity tileEntity = presentTileEntities.get(pos);
if (!(tileEntity instanceof FluidTankTileEntity)) if (!(tileEntity instanceof FluidTankTileEntity))
return; return;
FluidTankTileEntity tank = (FluidTankTileEntity) tileEntity; 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, private static void renderTileEntities(World world, Contraption c, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) { 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) { private static SuperByteBuffer buildStructureBuffer(Contraption c, RenderType layer) {
@ -86,7 +86,7 @@ public class ContraptionRenderer {
Random random = new Random(); Random random = new Random();
BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize()); BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize());
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
renderWorld.setTileEntities(c.renderedTileEntities.values()); renderWorld.setTileEntities(c.presentTileEntities.values());
for (BlockInfo info : c.getBlocks() for (BlockInfo info : c.getBlocks()
.values()) .values())

View File

@ -52,7 +52,7 @@ public class BasinMovementBehaviour extends MovementBehaviour {
} }
context.tileData.put(key, itemStackHandler.serializeNBT()); 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) if (tileEntity instanceof BasinTileEntity)
((BasinTileEntity) tileEntity).readOnlyItems(context.tileData); ((BasinTileEntity) tileEntity).readOnlyItems(context.tileData);
context.temporaryData = false; // did already dump, so can't any more context.temporaryData = false; // did already dump, so can't any more