Only send terminal state to interacting players

This splits the computer state (blinking, label, etc...) and terminal
state into two separate packets. When a computer changes, the computer
state is sent to all players and the terminal state is sent to players
who are curerntly using the computer.

This reduces network usage by a substantial amount.
This commit is contained in:
SquidDev
2017-10-12 10:45:38 +01:00
parent 19e4c03d3a
commit 53f16782ab
6 changed files with 94 additions and 34 deletions
@@ -383,6 +383,7 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
switch( packet.m_packetType )
{
case ComputerCraftPacket.ComputerChanged:
case ComputerCraftPacket.ComputerTerminalChanged:
case ComputerCraftPacket.ComputerDeleted:
{
// Packet from Server to Client
@@ -417,6 +418,7 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
// Packets from Server to Client //
///////////////////////////////////
case ComputerCraftPacket.ComputerChanged:
case ComputerCraftPacket.ComputerTerminalChanged:
{
int instanceID = packet.m_dataInt[ 0 ];
if( !ComputerCraft.clientComputerRegistry.contains( instanceID ) )