/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.jspecify.annotations.Nullable */ package net.minecraft.client.gui.components; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.WidgetSprites; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.client.renderer.RenderPipelines; import net.minecraft.network.chat.CommonComponents; import org.jspecify.annotations.Nullable; public class StateSwitchingButton extends AbstractWidget { protected @Nullable WidgetSprites sprites; protected boolean isStateTriggered; public StateSwitchingButton(int x, int y, int width, int height, boolean isStateTriggered) { super(x, y, width, height, CommonComponents.EMPTY); this.isStateTriggered = isStateTriggered; } public void initTextureValues(WidgetSprites sprites) { this.sprites = sprites; } public void setStateTriggered(boolean isStateTriggered) { this.isStateTriggered = isStateTriggered; } public boolean isStateTriggered() { return this.isStateTriggered; } @Override public void updateWidgetNarration(NarrationElementOutput output) { this.defaultButtonNarrationText(output); } @Override public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float a) { if (this.sprites == null) { return; } graphics.blitSprite(RenderPipelines.GUI_TEXTURED, this.sprites.get(this.isStateTriggered, this.isHoveredOrFocused()), this.getX(), this.getY(), this.width, this.height); } }