Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by Xaser

  1. Ok, I think I got the basics of Minecraft's packet handling and forge's SimpleImpl extension down. I also understand that this will be hell to debug, as there don't appear to be any hooks I can use to link into the processing of other mods' packets. Even adding some statistical output to the forge SimpleImpl code seems difficult as it appears that it's not intended to modify the forge code itself. So if I got this right, my only way to go is to randomly intercept one packet at a time (which will inevitably crash the server due to timeouts and disconnect the players) and hope to get some idea of the kinds of packets arriving. Sounds fun.
  2. Hi @diesieben07, ok I just set up a fresh modding workspace for 1.16.4 (forge-36.1.13) and I'm slowly figuring out how to attach the "projects debugger" to the server process. I'm unsure however where I should intercept with the debugger. I browsed the code and googled for info on the packet handling pipeline, but I'm still a bit unsure at which point I can really see the contents of the packet as deserialized data objects. Perhaps you have a pointer on which function to start from? Thanks!
  3. Hi, I have issues on my modded server with high traffic to but primarily from players. It's sometimes greater than 1 Mbit/s and appears to be related to items in water. To debug which mod / forge code is responsible, I would like to inspect the packets, but all the proxy-based sniffers (e.g. pakkit) seem to only work with vanilla minecraft. Is there some equivalent solution for forge servers that I've not been able to find? If not, what other ways to I have to inspect the packets. Since the client only shows 1-5 pkt/s TX, they must be rather big and the main contributor of packet size should be easily identifiable. I've attached a debug.log to comply with the rules, but I don't think it will be very helpful.debug.log
  4. Hi, yes I get that, but I'm unsure about the definition of a "server". does it only apply to the dedicated server or to the local server as well?
  5. Thanks. Another quick question. When using the local server, my mod won't work and the console says So perhaps I should set AcceptableRemoteVersions to * but not say ServerSideOnly?
  6. But the server will still say "[FML]: Attempting connection with missing mods [my_mod] at CLIENT" when doing so. Is this intended?
  7. I actually used the exact same tutorials, but I must have skipped over the PlayerLoggedInEvent part and forgot about it.. that what happens when you only get to work on this stuff over the weekends i guess. Thanks! Actually, if the capability is not only for players, you may consider the OnEntityJoinWorldEvent as well
  8. Well, right now like this: http://pastebin.com/kxwndA8z So the nbt storage read function will be called when the player logs in and is loaded by the server, this causes the capability value to be set server-side and in the setter function, a update packet is triggered. So should I just use PlayerLoggedInEvent for initializing all capabilities from server- to client-side?
  9. I created a capability which stores a property about the player (mana) in the nbt. When it is loaded during player connect and set in the Capability class, it also triggers a message to be sent to the player to notify him of the capability value. However it seems that this message is sent to early because I get a NullPointerException in "FMLOutboundHandler", because player.connection == null. So apparently the connection has not yet been fully established. What event or something else can I use to notify the player of his capability value, once the connection has been established?
  10. Yes it does have a container attached, it references 3 inventories (player inventory + 2 temporary ones) as well as two ints and a reference to the other player (only the name is required really). I know that I have to keep the two int values synced myself later (haven't looked into that yet) however the gui also displays the name of another player (hence the gui requires the name or the entity id).,
  11. Pretty straight forward question: I want to open a GUI for the player (from the server side using .openGui), however this GUI needs some data to work properly. I prepared a custom packet to send this data, and on the server side code request it to be send before calling .openGui but apparently it doesn't arrive in time and the Gui throws a NullPointerException. So what should I do? My current ideas are: ack the data before having the server call openGui or have the gui wait clientside for the data.
  12. ok, almost there.. it was a bit tricky but it's definitely taking shape. Last question (hopefully): this feature / capability is entirely non-persistent so has no need for a Storage implementation. I cannot pass null however, as this causes an exception. is there a dummy implementation that I can pass? also for IStorage, do writeNBt and readNBT have to return a non-null value? Edit: also, can the default implementation be skipped during registration? I have multiple capabilities that require arguments to be passed to the injector and cannot have a default constructor since they do not function without the proper injection of the owning Entity.
  13. Well i'm just trying to find a way to signal to the in-code user of the capability whether or not the player is currently in a trade interaction or not, i.e. hascapability would only return true if the player is in a trade and getCapability would then return an object containing references to both participating players. If however the player wasn't in a trade, hasCapability would return false and getCapability null. However there doesn't seem to be a way to achieve this directly, so I need another layer, i.e. instead of a Trade capability, I am now trying a "trader" capability.
  14. Sorry, I'm stuck again, maybe I just don't get the capability system after all. So I register the CapabilityProvider. However I can only access its getCapability and setCapability functions via the EntityPlayer directly. I have no way of calling another function that the provider might have to set the "trading" state of the player. So I have no real way to externally control when the instance field for the actual Capability in the CapabilityProvider is set. So I cannot make the Provider assign a value to the instance when the trading start and set it to null again, when the interaction is done. Correct? What might be a possible solution?
  15. oh right.. now the provider class makes much more sense to me. The hasCapability and getCapability functions are exactly what I need already.. I just didn't see it.. thanks!
  16. I'm implementing this now. Another quick question that came up was: usually capabilities are attached in the onAttachCapabilitesEvent, which is called at some point during entity creation i presume. However I'd like the capability to only exist if the player is currently in a trade, is there a possibility to attach and remove the capability at any desired time?
  17. Thanks for the reply. Good to know that they get synced automatically. Still trying to figure out the correct approach here. So obviously the Container will be created once on the server and client respectively in the getServerGuiElement and getClientGuiElement functions of my GuiHandler. (In fact getClientGuiElement will create the Gui which in turn creates the Container). So here's my current idea: When player1 uses the special tade-initiation item, this will call TradeHandler.requestTrade, which will handle all the permissive stuff and so on and create an instance of the Trade class, which is stored in both players using capabilities or something equivalent (i need to store the instance of the Trade in the player so I can access it via the player later in the GuiHandler). Finally, the TradeHandler will call openGui for both players and the respective trade containers will be created in the getServerGuiElement and getClientGuiElement functions respectively... which will also mean that the server has two containers, one for each player.. I hope this makes some sense. Ignore this (editor bug): be create
  18. I'm experimenting with player-player trade interactions. I have created an item that, when one player uses it on another player, is supposed to open a trading GUI for both players. Each player is seeing his own inventory, an inventory that is temporarily created for the trade where he can put the items he wants to offer and an inventory that he cannot interact with, which shows the items that the other player is offering. I'm pretty much done with the GUI, using dummy inventories, however no I'm not sure how I should tackle the inventory creation for the "offer"-inventories. Both these "offer"-inventories have to be created on the fly and synchronized to both players. I'm wondering if I can make use of existing structures or if I have to do all the syncing manually using custom network pakets. I have looked at how the inventory for container blocks are created, but they rely on being created together with their TileEntities (which don't exist for my temporary GUI). Possibly I could create a temporary custom entity? would that automatically get synced to all players?
  19. Oh yeah that makes sense.. completely missed that method. thanks.
  20. Hi, let's say i wanted to create an items that allows users to write a note to other players. So it would be an item that opens up a GUI (similar to sign) when right-clicking on another player to enter a message, and on confirmation, that note would be placed in the target player's inventory. The way I see it, there are two possible ways to handle this: 1. In the scope of the acting player using the onItemRightClick event and checking if the player aims at another player. 2. In the scope of the target player using the processInitialInteract or processInteract event (like the lead code does, for example). Pro option 1: It is all handled in the acting player's scope (which i feel is the way it should be) Pro option 2: It is automatically handled when a player right clicks another player, no checking for "aiming a player" necessary. Which one would be the most appropriate option?
  21. Awesome, got it, thank you. so the entity has to pass through the provider to the actual capability. This would still leave the question whether this can be achieved with a defaultImplementation at all, however for my needs I am fine with not using defaultImplementation. Thanks!
  22. Now I am even more confused. Ok, let me just go over things, so you guys can make sure I understand this stuff correctly. So I have the interface IMoney with an implementation Money, which I want to be the default implementation. I also have aMoneyProvider and a MoneyStorage (lets leave that one aside for the moment) and a event handler running in the CommonProxy domain. In the event handler, I have a static ResourceLocation, indicating the default implementation of the money capability. I pass this resource to the addCapability function in the onAttachCapabilitiesEvent handler, together with a new instance of MoneyProvider. So far so good. Now if I understand correctly, an instance of Capability<Money> is instantiated by the capability framework using the passed ResourceLocation and injected into theCapabilityInject@ annoated field MONEY_CAPABILITY. The MoneyProvider then uses this injected Capability<Money> object to get a reference to a new instance of the default implementation Money (as specified in the original ResourceLocation) and uses this one as instance here: private IMoney instance = MONEY_CAPABILITY.getDefaultInstance(); . So ultimately the Money instance is constructed by the Capability<Money> object, so I have no access to the constructor call of Money. All correct so far? So how would I pass the owning Entity to Money? And could you possibly elaborate the purpose of the Provider class? is it used used to link everything together?
  23. Okay, straight forward enough. Wasn't quite sure if this was considered "good practice". In any case, how would I go about "injecting" the owning Entity into the capability then. AFAIK, the "Money" Capability is instantiated by "getDefaultInstance" in the capability provider, however this method takes no arguments. Is it even possible for the capability to have a non-default constructor? The only solution that comes to my mind right now is to inject the owning Entity after construction of the Capability instance in the "onAttachCapabilitiesEvent" handler. More code: http://pastebin.com/JiGSiAZT
  24. So I picked up modding a few days ago and thanks to the modding tutorials by _bedrock_miner_, shadowfacts.net and jabelar and thank to diesieben07's and Choonster's amazing effort to answer questions in this forum, I already came quite far. However now I'm stuck. I started out with a simple currency mod, for which I added a "Money" Capability, implementing "IMoney" and a "UpdateMoneyMessage" Message. Code here: http://pastebin.com/hu7w6kVi So as you can see, whenever I call "addMoney" or "setMoney", I also want to call "onMoneyUpdate", so I can dispatch a "UpdateMoneyMessage" to the player, to inform him about the change. However from the "Money" class, I have no access to the parent Entity owning this capability. How should I solve this problem?. (see line 20 in the paste for the part where I'm stuck).
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.