Skip to content

Commit

Permalink
fix veins differing between server and clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyfts committed Sep 21, 2024
1 parent 0c3ace2 commit 8b785e0
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.sinthoras.visualprospecting.database.UndergroundFluidPosition;
import com.sinthoras.visualprospecting.database.veintypes.VeinTypeCaching;

import cpw.mods.fml.common.network.ByteBufUtils;
import io.netty.buffer.ByteBuf;

public final class VPByteBufUtils {
Expand All @@ -19,18 +20,18 @@ public static void WriteOreVeinPosition(ByteBuf buf, OreVeinPosition oreVeinPosi
buf.writeInt(oreVeinPosition.dimensionId);
buf.writeInt(oreVeinPosition.chunkX);
buf.writeInt(oreVeinPosition.chunkZ);
buf.writeShort(oreVeinPosition.veinType.veinId);
buf.writeBoolean(oreVeinPosition.isDepleted());
ByteBufUtils.writeUTF8String(buf, oreVeinPosition.veinType.name);
}

public static OreVeinPosition ReadOreVeinPosition(ByteBuf buf) {
final int dimId = buf.readInt();
final int chunkX = buf.readInt();
final int chunkZ = buf.readInt();
final short veinId = buf.readShort();
final boolean isDepleted = buf.readBoolean();
final String veinName = ByteBufUtils.readUTF8String(buf);

return new OreVeinPosition(dimId, chunkX, chunkZ, VeinTypeCaching.getVeinType(veinId), isDepleted);
return new OreVeinPosition(dimId, chunkX, chunkZ, VeinTypeCaching.getVeinType(veinName), isDepleted);
}

public static void WriteUndergroundFluidPosition(ByteBuf buf, UndergroundFluidPosition undergroundFluidPosition) {
Expand Down

0 comments on commit 8b785e0

Please sign in to comment.