MC1229 Sorter - Meta-ID sorting not possible - 1.12.2
LadyCailinBot opened this issue ยท 4 comments
CRAFTBOOK-3381 - Reported by Vyvhen
since CraftBook 3.9u21 or dev-build #206: "Add the ability for sorters to ignore enchants, meta, and/or durability"
Sorter aren't able to sort items by meta-ID. Enchants and/or durability works fine.
eg. sorting "red wool": every wool goes that way, not only red ones
Comment by me4502
Can you please provide a screenshot of this sorter? MetaID & Durability are the same thing on items.
Comment by Vyvhen
Strange thing on items with real durability like swords it works well (also in screenshot)
Tested it with several server-versions 1.8 - 1.12.2
Comment by Vyvhen
Now got the time to look at the commit where the sorter-logic was changed (caad5d5)
Items with a real Durability eg. Diamon-swort:
item.getType().getMaxDurability() = 1561
item.getDurability() = a value in the range 0-1561
Items without a real Durability eg. Wool:
item.getType().getMaxDurability() = 0
item.getDurability() = a value in the range 0-15
public static boolean doesInventoryContain(Inventory inv, boolean ignoreStackSize, boolean ignoreDurability, boolean ignoreMeta, boolean ignoreEnchants, ItemStack ... stacks) {
if(ItemUtil.areItemsSimilar(base, item)) {
if(!ignoreDurability && (base.getType().getMaxDurability() > 0 || item.getType().getMaxDurability() > 0) && base.getDurability() != item.getDurability())
continue;
if(!ignoreMeta) {
if(base.hasItemMeta() != item.hasItemMeta()) {
if(!ignoreEnchants)
continue;
if(base.hasItemMeta() && ItemUtil.hasDisplayNameOrLore(base))
continue;
else if(item.hasItemMeta() && ItemUtil.hasDisplayNameOrLore(item))
continue;
} else if(base.hasItemMeta()) {
if(base.hasItemMeta() && !ItemUtil.areItemMetaIdentical(base.getItemMeta(), item.getItemMeta(), !ignoreEnchants))
continue;
check if-statement with values for wool eg: red vs green :
if(!ignoreDurability && (base.getType().getMaxDurability() > 0 || item.getType().getMaxDurability() > 0) && base.getDurability() != item.getDurability())
if( !false && ( 0 > 0 || 0 > 0 ) && 14 != 13 )