1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-13 03:30:29 +00:00

Lazilly instantiate the terminal packet

This means we don't create an NBT tag every tick if the screen is
updating, unless we actually need to.
This commit is contained in:
SquidDev 2019-05-24 18:32:56 +01:00
parent 3cdb12d293
commit 68bf3a71dc

View File

@ -175,12 +175,13 @@ public class ServerComputer extends ServerTerminal implements IComputer, IComput
FMLCommonHandler handler = FMLCommonHandler.instance();
if( handler != null )
{
IMessage packet = createTerminalPacket();
IMessage packet = null;
MinecraftServer server = handler.getMinecraftServerInstance();
for( EntityPlayerMP player : server.getPlayerList().getPlayers() )
{
if( isInteracting( player ) )
{
if( packet == null ) packet = createTerminalPacket();
NetworkHandler.sendToPlayer( player, packet );
}
}