Jump to content

[1.8] Renaming items


Recommended Posts

So, as my first adventure into Minecraft modding I decided to create an anvil block that will allow me to specify custom repair mechanics. Everything works except for one aspect: renaming an item. The behavior I'm seeing is that the new name is reflected in the output slot, but when I try to pick the item up the game bugs out for a split second and then the gui resets to the state that existed just prior to me trying to pick up the renamed item. When I try to rename an item and do other things, i.e. repair using material or combine with a second item, the renaming aspect is ignored but the other changes occur.


I asked on the minecraftforge IRC channel and was given the lead that I'm doing something client side that I should be doing server side. My understanding is that client side and server side are relevant even for the combined client, i.e. that the combined client has both a client sandbox and a server sandbox. The server in the combined client is the world.


If this is the issue I'm seeing, I'm a bit confused. Why is it the case that I can spawn new items with my current code, but not spawn one with a new name? Is it the case that Forge is handling things under the hood that I'm not aware of, and renaming is an edge case that isn't handled?


Or perhaps I have a fundamental misunderstanding of what's going on here?


Regardless, not really sure where to go from here.


My code below if that helps, as a concrete example I can apply things to.




A side question: I'd like to refactor and extend BlockAnvil and ContainerRepair... Any issue with doing this? It's how I was initially doing things, but backed off as a way to avoid any potential bugs this may cause.


Another side question: I've noticed that if I extend ItemMultiTexture, and create an overriden method for getUnlocalizaedName that just calls the super method, things don't work (this was the issue preventing different textures/names from metadata from working properly). Is that me misunderstanding Java, or misunderstanding Forge?

Link to comment
Share on other sites

Yes, you are doing something client side which you should do on the server side. Basically, server stores all the data, and client displays it. If you change it on the client, it only displays it, and isn't stored on the server. You'd have to use packets for setting the data on the server side.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.


1.12 -> 1.13 primer by williewillus.


1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.



Link to comment
Share on other sites

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

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