Unable to obtain correct NBT data from experience orbs

Started by cyanog3n on

Topic category: Troubleshooting, bugs, and solutions

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unable to obtain correct NBT data from experience orbs

Hi, I'm trying to add a block to my mod that passively absorbs XP orbs from the surroundings and stores their xp in an internal buffer.

The procedure I've been using to detect nearby experience orbs is shown here. The Value tag is stored as a signed 16-bit int so I've used the codeblock to get a number NBT tag and send it in chat for debug purposes:

Sample xp orb nbt data for reference:

However, the block seems unable to get the correct experience value for any size of experience orb and instead outputs nothing but zeroes.

Is there an issue with my method here? Or if it is a limitation of MCreator, are any workarounds possible?

Thanks for your help.

 

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Fixed. Casted entity to…
Thu, 02/10/2022 - 06:49

Fixed. Casted entity to ExperienceOrbEntity and used the method getXpValue() instead:

((ExperienceOrbEntity) entityiterator).getXpValue();