MineColonies

MineColonies

57M Downloads

State sorting in gui is wrong

Nightenom opened this issue ยท 8 comments

commented

Prerequisites

  • I am running the latest alpha version of MineColonies and Structurize for my Minecraft version.
  • I checked the MineColonies/Structurize wiki and made sure my issue is not covered there.
  • I made sure that this issue is not a duplicate of any existing issue.

Context

  • Minecraft Version: 1.16.5
  • MineColonies Version: latest
  • Structurize Version: irrelevant
  • Related Mods and their Versions:

Expected behavior

Result of #6692 is wrong, they are sorted at the end
image

Actual behavior

On should be at the top

Steps to reproduce the issue

  1. lumberjack wood type list

Logs

  • latest.log:
  • crashlog:

Notes


Viewers

  • Add a thumbs-up to the bug report if you are also affected. This helps the bug report become more visible to the team and doesn't clutter the comments.
  • Add a comment if you have any insights or background information that isn't already part of the conversation.
commented
commented

This is because this list is inverted, wil write a fix today

commented

After writing the fix and reviewing the result I would like to argue that this is intentional behavior. For instance on the third page of the cook, all food items are enabled and I would like to quickly view the few that I've disabled.

I agree that for the lumberjack this isn't the desired behavior. But that would require a new variation where initially all items are checked but it does sort like an non-inverted list

commented

We have exclusion and allowed filter afaik, so you need to distinguish between them, probably @Raycoms or someone else can say more

commented

There is an !inverted var on the client side that could be used for this.

commented

There is, and in the proposed fix I do use that.

if(!o1Allowed && o2Allowed){
    if (isInverted)
        return -1;
    return  1;
}else if(o1Allowed && !o2Allowed){
    if (isInverted)
        return 1;
    return -1;
}else{
    return 0;
}

But in the following three screenshots you can see the cases I'm talking about. In my opinion the lumberjack and cook fuel are correct in the screenshots but the cook food is wrong.

Cook fuel:
Schermafbeelding 2021-03-11 om 15 13 47

Cook food:
Schermafbeelding 2021-03-11 om 15 19 13

Lumberjack:
Schermafbeelding 2021-03-11 om 15 14 27

commented

I think this is fine, a perfect solution doesn't exist yet. Try to do a isInverted ? 1 : -1 btw, inline looks nicer in this case

commented

Alright, will open a PR as is.