Skip to content

Commit 1d4e47b

Browse files
committed
move circuit inventory to initializeInventory()
initial sync circuit value
1 parent f268ffa commit 1d4e47b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/gregtech/common/metatileentities/multi/multiblockpart/MetaTileEntityFluidHatch.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ public MetaTileEntityFluidHatch(ResourceLocation metaTileEntityId, int tier, boo
8383
this.fluidTank = new HatchFluidTank(getInventorySize(), this, isExportHatch);
8484
initializeInventory(); // the fact that this has to be called three times is so dumb
8585
this.workingEnabled = true;
86+
}
87+
88+
@Override
89+
protected void initializeInventory() {
90+
super.initializeInventory();
8691
if (this.hasGhostCircuitInventory()) {
8792
this.circuitInventory = new GhostCircuitItemStackHandler(this);
8893
this.circuitInventory.addNotifiableMetaTileEntity(this);
@@ -188,6 +193,8 @@ public void writeInitialSyncData(PacketBuffer buf) {
188193
buf.writeBoolean(workingEnabled);
189194
if (isExportHatch) {
190195
buf.writeBoolean(locked);
196+
} else {
197+
buf.writeVarInt(this.circuitInventory.getCircuitValue());
191198
}
192199
}
193200

@@ -197,6 +204,8 @@ public void receiveInitialSyncData(PacketBuffer buf) {
197204
this.workingEnabled = buf.readBoolean();
198205
if (isExportHatch) {
199206
this.locked = buf.readBoolean();
207+
} else {
208+
this.circuitInventory.setCircuitValue(buf.readVarInt());
200209
}
201210
}
202211

0 commit comments

Comments
 (0)