Added Quests and Real Settings (yay)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package de.fullrisk.citrusDev.mixin;
|
||||
|
||||
import io.wispforest.owo.ui.component.SliderComponent;
|
||||
import io.wispforest.owo.ui.core.OwoUIGraphics;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.components.AbstractSliderButton;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(AbstractSliderButton.class)
|
||||
public abstract class SliderComponentMixin {
|
||||
|
||||
@Inject(method = "extractWidgetRenderState", at = @At("HEAD"), cancellable = true)
|
||||
private void citrusDev$renderGlassSlider(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a, CallbackInfo ci) {
|
||||
Object self = this;
|
||||
if (!(self instanceof SliderComponent slider)) return;
|
||||
|
||||
AbstractSliderButton widget = (AbstractSliderButton) self;
|
||||
|
||||
int x = widget.getX();
|
||||
int y = widget.getY();
|
||||
int w = widget.getWidth();
|
||||
int h = widget.getHeight();
|
||||
|
||||
OwoUIGraphics owo = OwoUIGraphics.of(graphics);
|
||||
|
||||
// glass track
|
||||
owo.fill(RenderPipelines.GUI, x, y, x + w, y + h, 0x40FFFFFF);
|
||||
|
||||
// handle
|
||||
int handleWidth = 4;
|
||||
int handleX = x + (int) (slider.value() * (w - handleWidth));
|
||||
owo.fill(RenderPipelines.GUI, handleX, y, handleX + handleWidth, y + h, 0xFFFFFFFF);
|
||||
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user