Quark

Quark

143M Downloads

Variant Selector pick block does not reset variant type when picking original block

copygirl opened this issue · 1 comments

commented

Minecraft: 1.20.1
NeoForge: 47.1.106
Quark: 4.0-460

Reproduction

  • Put two different planks types in your inventory that have a slab and stair variant.
  • Place one of each planks, slab and stair in the world.
  • Middle click slabs and stairs.
    • The planks correctly get moved to and selected in the hotbar.
    • Slab and stair variant is correctly selected when they are picked.
  • Middle click planks.
    • The planks correctly get moved to and selected in the hotbar.
    • However, current variant is not reset – the previous variant (slab or stair) stays selected.

Thoughts

Browsing through the code a little, could this be because the original item is not considered a variant, and thus the following code does not reset the currently selected variant?

String variantKey = variants.getVariantOfBlock(baseBlock, pickedBlock);
if (variantKey != null) {
setClientVariant(variantKey, true);
}

The variant might also need to be reset if (baseBlock == pickedBlock).

commented

Relatedly, the inventory check should be skipped in creative mode, for variant picking to work in creative when you don't already have the original item in your inventory. Otherwise, the variant block is picked and put in the hotbar.