Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal propagation issues #228

Open
supersaiyansubtlety opened this issue Sep 22, 2024 · 0 comments
Open

Proposal propagation issues #228

supersaiyansubtlety opened this issue Sep 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working user interface affects the enigma ui

Comments

@supersaiyansubtlety
Copy link
Contributor

supersaiyansubtlety commented Sep 22, 2024

Working on net/minecraft/village/TradeOffers$EnchantBookFactory on QuiltMC/quilt-mappings@3f6043b

Proposed param names don't always propagate through constructors, and you can end up with a "ghost" proposal from a previous name that was reset.

I think these issues are just "visual" issues in the editor.

0. Start state
static class EnchantBookFactory implements TradeOffers.Factory {
    private final int experience;
    private final TagKey<Enchantment> f_fykexdki;
    private final int minLevel;
    private final int maxLevel;

    public EnchantBookFactory(int experience, TagKey<Enchantment> arg) {
        this(experience, 0, Integer.MAX_VALUE, arg);
    }

    public EnchantBookFactory(int experience, int minLevel, int maxLevel, TagKey<Enchantment> arg) {
        this.minLevel = minLevel;
        this.maxLevel = maxLevel;
        this.experience = experience;
        this.f_fykexdki = arg;
    }
    //...
}
1. Name `f_fykexdki` -> `enchantmentPool` (no propagation)

change propagates to the second constructor, but not the first

static class EnchantBookFactory implements TradeOffers.Factory {
    private final int experience;
    private final TagKey<Enchantment> enchantmentPool;
    private final int minLevel;
    private final int maxLevel;

    public EnchantBookFactory(int experience, TagKey<Enchantment> arg) {
        this(experience, 0, Integer.MAX_VALUE, arg);
    }

    public EnchantBookFactory(int experience, int minLevel, int maxLevel, TagKey<Enchantment> enchantmentPool) {
        this.minLevel = minLevel;
        this.maxLevel = maxLevel;
        this.experience = experience;
        this.enchantmentPool = enchantmentPool;
    }
    //...
}
2. Give first constructor param a temp name so it can be reset to obfuscated
static class EnchantBookFactory implements TradeOffers.Factory {
    private final int experience;
    private final TagKey<Enchantment> enchantmentPool;
    private final int minLevel;
    private final int maxLevel;

    public EnchantBookFactory(int experience, TagKey<Enchantment> TEMP) {
        this(experience, 0, Integer.MAX_VALUE, TEMP);
    }

    public EnchantBookFactory(int experience, int minLevel, int maxLevel, TagKey<Enchantment> enchantmentPool) {
        this.minLevel = minLevel;
        this.maxLevel = maxLevel;
        this.experience = experience;
        this.enchantmentPool = enchantmentPool;
    }
    //...
}
3. Reset `TEMP` to obfuscated

it ends up with the correct name

static class EnchantBookFactory implements TradeOffers.Factory {
    private final int experience;
    private final TagKey<Enchantment> enchantmentPool;
    private final int minLevel;
    private final int maxLevel;

    public EnchantBookFactory(int experience, TagKey<Enchantment> enchantmentPool) {
        this(experience, 0, Integer.MAX_VALUE, enchantmentPool);
    }

    public EnchantBookFactory(int experience, int minLevel, int maxLevel, TagKey<Enchantment> enchantmentPool) {
        this.minLevel = minLevel;
        this.maxLevel = maxLevel;
        this.experience = experience;
        this.enchantmentPool = enchantmentPool;
    }
    //...
}
4. Reset `enchantmentPool` field to obfuscated (no propagation)

change propagates to the second constructor, but not the first, as in 2.

static class EnchantBookFactory implements TradeOffers.Factory {
    private final int experience;
    private final TagKey<Enchantment> f_fykexdki;
    private final int minLevel;
    private final int maxLevel;

    public EnchantBookFactory(int experience, TagKey<Enchantment> enchantmentPool) {
        this(experience, 0, Integer.MAX_VALUE, enchantmentPool);
    }

    public EnchantBookFactory(int experience, int minLevel, int maxLevel, TagKey<Enchantment> arg) {
        this.minLevel = minLevel;
        this.maxLevel = maxLevel;
        this.experience = experience;
        this.f_fykexdki = arg;
    }
    //...
}
5. Repeat 2.
static class EnchantBookFactory implements TradeOffers.Factory {
    private final int experience;
    private final TagKey<Enchantment> f_fykexdki;
    private final int minLevel;
    private final int maxLevel;

    public EnchantBookFactory(int experience, TagKey<Enchantment> TEMP) {
        this(experience, 0, Integer.MAX_VALUE, TEMP);
    }

    public EnchantBookFactory(int experience, int minLevel, int maxLevel, TagKey<Enchantment> arg) {
        this.minLevel = minLevel;
        this.maxLevel = maxLevel;
        this.experience = experience;
        this.f_fykexdki = arg;
    }
    //...
}
6. Repeat 3. ("ghost" proposal)

TEMP gets reset to enchantmentPool, despite that name appearing nowhere else.

Restarting the editor makes it go back to arg as expected.

static class EnchantBookFactory implements TradeOffers.Factory {
    private final int experience;
    private final TagKey<Enchantment> f_fykexdki;
    private final int minLevel;
    private final int maxLevel;

    public EnchantBookFactory(int experience, TagKey<Enchantment> enchantmentPool) {
        this(experience, 0, Integer.MAX_VALUE, enchantmentPool);
    }

    public EnchantBookFactory(int experience, int minLevel, int maxLevel, TagKey<Enchantment> arg) {
        this.minLevel = minLevel;
        this.maxLevel = maxLevel;
        this.experience = experience;
        this.f_fykexdki = arg;
    }
    //...
}
@supersaiyansubtlety supersaiyansubtlety added bug Something isn't working user interface affects the enigma ui labels Sep 22, 2024
@supersaiyansubtlety supersaiyansubtlety changed the title Suggestion propagation issues Proposal propagation issues Sep 22, 2024
@ix0rai ix0rai self-assigned this Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working user interface affects the enigma ui
Projects
None yet
Development

No branches or pull requests

2 participants