Skip to content

Commit

Permalink
Fixing saving issue and getting ready for release
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkKronicle committed Oct 7, 2022
1 parent c2b2ada commit 1aa8a85
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public static ChromaOptions load(ConfigObject object, ChromaOptions defaultValue
AtomicReference<Float> size = new AtomicReference<>(defaultValue.getSize());
AtomicReference<Float> speed = new AtomicReference<>(defaultValue.getSpeed());
AtomicReference<Float> saturation = new AtomicReference<>(defaultValue.getSaturation());
// Cast from double to float is necessary since the values get loaded as Double's, and those can't be cast to floats natively
// Could techincally caste to Double then use .floatValue, but I think this works fine
// ~~Could techincally caste to Double then use .floatValue, but I think this works fine~~
// IT DID NOT WORK FINE
object.getOptional("active").ifPresent((opt) -> active.set((boolean) opt));
object.getOptional("opacity").ifPresent((opt) -> opacity.set(((float) (double) opt)));
object.getOptional("size").ifPresent((opt) -> size.set((float) (double) opt));
object.getOptional("speed").ifPresent((opt) -> speed.set((float) (double) opt));
object.getOptional("saturation").ifPresent((opt) -> saturation.set((float) (double) opt));
object.getOptional("opacity").ifPresent((opt) -> opacity.set(((Number) opt).floatValue()));
object.getOptional("size").ifPresent((opt) -> size.set(((Number) opt).floatValue()));
object.getOptional("speed").ifPresent((opt) -> speed.set(((Number) opt).floatValue()));
object.getOptional("saturation").ifPresent((opt) -> saturation.set(((Number) opt).floatValue()));
return new ChromaOptions(active.get(), opacity.get(), size.get(), speed.get(), saturation.get());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package io.github.darkkronicle.darkkore.gui;

import io.github.darkkronicle.darkkore.gui.components.Component;
import io.github.darkkronicle.darkkore.settings.DarkKoreConfig;
import io.github.darkkronicle.darkkore.util.Color;
import io.github.darkkronicle.darkkore.util.FluidText;
import io.github.darkkronicle.darkkore.util.render.RenderUtil;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralTextContent;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -22,8 +23,11 @@ public abstract class ComponentScreen extends Screen {

@Getter @Setter private Screen parent;

@Getter @Setter private Color backgroundColor;

protected ComponentScreen() {
super(new FluidText(""));
backgroundColor = DarkKoreConfig.getInstance().screenBackgroundColor.getValue();
}

public void addComponent(Component component) {
Expand Down Expand Up @@ -51,7 +55,7 @@ protected void init() {

@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
RenderUtil.drawRectangle(matrices, 0, 0, this.width, this.height, 0xB0000000);
RenderUtil.drawRectangle(matrices, 0, 0, this.width, this.height, backgroundColor);
renderComponents(matrices, mouseX, mouseY);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.github.darkkronicle.darkkore.hotkeys.HotkeySettings;
import io.github.darkkronicle.darkkore.hotkeys.HotkeySettingsOption;
import io.github.darkkronicle.darkkore.intialization.profiles.PlayerContextCheck;
import io.github.darkkronicle.darkkore.util.Color;
import io.github.darkkronicle.darkkore.util.FileUtil;
import net.minecraft.client.gui.screen.Screen;
import org.lwjgl.glfw.GLFW;
Expand Down Expand Up @@ -35,11 +36,14 @@ public class DarkKoreConfig extends ModConfig {

public final DoubleOption scrollScale = new DoubleOption("scrollScale", "darkkore.option.scrollscale", "darkkore.option.info.scrollscale", .3, 0.01, 10);

public final ExtendedColorOption hoverColor = new ExtendedColorOption("hoverColor", "darkkore.option.hovercolor", "darkkore.option.info.scrollscale",
public final ExtendedColorOption hoverColor = new ExtendedColorOption("hoverColor", "darkkore.option.hovercolor", "darkkore.option.info.hovercolor",
new ExtendedColor(Colors.getInstance().getColorOrWhite("option_background_hover"), ExtendedColor.ChromaOptions.getDefault()));

public final ExtendedColorOption screenBackgroundColor = new ExtendedColorOption("screenBackgroundColor", "darkkore.option.screenbackgroundcolor", "darkkore.option.info.screenbackgroundcolor",
new ExtendedColor(new Color(0xB0000000), ExtendedColor.ChromaOptions.getDefault()));

public final OptionSection gui = new OptionSection("gui", "darkkore.option.section.gui", "darkkore.option.section.info.gui",
List.of(scrollScale, hoverColor));
List.of(scrollScale, hoverColor, screenBackgroundColor));

public static DarkKoreConfig getInstance() {
return INSTANCE;
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/assets/darkkore/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"darkkore.optiontype.info.hotkey": "Click on the hotkey and type a combination",
"darkkore.optiontype.info.konstruct": "Type Konstruct script in here",
"darkkore.optiontype.info.color": "Type a hex color in the format #AARRGGBB here",
"darkkore.optiontype.info.extendedcolor": "Type a hex color in the format #AARRGGBB here. You can also click the gear icon to add special affect to the color like chroma",
"darkkore.optiontype.info.extendedcolor": "Type a hex color in the format #AARRGGBB here. You can also click the gear icon to add special effects to the color like chroma",
"darkkore.optiontype.info.optionsection": "Click configure to see a list of options",
"darkkore.button.configure": "Configure",

Expand All @@ -33,6 +33,10 @@
"darkkore.option.info.scrollscale": "The coefficient to which a &6scroll input is multiplied to&r\nEquivalent to the &6Scroll Sensitivity&r option in Vanilla Minecraft",
"darkkore.option.changevanillaoptions": "Override Vanilla Button Sounds",
"darkkore.option.info.changevanillaoptions": "Makes it so that &6Minecraft's buttons&r use &6DarkKore's&r sound effects",
"darkkore.option.hovercolor": "Option Hover Color",
"darkkore.option.info.hovercolor": "The hover color for options in DarkKore menus",
"darkkore.option.screenbackgroundcolor": "Config Background Color",
"darkkore.option.info.screenbackgroundcolor": "The background color for DarkKore configuration screens",

"darkkore.option.hotkey.blocking": "Block Other Inputs",
"darkkore.option.hotkey.info.blocking": "Whether activating this hotkey prevents &6other inputs from being accepted&r",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() {

gl_Position = ProjMat * ModelViewMat * vertex;
float dist = gl_Position.x + gl_Position.y;
float size = 150 * (1 - ColorModulator[0]);
float size = 50 * (1 - ColorModulator[0]);
float speed = 5000 * ColorModulator[1];
float saturation = ColorModulator[2];

Expand All @@ -26,7 +26,7 @@ void main() {
dist = 0;
}

dist = dist / size;
dist = dist * size;

vec4 colorInbetween = (
(.6 + .6 * cos((dist + GameTime * speed) + vec4(0, 23, 21, 0)))
Expand Down

0 comments on commit 1aa8a85

Please sign in to comment.