Jump to content

wPatriot

Members
  • Posts

    5
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

wPatriot's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I was lead to believe, by this Wiki-page, that method was only necessary if you required some kind of special handling of the packets (such as the given example, updating a GUI) and that it was something that was called on the client, not the server. Specifically, it says: "The flag specifies what should be done with the packet once it was received (for reference: NetClientHandler.handleTileEntityData), if it is set to 1, 2, 3 or 4 the TileEntity#readFromNBT() method for the tile entity (specified by the coordinates) is called with the nbt data. If the flag is something else, it will call TileEntity#onDataPacket(netManager, packet).". Since I send the packet with a 1 flag, I figured I didn't need the onDataPacket()-method. Apparently, that's incorrect. The server seems to sync up nicely now. Yes for the getDescriptionPacket()-method, no for onDataPacket(). Thanks for the help!
  2. Hello! My situation is as follows: - I have a custom block with a TE that holds some data - It has a GUI that lets the player do some stuff that alters the TE's data (e.g. turn the block "on") - When the player edits the TE's data in the gui, I send a Packet250CustomPayload to the server to notify it of the changes - This works: The data gets updated on the server and on the client, I can see this because of some debugging output showing the values and whether or not the world object is remote[1] - When I save and close, the TE's data on the client side gets saved correctly (for reference, here is my NBT read/write code) Here's some other code that I think may be relevant: - Code responsible for handling button press and notifying server of TE changes - Packet Handler that handles the change-packets Now, here's the problem: When I load the map after saving and closing, the TE's data on the server's side has been reset. The way I see it, the server doesn't seem to call the writeToNBT()-method properly (or rather, at all). I thought that method was supposed to handle saving of data on both the server and client side, but apparently it's not? I hope someone knows what causes this, and how it can be solved. As always, if there is any other code you need, just say so and I'll post it. [1] The output looks like this, and is generated by this method:
  3. Well, don't I feel stupid. The texture file was ok, the xSize and ySize got set properly, but there was a problem with my initGui()-method. Apparently, when I created that I called "super.initGiu()" and instead of choosing the "Change to initGui()"-quick fix, I chose the "Create method 'initGiu()' in type 'GuiContainer'"-quick fix, I guess. So the problem was the initGui() of GuiContainer not being called properly. Sorry for your troubles, and thanks for helping anyway!
  4. Hello! I'm working on a simple mod, and I've been working on a block that needs a pretty simple interface (for now). So far, it's going OK, and I've managed to create the block and have gotten quite far with the GUI. However, I've run into a bit of a snag with the last one. The slots on the GUI don't correspond with the background texture. The coordinates I've set for the slots seem to originate from the origin of the window, instead of the origin of the GUI (the GUI is centered on the screen). To illustrate the problem, I've taken this screenshot and highlighted the slot as it appears on the texture, and the actual position of that slot: *clicky* I position the slots in this code, which seems to be relative to the window, whereas I would expect them to be relative to the edge of the gui, which I have centered, as you can see here!. Obviously, this centers just the background, because now the whole thing is messed up. I'm assuming there's a way to make the slots and the background line up, but I've been unable to find it. Anyway, this is the relevant code (I think), but if there's anything missing I'll be glad to put that into a gist as well. For the record, I've been using tutorials from the wiki to create the mod. I've been using this one in particular to create the GUI. I think I've followed it to the letter, however I've found a few relatively minor errors in the tutorial myself, so it's entirely possible I'm missing something glaringly obvious because of my lack of experience with the MC/MCF codebase. Anyway, I'm hoping someone can point out what I'm doing wrong here. I'd like to get on with this mod
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.