Samaritans Posted August 20, 2019 Share Posted August 20, 2019 Hey all, First time posting. I have a GUI with a container so when i call player.openGui, it tries to go to my GuiHandler and call getClientGuiElement. However, part of my container requires me to get an EntityPlayer with a UUID, and display some specific info about the player. When my findPlayer function ran on the client side while on a dedicated server, the player just returns null and my gui just displays empty. Is there any way to fix that? Here's how I am finding player right now: public static EntityPlayer findPlayer(UUID uuid) { for (WorldServer ws : DimensionManager.getWorlds()) { EntityPlayer player = ws.getPlayerEntityByUUID(uuid); if (player != null) return player; } return null; } Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 20, 2019 Share Posted August 20, 2019 8 minutes ago, Samaritans said: and display some specific info about the player. What specific info? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
Samaritans Posted August 20, 2019 Author Share Posted August 20, 2019 (edited) Mainly I need to get the player.getRNG to display a random number of info. The info are specific stuff in my mod that checks for stuff like if the player is a witch, if the player has pets, etc. Here's the container: public ContainerTarotTable(UUID id) { player = Util.findPlayer(id); if (player != null) { List<Tarot> valid = GameRegistry.findRegistry(Tarot.class).getValuesCollection().stream().filter(f -> f.isCounted(player)).collect(Collectors.toList()); if (!valid.isEmpty()) { while (!valid.isEmpty() && toRead.size() < 4) { int i = player.getRNG().nextInt(valid.size()); toRead.add(valid.get(i)); valid.remove(i); } } } } Edited August 20, 2019 by Samaritans Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 20, 2019 Share Posted August 20, 2019 5 minutes ago, Samaritans said: The info are specific stuff in my mod that checks for stuff like if the player is a witch, if the player has pets, etc. You need to sync the information from the server to the client through the container. Cause the Client won't always know about the player. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
Samaritans Posted August 20, 2019 Author Share Posted August 20, 2019 Yeah that's what I am asking about, I have no idea how to do that. Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 20, 2019 Share Posted August 20, 2019 5 minutes ago, Samaritans said: Yeah that's what I am asking about, I have no idea how to do that. Look at the Furnace's container. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
Samaritans Posted August 20, 2019 Author Share Posted August 20, 2019 Im pretty new to modding and I'm still so confused. I guess i need to addListener and detectAndSendChanges? But the container doesnt have an inventory, so there's no changes? I just need a way to have a player opengui on client side while on a dedicated server so that these info are depicted. The player would be holding an item with NBTTag that has a UUID on it. I read that NBT and get the UUID out and find an EntityPlayer with that UUID. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.