question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[XMaterial] - Incorrect/Inconsistent matchXMaterial(itemstack) result on 1.8.8 & 1.12.2

See original GitHub issue

Description 1. Skeleton Skulls are matching as Dragon Heads on 1.8.8 and Pig Spawn Eggs are matching as Hoglin Spawn Eggs on 1.12.2 Command:

/minecraft:replaceitem entity @p slot.hotbar.0 skull 1 0

For Pig Spawn Egg, it is taken from the Creative Inventory. Code:

ItemStack itemStack = player.getInventory.getItem(0);
XMaterial.matchXMaterial(itemStack);

2. Inconsistency when matching different Dye items on 1.8.8 Using the same code above, in Minecraft 1.8.8: Bone Meal matches into Bone Meal, however Ink Sacs matches into Black Dye

Seems like all of these incorrect/inconsistent matches involves items with 0 damage value, might have to check whether this also effects other similar items like flowers. As for the spawn egg, it might be also be due to how 1.12 uses nbt to determine the mob in contains.

Version 1.8.8, 1.12.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CryptoMorincommented, Jan 31, 2022

I fixed all of them in 8.6.1

0reactions
LOOHPcommented, Jan 29, 2022

Thanks for the fix. It’s fair to say that SPAWN_EGG_META are outside the scope of XMaterial hence not supported. Although I feel like a predictable result should still be provided. Like always returning the “default material” (the one with damage 0 - i.e. PIG_SPAWN_EGG) instead of an arbitrary result like the HOGLIN_SPAWN_EGG.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resource - XSeries - XMaterial, XParticle, XSound, XPotion ...
This is used to support block state and data for materials. XMaterial only handles ItemStacks. All the XMaterial exceptional materials for ...
Read more >
[XMaterial] - Data not working? · Issue #69 - GitHub
I have a String, like "INK_SACK:8", and when i use XMaterial.matchXMaterial(config.getString("material"); it only loads the ink sack, not the "8 ...
Read more >
XSeries - bytemeta
Unsupported material with XMaterial#matchXMaterial(ItemStack) ... [XMaterial] - Incorrect/Inconsistent matchXMaterial(itemstack) result on 1.8.8 & 1.12.2.
Read more >
Improve error messages and handling - Olical/Aniseed - IssueHint
... 26, 2022-02-16, 2022-07-03. [XMaterial] - Incorrect/Inconsistent matchXMaterial(itemstack) result on 1.8.8 & 1.12.2, 5, 2022-01-15, 2022-07-25.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found