use of buildcraft.api.enums.EnumSnapshotType in project BuildCraft by BuildCraft.
the class TileBuilder method readPayload.
@Override
public void readPayload(int id, PacketBufferBC buffer, Side side, MessageContext ctx) throws IOException {
super.readPayload(id, buffer, side, ctx);
if (side == Side.CLIENT) {
if (id == NET_RENDER_DATA) {
path = new ArrayList<>();
int pathSize = buffer.readInt();
if (pathSize != 0) {
for (int i = 0; i < pathSize; i++) {
path.add(MessageUtil.readBlockPos(buffer));
}
} else {
path = null;
}
updateBasePoses();
if (buffer.readBoolean()) {
snapshotType = buffer.readEnumValue(EnumSnapshotType.class);
getBuilder().readFromByteBuf(buffer);
} else {
snapshotType = null;
}
currentBox.readData(buffer);
readPayload(NET_CAN_EXCAVATE, buffer, side, ctx);
readPayload(NET_SNAPSHOT_TYPE, buffer, side, ctx);
}
if (id == NET_GUI_DATA || id == NET_GUI_TICK) {
tankManager.readData(buffer);
}
if (id == NET_CAN_EXCAVATE) {
canExcavate = buffer.readBoolean();
}
if (id == NET_SNAPSHOT_TYPE) {
EnumSnapshotType old = snapshotType;
snapshotType = buffer.readEnumValue(EnumOptionalSnapshotType.class).type;
if (old != snapshotType) {
redrawBlock();
}
}
}
if (side == Side.SERVER) {
if (id == NET_CAN_EXCAVATE) {
canExcavate = buffer.readBoolean();
sendNetworkUpdate(NET_CAN_EXCAVATE);
}
}
}
use of buildcraft.api.enums.EnumSnapshotType in project BuildCraft by BuildCraft.
the class Snapshot method readFromNBT.
public static Snapshot readFromNBT(NBTTagCompound nbt) throws InvalidInputDataException {
NBTBase tag = nbt.getTag("type");
EnumSnapshotType type = NBTUtilBC.readEnum(tag, EnumSnapshotType.class);
if (type == null) {
throw new InvalidInputDataException("Unknown snapshot type " + tag);
}
Snapshot snapshot = Snapshot.create(type);
snapshot.deserializeNBT(nbt);
return snapshot;
}
Aggregations