Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import com.gtnewhorizon.gtnhlib.blockpos.IBlockPos;
import com.hfstudio.guidenh.config.ModConfig;
import com.hfstudio.guidenh.guide.color.ColorUtils;
import com.hfstudio.guidenh.guide.internal.GuidebookText;
import com.hfstudio.guidenh.guide.internal.item.RegionWandExporter;
import com.hfstudio.guidenh.guide.internal.item.RegionWandExporter.SelectionAction;
Expand Down Expand Up @@ -176,11 +177,11 @@ private static void drawTargetPreview(int x, int y, int z) {

GL11.glLineWidth(3f);
GL11.glBegin(GL11.GL_LINES);
GL11.glColor4f(1f, 0.2f, 0.2f, 0.95f);
ColorUtils.applyGlColor(ColorUtils.REGION_X_AXIS.getColor());
line(cx - radius, cy, cz, cx + radius, cy, cz);
GL11.glColor4f(0.25f, 1f, 0.25f, 0.95f);
ColorUtils.applyGlColor(ColorUtils.REGION_Y_AXIS.getColor());
line(cx, cy - radius, cz, cx, cy + radius, cz);
GL11.glColor4f(0.25f, 0.45f, 1f, 0.95f);
ColorUtils.applyGlColor(ColorUtils.REGION_Z_AXIS.getColor());
line(cx, cy, cz - radius, cx, cy, cz + radius);
GL11.glEnd();
GL11.glLineWidth(2f);
Expand Down
13 changes: 4 additions & 9 deletions src/main/java/com/hfstudio/guidenh/config/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@ public static class Debug {
@DefaultBoolean(true)
public boolean showMousePosition = true;

@Comment("Debug text color (ARGB format)")
public int debugTextColor = 0xFFC47BA1;

@Comment("Debug outline border color (ARGB format, 0 to mirror text color)")
public int debugOutlineColor = 0;

@Comment("Debug cursor dot color (ARGB format)")
public int debugCursorColor = 0xCC00FF00;

@Comment("Debug text scale factor")
@DefaultFloat(0.8f)
@RangeFloat(min = 0.5f, max = 2.0f)
Expand Down Expand Up @@ -188,6 +179,10 @@ public static class Ui {
@DefaultBoolean(false)
public boolean sceneEditorAutoPickEnabled = false;

@Comment("Whether exporting SNBT from the scene editor also opens the exported structure folder.")
@DefaultBoolean(false)
public boolean sceneEditorExportOpenFolderAfterExport = false;

@Comment("Whether point snapping is enabled in the scene editor by default.")
@DefaultBoolean(true)
public boolean sceneEditorSnapPointEnabled = true;
Expand Down
60 changes: 0 additions & 60 deletions src/main/java/com/hfstudio/guidenh/guide/color/ARGB.java

This file was deleted.

516 changes: 516 additions & 0 deletions src/main/java/com/hfstudio/guidenh/guide/color/ColorUtils.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ public interface ColorValue {
/**
* Resolve as ARGB 32-bit.
*/
int resolve(LightDarkMode lightDarkMode);
int resolve();
}
86 changes: 0 additions & 86 deletions src/main/java/com/hfstudio/guidenh/guide/color/Colors.java

This file was deleted.

16 changes: 6 additions & 10 deletions src/main/java/com/hfstudio/guidenh/guide/color/ConstantColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
import com.github.bsideup.jabel.Desugar;

@Desugar
public record ConstantColor(int lightModeColor, int darkModeColor) implements ColorValue {
public record ConstantColor(int color) implements ColorValue {

public static ConstantColor WHITE = new ConstantColor(-1, -1);
public static ConstantColor WHITE = ColorUtils.constant(ColorUtils.WHITE);

public static ConstantColor BLACK = new ConstantColor(0xFF000000, 0xFF000000);
public static ConstantColor BLACK = new ConstantColor(ColorUtils.BLACK.getColor());

public static ConstantColor TRANSPARENT = new ConstantColor(0, 0);

public ConstantColor(int color) {
this(color, color);
}
public static ConstantColor TRANSPARENT = ColorUtils.constant(ColorUtils.TRANSPARENT);

@Override
public int resolve(LightDarkMode lightDarkMode) {
return lightDarkMode == LightDarkMode.LIGHT_MODE ? lightModeColor : darkModeColor;
public int resolve() {
return color;
}
}
11 changes: 0 additions & 11 deletions src/main/java/com/hfstudio/guidenh/guide/color/LightDarkMode.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public LightnessFunction(ColorValue color, float percentage) {
}

@Override
public int resolve(LightDarkMode lightDarkMode) {
var mutableColor = MutableColor.of(color, lightDarkMode);
public int resolve() {
var mutableColor = MutableColor.of(color);
if (percentage < 0) {
mutableColor.darker(-percentage);
} else if (percentage > 0) {
Expand Down
20 changes: 8 additions & 12 deletions src/main/java/com/hfstudio/guidenh/guide/color/MutableColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public MutableColor(float r, float g, float b, float a) {
}

public static MutableColor ofArgb32(int packedColor) {
var r = ARGB.red(packedColor);
var g = ARGB.green(packedColor);
var b = ARGB.blue(packedColor);
var a = ARGB.alpha(packedColor);
var r = ColorUtils.red(packedColor);
var g = ColorUtils.green(packedColor);
var b = ColorUtils.blue(packedColor);
var a = ColorUtils.alpha(packedColor);
return MutableColor.ofBytes(r, g, b, a);
}

Expand All @@ -47,16 +47,12 @@ public static MutableColor ofBytes(int r, int g, int b, int a) {
/**
* Resolves a symbolic color value and copies it into a new mutable color.
*/
public static MutableColor of(ColorValue color, LightDarkMode mode) {
return ofArgb32(color.resolve(mode));
public static MutableColor of(ColorValue color) {
return ofArgb32(color.resolve());
}

public int toArgb32() {
return ARGB.color(alphaByte(), redByte(), greenByte(), blueByte());
}

public int toAbgr32() {
return ARGB.color(alphaByte(), redByte(), greenByte(), blueByte());
return ColorUtils.argb(alphaByte(), redByte(), greenByte(), blueByte());
}

public float red() {
Expand Down Expand Up @@ -194,7 +190,7 @@ public MutableColor copy() {
}

@Override
public int resolve(LightDarkMode lightDarkMode) {
public int resolve() {
return toArgb32();
}
}
70 changes: 0 additions & 70 deletions src/main/java/com/hfstudio/guidenh/guide/color/SymbolicColor.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.hfstudio.guidenh.guide.color;

import java.util.Locale;

import net.minecraft.util.ResourceLocation;

import org.jetbrains.annotations.Nullable;
Expand All @@ -27,16 +25,17 @@ public interface SymbolicColorResolver extends Extension {
ColorValue resolve(ResourceLocation id);

/**
* Helper to resolve a symbolic color from both the pre-defined colors in {@link SymbolicColor}, as well as
* Helper to resolve a symbolic color from the pre-defined colors in {@link ColorUtils}, as well as
* user-supplied symbolic color resolvers.
*
* @return null when the color cannot be resolved.
*/
@Nullable
static ColorValue resolve(PageCompiler compiler, String id) {
try {
return SymbolicColor.valueOf(id.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException ignored) {}
ColorValue builtIn = ColorUtils.symbolic(id);
if (builtIn != null) {
return builtIn;
}

// See if it's an identifier
ResourceLocation identifier;
Expand Down
Loading