I ran into an extremely stubborn and strange glitch that I can't seem to find much info about. I have a block with a custom inventory that works fine in singleplayer, but completely spazzes out on servers, not saving, etc. Something is not getting translated between server and client, but I'm not sure what exactly is going wrong. No errors to be seen.
This is the normal function in a singleplayer world:
Normal, basic inventory stuff. Works absolutely fine. (also I'm aware that I haven't set up my lang file yet And the GUI is very placeholder-y)
Whereas on a server...
Clicking the item sends it immediately back into the slot. It just bounces. Can't be dragged at all. Shift clicking is possible, but effectively duplicates the item-- except the one that gets sent to the slot is some form of ghost item that disappears when clicked. Something is not right but I'm still fairly confounded by server coding so I'm hoping someone else here has an idea of what's going on...
Kind of a bizarre problem I know, but I'm hoping someone who has more experience with servers can help me out. I'm definitely at a loss. I'm thinking I may need to manually send a packet or something, but I have yet to find a good example of this sort of problem so I'm not sure.
Still investigating the issue, and found a lot about capabilities not syncing from the server. This is likely the core of my problem. However, I'm unsure of how to properly set that up at this point (or even where I should do that). Ideally I'd like to set something up from a custom slot class or something-- that way I could just make sure to override the class I'm extending and it would auto-sync, no matter what inventory I'm using. I just really don't know how to do that.
Does anyone have a good example of a sync system set up for syncing inventories from tileentities using IItemHandler? Most of the examples I've seen are for IInventory, which doesn't help me since it uses methods I can't access from IItemHandler (I don't want to switch over since I've seen a lot of people saying that IInventory is pretty dated), or any other recommendations on how I can efficiently deal with this problem? Should I consider investing my time into creating a base extension for the Container class itself, and how could I go about setting up a "universal sync" for my custom class?
Hey, all!
I ran into an extremely stubborn and strange glitch that I can't seem to find much info about. I have a block with a custom inventory that works fine in singleplayer, but completely spazzes out on servers, not saving, etc. Something is not getting translated between server and client, but I'm not sure what exactly is going wrong. No errors to be seen.
This is the normal function in a singleplayer world:
Normal, basic inventory stuff. Works absolutely fine. (also I'm aware that I haven't set up my lang file yet And the GUI is very placeholder-y)
Whereas on a server...
Clicking the item sends it immediately back into the slot. It just bounces. Can't be dragged at all. Shift clicking is possible, but effectively duplicates the item-- except the one that gets sent to the slot is some form of ghost item that disappears when clicked. Something is not right but I'm still fairly confounded by server coding so I'm hoping someone else here has an idea of what's going on...
Code:
Block
TileEntity
Container
GUI
GUIHandler
Kind of a bizarre problem I know, but I'm hoping someone who has more experience with servers can help me out. I'm definitely at a loss. I'm thinking I may need to manually send a packet or something, but I have yet to find a good example of this sort of problem so I'm not sure.
Thanks in advance!
Update:
Still investigating the issue, and found a lot about capabilities not syncing from the server. This is likely the core of my problem. However, I'm unsure of how to properly set that up at this point (or even where I should do that). Ideally I'd like to set something up from a custom slot class or something-- that way I could just make sure to override the class I'm extending and it would auto-sync, no matter what inventory I'm using. I just really don't know how to do that.
Does anyone have a good example of a sync system set up for syncing inventories from tileentities using IItemHandler? Most of the examples I've seen are for IInventory, which doesn't help me since it uses methods I can't access from IItemHandler (I don't want to switch over since I've seen a lot of people saying that IInventory is pretty dated), or any other recommendations on how I can efficiently deal with this problem? Should I consider investing my time into creating a base extension for the Container class itself, and how could I go about setting up a "universal sync" for my custom class?