Jump to content

[1.12.2]aded NBT with Tile Entity is removed


K10

Recommended Posts

Hi.

 

I added forge 1.12.2 item which teleport any entity to specific position and block that determine the position. The data of teleportation is saved NBT of item.

However, NBT data is lost.

 

The scene is when I picked item on block's gui (without Shift).

 

additionally, an entity does not teleport to the place set without opening the inventory at once.

 

anyone help me ?

 

https://github.com/nihotamor/pipocraft/tree/master/

Link to comment
Share on other sites

Various other things I'm noticing while looking for your problem:

1) These three classes are identical, you don't need three identical classes, you can call new() and just give them different names.

https://github.com/nihotamor/pipocraft/blob/master/src/main/java/doph/pipocraft/item/ItemGachaChip.java

https://github.com/nihotamor/pipocraft/blob/master/src/main/java/doph/pipocraft/item/ItemGoldGachaChip.java

https://github.com/nihotamor/pipocraft/blob/master/src/main/java/doph/pipocraft/item/ItemSilverGachaChip.java

 

2) Ditto all of these classes:

https://github.com/nihotamor/pipocraft/tree/master/src/main/java/doph/pipocraft/item/itemblock

Heck, what was wrong with the original ItemBlock class? Looks like you did this just so you could call your Utils.setName method (which I feel you don't need at all, see #3)

 

3) What is this nonsense:
https://github.com/nihotamor/pipocraft/blob/master/src/main/java/doph/pipocraft/system/Utils.java#L20-L26

You call this from inside the item or block class and it doesn't do anything particularly necessary. You could have at least had it use item.getRegistryName() instead of reconstructing it from string bits a second time. Besides, you don't need this at all, you can just call setRegistryName and setUnlocalized name from anywhere (as evidenced by how the utility function works), it doesn't need to call from inside the block or item.

 

4) Why does this class (and its compatriots) exist? Why are they not static if you insist?

https://github.com/nihotamor/pipocraft/blob/master/src/main/java/doph/pipocraft/init/register/BlockRegister.java

 

Code Style Issue #1

 

Now, your actual problem:

https://github.com/nihotamor/pipocraft/blob/master/src/main/java/doph/pipocraft/gui/GuiContainerTransferMachine.java#L44-L64

Congrats, you set the NBT on the client inside the GUI class. No wonder you have a problem. You need to send a packet to the server that tells the server "this button was clicked" and have the server add the NBT (after making sure the user was allowed to do that action!)

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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