Fix syncing issues, properly this time. Should be much cheaper for packets now.
This commit is contained in:
parent
835729081f
commit
efc2184d5a
|
@ -32,7 +32,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
|
|
||||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[6.5,);required-after:FML@[4.7.22,)")
|
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[6.5,);required-after:FML@[4.7.22,)")
|
||||||
@NetworkMod(channels = { "IronChest" }, versionBounds = "[5.0,)", clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
@NetworkMod(channels = { "IronChest" }, versionBounds = "[5.1,)", clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
|
||||||
public class IronChest {
|
public class IronChest {
|
||||||
public static BlockIronChest ironChestBlock;
|
public static BlockIronChest ironChestBlock;
|
||||||
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
||||||
|
|
|
@ -34,7 +34,9 @@ public class PacketHandler implements IPacketHandler {
|
||||||
int x = dat.readInt();
|
int x = dat.readInt();
|
||||||
int y = dat.readInt();
|
int y = dat.readInt();
|
||||||
int z = dat.readInt();
|
int z = dat.readInt();
|
||||||
byte typ = dat.readByte();
|
int typDat = dat.readByte();
|
||||||
|
byte typ = (byte)(typDat & 0xf);
|
||||||
|
byte facing = (byte)((typDat >> 4) & 0xf);
|
||||||
boolean hasStacks = dat.readByte() != 0;
|
boolean hasStacks = dat.readByte() != 0;
|
||||||
int[] items = new int[0];
|
int[] items = new int[0];
|
||||||
if (hasStacks)
|
if (hasStacks)
|
||||||
|
@ -50,6 +52,7 @@ public class PacketHandler implements IPacketHandler {
|
||||||
if (te instanceof TileEntityIronChest)
|
if (te instanceof TileEntityIronChest)
|
||||||
{
|
{
|
||||||
TileEntityIronChest icte = (TileEntityIronChest) te;
|
TileEntityIronChest icte = (TileEntityIronChest) te;
|
||||||
|
icte.setFacing(facing);
|
||||||
icte.handlePacketData(typ, items);
|
icte.handlePacketData(typ, items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +64,7 @@ public class PacketHandler implements IPacketHandler {
|
||||||
int x = tileEntityIronChest.xCoord;
|
int x = tileEntityIronChest.xCoord;
|
||||||
int y = tileEntityIronChest.yCoord;
|
int y = tileEntityIronChest.yCoord;
|
||||||
int z = tileEntityIronChest.zCoord;
|
int z = tileEntityIronChest.zCoord;
|
||||||
int typ = tileEntityIronChest.getType().ordinal();
|
int typ = (tileEntityIronChest.getType().ordinal() | (tileEntityIronChest.getFacing() << 4)) & 0xFF;
|
||||||
int[] items = tileEntityIronChest.buildIntDataList();
|
int[] items = tileEntityIronChest.buildIntDataList();
|
||||||
boolean hasStacks = (items != null);
|
boolean hasStacks = (items != null);
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue