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
1 changed files with 2 additions and 1 deletions

View File

@ -175,12 +175,13 @@ public void broadcastState( boolean force )
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 );
}
}