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); }