@Override public void handleServerSafe(NetHandlerPlayServer netHandler) { Container container = netHandler.player.openContainer; if(container instanceof ContainerStencilTable) { ((ContainerStencilTable) container).setOutput(output); // find all people who also have the same gui open and update them too WorldServer server = netHandler.player.getServerWorld(); for(EntityPlayer player : server.playerEntities) { if(player == netHandler.player) { continue; } if(player.openContainer instanceof ContainerStencilTable) { if(((BaseContainer) container).sameGui((BaseContainer) player.openContainer)) { ((ContainerStencilTable) player.openContainer).setOutput(output); // same gui, send him an update TinkerNetwork.sendTo(this, (EntityPlayerMP) player); } } } } }
@Override public void handleServerSafe(NetHandlerPlayServer netHandler) { Container container = netHandler.player.openContainer; if(container instanceof ContainerToolStation) { ((ContainerToolStation) container).setToolSelection(tool, activeSlots); // find all people who also have the same gui open and update them too WorldServer server = netHandler.player.getServerWorld(); for(EntityPlayer player : server.playerEntities) { if(player == netHandler.player) { continue; } if(player.openContainer instanceof ContainerToolStation) { if(((BaseContainer) container).sameGui((BaseContainer) player.openContainer)) { ((ContainerToolStation) player.openContainer).setToolSelection(tool, activeSlots); // same gui, send him an update TinkerNetwork.sendTo(this, (EntityPlayerMP) player); } } } } }
public void syncOnOpen(EntityPlayerMP playerOpened) { // find another player that already has the gui for this tile open WorldServer server = playerOpened.getServerWorld(); for(EntityPlayer player : server.playerEntities) { if(player == playerOpened) { continue; } if(player.openContainer instanceof BaseContainer) { if(this.sameGui((BaseContainer<T>) player.openContainer)) { syncWithOtherContainer((BaseContainer<T>) player.openContainer, playerOpened); return; } } } // no player has a container open for the tile syncNewContainer(playerOpened); }