Posted February 23, 20232 yr I'm making a tech mod which will have several machines with a circuit slot (like GregTech) which is controlled by an int called circuitNumber which is apart of a ContainerData variable in the BlockEntity. This int will control the amount of an ItemStack in a slot of my custom circuit item. I tried modifying the data through the passed-in blockEntity in the menu class. (The #setCircuit and #getCircuit functions just used ContainerData#set and ContainerData#get using the passed-in ContainerData in the menu class) No dice, the data never gets changed. I then tried to make a packed called CircuitSyncC2SPacket which would tell the server to modify the data using a function in the BlockEntity class. Zilch, no effect whatsoever. I couldn't find anything when searching for this online, and the one I did was from 2013 that said to use Packets. If this is the solution, then I must be doing something wrong. Any help would be appreciated, thank you. The project's GitHub. Edited February 23, 20232 yr by Tenth Solved
February 23, 20232 yr 12 hours ago, Tenth said: I tried modifying the data through the passed-in blockEntity in the menu class. (The #setCircuit and #getCircuit functions just used ContainerData#set and ContainerData#get using the passed-in ContainerData in the menu class) No dice, the data never gets changed. If you mean the screen, then yes, you would need a packet to send that information to the server which then gets updated on the client. 12 hours ago, Tenth said: I then tried to make a packed called CircuitSyncC2SPacket which would tell the server to modify the data using a function in the BlockEntity class. Zilch, no effect whatsoever. Ah yes, you send a packet to the server, so the first thing you do is set data on the client. Since you are on the server, you can get the server level instance by grabbing it from the sender in the context event.
February 23, 20232 yr Author 6 hours ago, ChampionAsh5357 said: Ah yes, you send a packet to the server, so the first thing you do is set data on the client. Since you are on the server, you can get the server level instance by grabbing it from the sender in the context event. I'm embarrassed it was something so obvious, thanks for the help.
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.