How to maintain NBT data when breaking a block?

Started by owslashbacon on

Topic category: Help with Minecraft modding (Java Edition)

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?

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?

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.

Joined May 2015
Points:

User statistics:

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

thank you :)

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??

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!

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??