Packets should be thread safe now

This commit is contained in:
aidancbrady committed 2016-06-17 15:56:22 -04:00
1 parent 542e806644
commit e4aed3f7c1
25 files changed
+788 -624

No files matched your search

@@ -31,20 +31,26 @@ public class PacketTileEntity implements IMessageHandler<TileEntityMessage, IMes
return null;
}
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(CapabilityUtils.hasCapability(tileEntity, BaseCapabilities.TILE_NETWORK_CAPABILITY, null))
{
ITileNetwork network = CapabilityUtils.getCapability(tileEntity, BaseCapabilities.TILE_NETWORK_CAPABILITY, null);
try {
network.handlePacketData(message.storedBuffer);
} catch(Exception e) {
e.printStackTrace();
PacketHandler.handlePacket(new Runnable() {
@Override
public void run()
{
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
if(CapabilityUtils.hasCapability(tileEntity, BaseCapabilities.TILE_NETWORK_CAPABILITY, null))
{
ITileNetwork network = CapabilityUtils.getCapability(tileEntity, BaseCapabilities.TILE_NETWORK_CAPABILITY, null);
try {
network.handlePacketData(message.storedBuffer);
} catch(Exception e) {
e.printStackTrace();
}
message.storedBuffer.release();
}
}
message.storedBuffer.release();
}
}, player.worldObj);
return null;
}