Search in sources :

Example 1 with HandledScreenAccessor

use of me.xmrvizzy.skyblocker.mixin.HandledScreenAccessor in project Skyblocker by LifeIsAParadox.

the class QuickNavButton method updateCoordinates.

private void updateCoordinates() {
    Screen screen = MinecraftClient.getInstance().currentScreen;
    if (screen instanceof HandledScreen<?>) {
        HandledScreen<?> handledScreen = (HandledScreen<?>) screen;
        int x = ((HandledScreenAccessor) handledScreen).getX();
        int y = ((HandledScreenAccessor) handledScreen).getY();
        int w = ((HandledScreenAccessor) handledScreen).getBackgroundWidth();
        int h = ((HandledScreenAccessor) handledScreen).getBackgroundHeight();
        // why is this even a thing
        if (h > 166)
            --h;
        this.x = x + this.index % 6 * 28 + 4;
        this.y = this.index < 6 ? y - 28 : y + h - 4;
        this.u = 28;
        this.v = (index < 6 ? 0 : 64) + (toggled ? 32 : 0);
    }
}
Also used : HandledScreenAccessor(me.xmrvizzy.skyblocker.mixin.HandledScreenAccessor) HandledScreen(net.minecraft.client.gui.screen.ingame.HandledScreen) Screen(net.minecraft.client.gui.screen.Screen) HandledScreen(net.minecraft.client.gui.screen.ingame.HandledScreen)

Aggregations

HandledScreenAccessor (me.xmrvizzy.skyblocker.mixin.HandledScreenAccessor)1 Screen (net.minecraft.client.gui.screen.Screen)1 HandledScreen (net.minecraft.client.gui.screen.ingame.HandledScreen)1