Skip to content

Commit

Permalink
Use the new Vec2dConfig for the Light Level Overlay offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
maruohon committed Apr 10, 2022
1 parent 17b49c4 commit 4e0ff5c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
9 changes: 9 additions & 0 deletions src/main/java/fi/dy/masa/minihud/config/ConfigCallbacks.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ public static void init()
Configs.Colors.BEACON_RANGE_LVL2_OVERLAY_COLOR.addValueChangeListener(beaconUpdateCallback);
Configs.Colors.BEACON_RANGE_LVL3_OVERLAY_COLOR.addValueChangeListener(beaconUpdateCallback);
Configs.Colors.BEACON_RANGE_LVL4_OVERLAY_COLOR.addValueChangeListener(beaconUpdateCallback);
Configs.Generic.LIGHT_LEVEL_COLORED_NUMBERS.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_MARKER_MODE.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_MARKER_SIZE.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_NUMBER_MODE.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_NUMBER_OFFSET_BLOCK.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_NUMBER_OFFSET_SKY.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_NUMBER_ROTATION.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_RANGE.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_THRESHOLD.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.LIGHT_LEVEL_Z_OFFSET.addValueChangeListener(lightLevelUpdateCallback);
Configs.Generic.STRUCTURES_RENDER_THROUGH.setValueChangeCallback((newValue, oldValue) -> RenderContainer.STRUCTURE_BOUNDING_BOXES_OVERLAY.setRenderThrough(newValue));
Configs.Generic.WOOL_COUNTER_TYPES.setValueLoadCallback(DataStorage.getInstance().getWoolCounters()::updateEnabledCounters);
Configs.Generic.WOOL_COUNTER_TYPES.setValueChangeCallback((newValue, oldValue) -> {
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/fi/dy/masa/minihud/config/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import fi.dy.masa.malilib.config.option.IntegerConfig;
import fi.dy.masa.malilib.config.option.OptionListConfig;
import fi.dy.masa.malilib.config.option.StringConfig;
import fi.dy.masa.malilib.config.option.Vec2dConfig;
import fi.dy.masa.malilib.config.value.ScreenLocation;
import fi.dy.masa.malilib.input.Hotkey;
import fi.dy.masa.malilib.input.KeyBindSettings;
Expand Down Expand Up @@ -46,10 +47,8 @@ public static class Generic
public static final IntegerConfig ITEM_PREVIEW_Z = new IntegerConfig("itemPreviewZ", 400, 0, 4096);
public static final BooleanConfig LIGHT_LEVEL_COLORED_NUMBERS = new BooleanConfig("lightLevelColoredNumbers", true);
public static final DoubleConfig LIGHT_LEVEL_MARKER_SIZE = new DoubleConfig( "lightLevelMarkerSize", 0.84, 0.0, 1.0);
public static final DoubleConfig LIGHT_LEVEL_NUMBER_OFFSET_BLOCK_X = new DoubleConfig( "lightLevelNumberOffsetBlockX", 0.09, 0.0, 1.0);
public static final DoubleConfig LIGHT_LEVEL_NUMBER_OFFSET_BLOCK_Y = new DoubleConfig( "lightLevelNumberOffsetBlockY", 0.12, 0.0, 1.0);
public static final DoubleConfig LIGHT_LEVEL_NUMBER_OFFSET_SKY_X = new DoubleConfig( "lightLevelNumberOffsetSkyX", 0.42, 0.0, 1.0);
public static final DoubleConfig LIGHT_LEVEL_NUMBER_OFFSET_SKY_Y = new DoubleConfig( "lightLevelNumberOffsetSkyY", 0.56, 0.0, 1.0);
public static final Vec2dConfig LIGHT_LEVEL_NUMBER_OFFSET_BLOCK = new Vec2dConfig( "lightLevelNumberOffsetBlock", 0.24, 0.32, 0.0, 1.0);
public static final Vec2dConfig LIGHT_LEVEL_NUMBER_OFFSET_SKY = new Vec2dConfig( "lightLevelNumberOffsetSky", 0.42, 0.56, 0.0, 1.0);
public static final BooleanConfig LIGHT_LEVEL_NUMBER_ROTATION = new BooleanConfig("lightLevelNumberRotation", true);
public static final IntegerConfig LIGHT_LEVEL_RANGE = new IntegerConfig("lightLevelRange", 24, 1, 64);
public static final IntegerConfig LIGHT_LEVEL_THRESHOLD = new IntegerConfig("lightLevelThreshold", 8, 0, 15);
Expand Down Expand Up @@ -103,10 +102,8 @@ public static class Generic
LIGHT_LEVEL_MARKER_MODE,
LIGHT_LEVEL_MARKER_SIZE,
LIGHT_LEVEL_NUMBER_MODE,
LIGHT_LEVEL_NUMBER_OFFSET_BLOCK_X,
LIGHT_LEVEL_NUMBER_OFFSET_BLOCK_Y,
LIGHT_LEVEL_NUMBER_OFFSET_SKY_X,
LIGHT_LEVEL_NUMBER_OFFSET_SKY_Y,
LIGHT_LEVEL_NUMBER_OFFSET_BLOCK,
LIGHT_LEVEL_NUMBER_OFFSET_SKY,
LIGHT_LEVEL_NUMBER_ROTATION,
LIGHT_LEVEL_RANGE,
LIGHT_LEVEL_THRESHOLD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import net.minecraft.world.WorldEntitySpawner;
import net.minecraft.world.chunk.Chunk;
import fi.dy.masa.malilib.config.option.ColorConfig;
import fi.dy.masa.malilib.config.option.DoubleConfig;
import fi.dy.masa.malilib.config.option.Vec2dConfig;
import fi.dy.masa.malilib.render.overlay.BaseRenderObject;
import fi.dy.masa.malilib.render.overlay.VboRenderObject;
import fi.dy.masa.malilib.util.data.Color4f;
Expand Down Expand Up @@ -106,8 +106,7 @@ private void renderLightLevels(Vec3d cameraPos, Minecraft mc, BufferBuilder buff
if (numberMode == LightLevelNumberMode.BLOCK || numberMode == LightLevelNumberMode.BOTH)
{
this.renderNumbers(cameraPos, LightLevelNumberMode.BLOCK,
Configs.Generic.LIGHT_LEVEL_NUMBER_OFFSET_BLOCK_X,
Configs.Generic.LIGHT_LEVEL_NUMBER_OFFSET_BLOCK_Y,
Configs.Generic.LIGHT_LEVEL_NUMBER_OFFSET_BLOCK,
Configs.Colors.LIGHT_LEVEL_NUMBER_BLOCK_LIT,
Configs.Colors.LIGHT_LEVEL_NUMBER_BLOCK_DARK,
useColoredNumbers, lightThreshold, numberFacing, bufferQuads);
Expand All @@ -116,8 +115,7 @@ private void renderLightLevels(Vec3d cameraPos, Minecraft mc, BufferBuilder buff
if (numberMode == LightLevelNumberMode.SKY || numberMode == LightLevelNumberMode.BOTH)
{
this.renderNumbers(cameraPos, LightLevelNumberMode.SKY,
Configs.Generic.LIGHT_LEVEL_NUMBER_OFFSET_SKY_X,
Configs.Generic.LIGHT_LEVEL_NUMBER_OFFSET_SKY_Y,
Configs.Generic.LIGHT_LEVEL_NUMBER_OFFSET_SKY,
Configs.Colors.LIGHT_LEVEL_NUMBER_SKY_LIT,
Configs.Colors.LIGHT_LEVEL_NUMBER_SKY_DARK,
useColoredNumbers, lightThreshold, numberFacing, bufferQuads);
Expand All @@ -134,12 +132,12 @@ else if (markerMode == LightLevelMarkerMode.CROSS)
}
}

private void renderNumbers(Vec3d cameraPos, LightLevelNumberMode mode, DoubleConfig cfgOffX, DoubleConfig cfgOffZ,
private void renderNumbers(Vec3d cameraPos, LightLevelNumberMode mode, Vec2dConfig cfgOff,
ColorConfig cfgColorLit, ColorConfig cfgColorDark, boolean useColoredNumbers,
int lightThreshold, EnumFacing numberFacing, BufferBuilder buffer)
{
double ox = cfgOffX.getDoubleValue();
double oz = cfgOffZ.getDoubleValue();
double ox = cfgOff.getValue().x;
double oz = cfgOff.getValue().y;
double tmpX, tmpZ;
Color4f colorLit, colorDark;
double offsetY = Configs.Generic.LIGHT_LEVEL_Z_OFFSET.getDoubleValue();
Expand Down
12 changes: 4 additions & 8 deletions src/main/resources/assets/minihud/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ minihud.config.comment.itempreviewz=The rendering z-position (height compared to
minihud.config.comment.lightlevelcolorednumbers=Whether to use colored/tinted numbers for the Light Level Overlay.\n\nIf disabled, then the number texture is not tinted, but used as-is. By default the texture is white.
minihud.config.comment.lightlevelmarkers=Which type of colored marker to use in the Light Level Overlay, if any, for the spawnable (= dark) positions
minihud.config.comment.lightlevelmarkersize=The size of the Light Level Overlay colored marker
minihud.config.comment.lightlevelnumberoffsetblockx=The relative "x" or "sideways" offset for the block light level number
minihud.config.comment.lightlevelnumberoffsetblocky=The relative "y" or "up/down" offset for the block light level number
minihud.config.comment.lightlevelnumberoffsetskyx=The relative "x" or "sideways" offset for the sky light level number
minihud.config.comment.lightlevelnumberoffsetskyy=The relative "y" or "up/down" offset for the sky light level number
minihud.config.comment.lightlevelnumberoffsetblock=The relative offset for the block light level number within the block space
minihud.config.comment.lightlevelnumberoffsetsky=The relative offset for the sky light level number within the block space
minihud.config.comment.lightlevelnumberrotation=If enabled, then the Light Level Overlay numbers will rotate to match the player's current facing
minihud.config.comment.lightlevelnumbers=Which light level number(s) to render in the Light Level overlay
minihud.config.comment.lightlevelrange=The block range to render the Light Level Overlay in.\n\n§eNote:§r A larger radius will cause a longer/more noticeable lag spike when updating the overlay. The update happens automatically after any block changes, or when the player moves a little bit.
Expand Down Expand Up @@ -123,10 +121,8 @@ minihud.config.name.itempreviewz=Map/Shulker Preview Render Z
minihud.config.name.lightlevelcolorednumbers=Light Level Colored Numbers
minihud.config.name.lightlevelmarkers=Light Level Markers Mode
minihud.config.name.lightlevelmarkersize=Light Level Marker Size
minihud.config.name.lightlevelnumberoffsetblockx=Light Level Number Offset Block X
minihud.config.name.lightlevelnumberoffsetblocky=Light Level Number Offset Block Y
minihud.config.name.lightlevelnumberoffsetskyx=Light Level number Offset Sky X
minihud.config.name.lightlevelnumberoffsetskyy=Light Level number Offset Sky Y
minihud.config.name.lightlevelnumberoffsetblock=Light Level Number Offset (Block)
minihud.config.name.lightlevelnumberoffsetsky=Light Level number Offset (Sky)
minihud.config.name.lightlevelnumberrotation=Light Level Number Rotation
minihud.config.name.lightlevelnumbers=Light Level Numbers Mode
minihud.config.name.lightlevelrange=Light Level Range
Expand Down

0 comments on commit 4e0ff5c

Please sign in to comment.