FantaLaTone Posted December 5, 2022 Share Posted December 5, 2022 I have a capability called NPCTrades and a screen class called NPCScreen. This is the current packet I am using to handle opening screen: https://gist.github.com/fantalatone/65116264037b83955a99c8c014d328ef But with this packet I can't set the hashmap in the constructor method of NPCScreen class (https://gist.github.com/fantalatone/8d309e1c6bcc86a2f5ba92c707a78f4e) How I can send capability data to a screen class? Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted December 6, 2022 Share Posted December 6, 2022 The same way you send other data to the client through a packet? You can send it in the packet you are currently handling. Quote Link to comment Share on other sites More sharing options...
FantaLaTone Posted December 6, 2022 Author Share Posted December 6, 2022 5 hours ago, ChampionAsh5357 said: The same way you send other data to the client through a packet? You can send it in the packet you are currently handling. I tried sending the OpenScreen packet from a custom command but it didn't worked Quote Link to comment Share on other sites More sharing options...
FantaLaTone Posted December 6, 2022 Author Share Posted December 6, 2022 https://gist.github.com/fantalatone/65116264037b83955a99c8c014d328ef this is my current server to client packet's code and this is the error i am getting https://gist.github.com/fantalatone/6dc0501034cde16c21873f22e9aa6a2b Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted December 7, 2022 Share Posted December 7, 2022 https://gist.github.com/fantalatone/65116264037b83955a99c8c014d328ef#file-openscreen-java-L31-L41 Let's look at this section. In the constructor, you read the key and value of the map, so it's expected that you write the key and value as well. In the method, you write the key, but then you print the byte buf and the value instead of writing the value. Quote Link to comment Share on other sites More sharing options...
FantaLaTone Posted December 7, 2022 Author Share Posted December 7, 2022 5 hours ago, ChampionAsh5357 said: https://gist.github.com/fantalatone/65116264037b83955a99c8c014d328ef#file-openscreen-java-L31-L41 Let's look at this section. In the constructor, you read the key and value of the map, so it's expected that you write the key and value as well. In the method, you write the key, but then you print the byte buf and the value instead of writing the value. Alright, so should I write the writeMap() method again under the first one? Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted December 9, 2022 Share Posted December 9, 2022 You should write the value, you are already writing the map, albeit partially. Quote Link to comment Share on other sites More sharing options...
FantaLaTone Posted December 9, 2022 Author Share Posted December 9, 2022 4 hours ago, ChampionAsh5357 said: You should write the value, you are already writing the map, albeit partially. I did a lot of changes. Now all I need to do sync the HashMap data from server to client. I am using menus now. How I can sync the hashmap? Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted December 9, 2022 Share Posted December 9, 2022 2 hours ago, FantaLaTone said: I did a lot of changes. Now all I need to do sync the HashMap data from server to client. I am using menus now. How I can sync the hashmap? Same way as you did in the packet, fixing the issue where you don't write the value. You will need to use IContainerFactory now for the menu though. 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.