3

How can I make my custom blocks "have" NBT data, such as damage values, or full blown custom NBT tags? My specific case is adding a "luck" component to my custom block, which can be anywhere between -100 and 100, and depending on that value, when placed and broken in the world, would do something different, for example, if the value is positive, it would drop a diamond, when it's negative it would summon primed tnt, and if it's zero it would create a dirt hut. I think I can work those out, but I first need my block to be able to store data.

Thank you for your time.

12
  • 5
    Does this answer your question? Is it possible to use NBT tags in commands in Minecraft Bedrock Edition? – Corsaka Mar 29 at 8:37
  • 2
    @Corsaka Are you sure? Accessing NBT tags in commands is much different than accessing them through other means. The proposed duplicate only takes account if the user is using commands, which they are open to other methods too. – ExpertCoder14 Mar 30 at 4:14
  • 1
    @Corsaka this is about addons not datapacks or commands – Penguin Mar 30 at 19:12
  • 1
    @Corsaka For your information Java Edition datapacks are not off-topic. – ExpertCoder14 Mar 31 at 2:45
  • 1
    @Corsaka Unfortunately, the post you linked to doesn't quite solve my problems - I'm looking to create an addon that has a custom block that can hold a "luck" variable, an integer from -100 to +100, both in the world and as an item in an inventory, and when the block is broken, should take into account the value regarding what happens afterwards. – 404 Name Not Found Mar 31 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.