How to maintain NBT data when breaking a block?

Started by owslashbacon on

Topic category: Help with modding (Java Edition)

Last seen on 05:26, 7. Apr 2020
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to maintain NBT data when breaking a block?

I am trying to make a block that has generated data on it that I am saving into NBT number tags. However, I need that data to be saved when the block is broken and replaced. Is there a simpler way to do this without hard coding the item drop when the block is broken, applying the NBT data to the item, and then having the item create a new block with the items NBT data applied when placed?

Last seen on 00:56, 23. Apr 2024
Joined May 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Did Anyone Find A Solution…
Tue, 12/08/2020 - 12:44

Did Anyone Find A Solution To This?

Last seen on 14:43, 2. Aug 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Create an itemstack variable…
Tue, 12/08/2020 - 13:03

Create an itemstack variable.

When block is broken 

Set itemstack variable to convert block into item.

Add nbt item data to the item from the block.

Spawn gem itemstack variable.

Last seen on 00:56, 23. Apr 2024
Joined May 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thank you :)
Tue, 12/08/2020 - 16:47

thank you :)

Last seen on 00:56, 23. Apr 2024
Joined May 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Does this work for…
Tue, 12/08/2020 - 19:21

Does this work for multiplayer??

Last seen on 19:43, 13. Jul 2022
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
DiamondGamin Could you post…
Mon, 07/11/2022 - 22:22

DiamondGamin Could you post a screenshot of the code? thank you!

Last seen on 20:53, 18. Apr 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey did this ever work? and…
Sun, 03/17/2024 - 11:16

Hey did this ever work? and if so can I see the code??