Skip to content

Commit b1c0a6d

Browse files
committed
Fix #65: Client needlessly recomputes the pipe shape
1 parent 2fce537 commit b1c0a6d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/main/java/dev/technici4n/moderndynamics/pipe/PipeBlockEntity.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,20 @@ public void fromClientTag(CompoundTag tag) {
136136
for (var host : getHosts()) {
137137
host.readClientNbt(tag);
138138
}
139-
var attachmentTags = tag.getList("attachments", Tag.TAG_COMPOUND);
140-
var attachments = new AttachmentModelData[6];
141-
for (var direction : Direction.values()) {
142-
var attachmentTag = attachmentTags.getCompound(direction.get3DDataValue());
143-
attachments[direction.get3DDataValue()] = AttachmentModelData.from(attachmentTag);
144-
}
145139

146-
clientModelData = new PipeModelData(connections, inventoryConnections, attachments);
147-
clientSideConnections = connections | inventoryConnections;
140+
if (tag.getBoolean("#c")) { // remesh flag, a bit hacky but it should work ;)
141+
var attachmentTags = tag.getList("attachments", Tag.TAG_COMPOUND);
142+
var attachments = new AttachmentModelData[6];
143+
for (var direction : Direction.values()) {
144+
var attachmentTag = attachmentTags.getCompound(direction.get3DDataValue());
145+
attachments[direction.get3DDataValue()] = AttachmentModelData.from(attachmentTag);
146+
}
148147

149-
updateCachedShape(connections, inventoryConnections);
148+
clientModelData = new PipeModelData(connections, inventoryConnections, attachments);
149+
clientSideConnections = connections | inventoryConnections;
150150

151+
updateCachedShape(connections, inventoryConnections);
152+
}
151153
}
152154

153155
@Override

0 commit comments

Comments
 (0)