Skip to content

Commit

Permalink
Fix Issues from Unread Packet Data (#2703)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghzdude authored Jan 23, 2025
1 parent 8fee80a commit 32c6d59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/main/java/gregtech/api/capability/GregtechDataCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

public class GregtechDataCodes {

public static final int UPDATE_PRIVATE = assignId();
public static final int LOCK_FILL = assignId();
private static int nextId = 0;

public static int assignId() {
Expand Down Expand Up @@ -97,6 +95,7 @@ public static int assignId() {
public static final int MAINTENANCE_MULTIPLIER = assignId();
public static final int UPDATE_UPWARDS_FACING = assignId();
public static final int UPDATE_FLIP = assignId();
public static final int LOCK_FILL = assignId();

// Item Bus Item Stack Auto Collapsing
public static final int TOGGLE_COLLAPSE_ITEMS = assignId();
Expand Down Expand Up @@ -157,6 +156,9 @@ public static int assignId() {
// Detector Covers
public static final int UPDATE_INVERTED = assignId();

// Ender Covers
public static final int UPDATE_PRIVATE = assignId();

// HPCA / Research Station
public static final int DAMAGE_STATE = assignId();
public static final int LOCK_OBJECT_HOLDER = assignId();
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/gregtech/api/cover/CoverSaveHandler.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package gregtech.api.cover;

import gregtech.api.metatileentity.interfaces.ISyncedTileEntity;
import gregtech.api.util.GTLog;

import net.minecraft.nbt.NBTTagCompound;
Expand Down Expand Up @@ -67,7 +66,6 @@ public static void receiveInitialSyncData(@NotNull PacketBuffer buf, @NotNull Co
} else {
Cover cover = definition.createCover(coverHolder, facing);
cover.readInitialSyncData(buf);
ISyncedTileEntity.checkInitialData(buf, cover);
coverHolder.addCover(facing, cover);
}
}
Expand Down Expand Up @@ -109,7 +107,6 @@ public static void readCoverPlacement(@NotNull PacketBuffer buf, @NotNull CoverH
coverHolder.addCover(placementSide, cover);

cover.readInitialSyncData(buf);
ISyncedTileEntity.checkInitialData(buf, cover);
}
coverHolder.scheduleRenderUpdate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,6 @@ public void receiveInitialSyncData(@NotNull PacketBuffer buf) {
GTLog.logger.warn("Could not find MTETrait for id: {} at position {}.", traitNetworkId, getPos());
} else {
trait.receiveInitialSyncData(buf);
ISyncedTileEntity.checkInitialData(buf, trait);
}
}
CoverSaveHandler.receiveInitialSyncData(buf, this);
Expand Down Expand Up @@ -1085,6 +1084,8 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) {
GTLog.logger.warn("Could not find MTETrait for id: {} at position {}.", traitNetworkId, getPos());
} else {
trait.receiveCustomData(internalId, buf);

// this should be fine, as nothing else is read after this
ISyncedTileEntity.checkCustomData(internalId, buf, trait);
}
} else if (dataId == COVER_ATTACHED_MTE) {
Expand All @@ -1102,6 +1103,8 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) {
int internalId = buf.readVarInt();
if (cover != null) {
cover.readCustomData(internalId, buf);

// this should be fine, as nothing else is read after this
ISyncedTileEntity.checkCustomData(internalId, buf, cover);
}
} else if (dataId == UPDATE_SOUND_MUFFLED) {
Expand Down

0 comments on commit 32c6d59

Please sign in to comment.