-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b941f6
commit 2633d3a
Showing
11 changed files
with
184 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
src/main/java/wtf/cheeze/sbt/features/BrewingStandOverlay.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package wtf.cheeze.sbt.features; | ||
|
||
import dev.isxander.yacl3.api.Option; | ||
import dev.isxander.yacl3.api.OptionDescription; | ||
import dev.isxander.yacl3.api.OptionGroup; | ||
import dev.isxander.yacl3.config.v2.api.SerialEntry; | ||
import net.minecraft.client.font.TextRenderer; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.screen.slot.Slot; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.collection.DefaultedList; | ||
import wtf.cheeze.sbt.SkyblockTweaks; | ||
import wtf.cheeze.sbt.config.ConfigImpl; | ||
import wtf.cheeze.sbt.config.SkyblockTweaksConfig; | ||
import wtf.cheeze.sbt.utils.render.RenderUtils; | ||
|
||
public class BrewingStandOverlay { | ||
|
||
private static final int DRAW_OFFSET_X = 20; | ||
private static final int DRAW_OFFSET_Y = 4; | ||
// One more than the z offset that items are rendered at | ||
private static final float Z_OFFSET = 250.0f; | ||
|
||
public static void render(DefaultedList<Slot> slots, DrawContext context) { | ||
if (!SkyblockTweaks.CONFIG.config.brewingStandOverlay.enabled) return; | ||
|
||
var slot13 = slots.get(13); | ||
var slot24 = slots.get(24); | ||
var slot42 = slots.get(42); | ||
|
||
context.getMatrices().push(); | ||
context.getMatrices().translate(0.0f, 0.0f, Z_OFFSET); | ||
|
||
if (slot13.hasStack()) { | ||
drawName(slot13, context); | ||
} | ||
if (!slot24.getStack().getName().getString().startsWith("Place Water Bottles")) { | ||
drawName(slot24, context); | ||
} | ||
if (slot42.hasStack()) { | ||
drawName(slot42, context); | ||
} | ||
context.getMatrices().pop(); | ||
} | ||
|
||
private static void drawName(Slot slot, DrawContext context) { | ||
var name = slot.getStack().getName(); | ||
var color = name.getStyle().getColor(); | ||
int rcolor; | ||
if (color == null) { | ||
rcolor = 0xFFFFFF; | ||
} else { | ||
rcolor = color.getRgb(); | ||
} | ||
RenderUtils.drawString(context, name, slot.x + DRAW_OFFSET_X, slot.y + DRAW_OFFSET_Y, rcolor, false); | ||
} | ||
|
||
public static class Config { | ||
@SerialEntry | ||
public boolean enabled = true; | ||
|
||
public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) { | ||
var enabled = Option.<Boolean>createBuilder() | ||
.name(Text.literal("Brewing Stand Overlay")) | ||
.description(OptionDescription.of(Text.literal("Enables the overlay for the brewing stand"))) | ||
.controller(SkyblockTweaksConfig::generateBooleanController) | ||
.binding( | ||
defaults.brewingStandOverlay.enabled, | ||
() -> config.brewingStandOverlay.enabled, | ||
value -> config.brewingStandOverlay.enabled = (Boolean) value | ||
) | ||
.build(); | ||
|
||
return OptionGroup.createBuilder() | ||
.name(Text.literal("Brewing Stand Overlay")) | ||
.description(OptionDescription.of(Text.literal("Options for the brewing stand overlay"))) | ||
.option(enabled) | ||
.build(); | ||
|
||
|
||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package wtf.cheeze.sbt.utils.render; | ||
|
||
public class Color3f { | ||
|
||
public float red; | ||
public float green; | ||
public float blue; | ||
|
||
Color3f (int color) { | ||
this.red = (float) (color >> 16 & 255) / 255.0F; | ||
this.green = (float) (color >> 8 & 255) / 255.0F; | ||
this.blue = (float) (color & 255) / 255.0F; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/wtf/cheeze/sbt/utils/render/ScreenBounds.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package wtf.cheeze.sbt.utils.render; | ||
|
||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.util.Window; | ||
|
||
public class ScreenBounds { | ||
public int width; | ||
public int height; | ||
|
||
ScreenBounds() { | ||
Window window = MinecraftClient.getInstance().getWindow(); | ||
this.width = window.getScaledWidth(); | ||
this.height = window.getScaledHeight(); | ||
} | ||
} |