Skip to content

Commit

Permalink
sync from sakura-ryoko/minihud
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Jul 9, 2024
1 parent dcdb6d9 commit 48c91d9
Show file tree
Hide file tree
Showing 53 changed files with 2,561 additions and 572 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ org.gradle.jvmargs=-Xmx1G
loom.platform=neoforge

# Base properties
minecraft_version=1.20.6
neoforge_version=20.6.119
yarn_mappings=1.20.6+build.3
yarn_patch=1.20.6+build.4
minecraft_version=1.21
neoforge_version=21.0.77-beta
yarn_mappings=1.21+build.2
yarn_patch=1.21+build.4

# Mod Properties
mod_version=0.1.3
Expand All @@ -19,5 +19,5 @@ loom.platform=neoforge
curseforge_id=916504

# Dependencies
malilib_version=0.1.12-mc1.20.6
neonetwork_version=0.1.5+mc1.20.6
malilib_version=0.1.14-mc1.21
neonetwork_version=0.1.5+mc1.21
3 changes: 3 additions & 0 deletions src/main/java/fi/dy/masa/minihud/InitHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import fi.dy.masa.malilib.event.*;
import fi.dy.masa.malilib.interfaces.IInitializationHandler;
import fi.dy.masa.minihud.config.Configs;
import fi.dy.masa.minihud.data.EntitiesDataStorage;
import fi.dy.masa.minihud.event.*;
import fi.dy.masa.minihud.hotkeys.KeyCallbacks;
import fi.dy.masa.minihud.util.DataStorage;
Expand All @@ -15,6 +16,7 @@ public void registerModHandlers()
{
ConfigManager.getInstance().registerConfigHandler(Reference.MOD_ID, new Configs());
DataStorage.getInstance().onGameInit();
EntitiesDataStorage.getInstance().onGameInit();

InputEventHandler.getKeybindManager().registerKeybindProvider(InputHandler.getInstance());
InputEventHandler.getInputManager().registerMouseInputHandler(InputHandler.getInstance());
Expand All @@ -32,6 +34,7 @@ public void registerModHandlers()
ServerHandler.getInstance().registerServerHandler(serverListener);

TickHandler.getInstance().registerClientTickHandler(new ClientTickHandler());
TickHandler.getInstance().registerClientTickHandler(EntitiesDataStorage.getInstance());

KeyCallbacks.init();
}
Expand Down
53 changes: 34 additions & 19 deletions src/main/java/fi/dy/masa/minihud/config/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import fi.dy.masa.malilib.config.ConfigUtils;
import fi.dy.masa.malilib.config.HudAlignment;
import fi.dy.masa.malilib.config.IConfigBase;
import fi.dy.masa.malilib.config.IConfigHandler;
import fi.dy.masa.malilib.config.IConfigValue;
import fi.dy.masa.malilib.config.options.ConfigBoolean;
import fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed;
import fi.dy.masa.malilib.config.options.ConfigColor;
import fi.dy.masa.malilib.config.options.ConfigDouble;
import fi.dy.masa.malilib.config.options.ConfigHotkey;
import fi.dy.masa.malilib.config.options.ConfigInteger;
import fi.dy.masa.malilib.config.options.ConfigOptionList;
import fi.dy.masa.malilib.config.options.ConfigString;
import fi.dy.masa.malilib.config.*;
import fi.dy.masa.malilib.config.options.*;
import fi.dy.masa.malilib.hotkeys.IHotkey;
import fi.dy.masa.malilib.hotkeys.KeyAction;
import fi.dy.masa.malilib.hotkeys.KeybindSettings;
import fi.dy.masa.malilib.util.FileUtils;
import fi.dy.masa.malilib.util.JsonUtils;
Expand Down Expand Up @@ -53,9 +43,13 @@ public static class Generic
public static final ConfigBoolean DEBUG_MESSAGES = new ConfigBoolean("debugMessages", false, "Enables some debug messages in the game console");
//public static final ConfigBoolean DEBUG_RENDERER_PATH_MAX_DIST = new ConfigBoolean("debugRendererPathFindingEnablePointWidth", true, "If true, then the vanilla pathfinding debug renderer\nwill render the path point width boxes.");
public static final ConfigBoolean DONT_RESET_SEED_ON_DIMENSION_CHANGE = new ConfigBoolean("dontClearStoredSeedOnDimensionChange", true, "Don't clear the stored world seed when just changing dimensions.\nSome mods may use per-dimension seeds, so you may need to change\nthis in case the different dimensions on your server/mod pack\nhave different world seeds.");
public static final ConfigBoolean FIX_VANILLA_DEBUG_RENDERERS = new ConfigBoolean("enableVanillaDebugRendererFix", true, "If true, then the vanilla debug renderer OpenGL state is fixed.");
public static final ConfigBoolean ENTITY_DATA_SYNC = new ConfigBoolean("entityDataSync", true, "Use the Entity Data Sync protocol from Servux\nto obtain Entity Data from the server");
public static final ConfigBoolean ENTITY_DATA_SYNC_BACKUP = new ConfigBoolean("entityDataSyncBackup", true, "Use the Vanilla NBT Query method when Servux\nis not available. This method requires Operator Privileges.");
//public static final ConfigBoolean FIX_VANILLA_DEBUG_RENDERERS = new ConfigBoolean("enableVanillaDebugRendererFix", true, "If true, then the vanilla debug renderer OpenGL state is fixed.");
public static final ConfigDouble FONT_SCALE = new ConfigDouble("fontScale", 0.5, 0.01, 100.0, "Font scale factor for the info line HUD. Default: 0.5\n");
public static final ConfigOptionList HUD_ALIGNMENT = new ConfigOptionList("hudAlignment", HudAlignment.TOP_LEFT, "The alignment of the info line HUD");
public static final ConfigHotkey INVENTORY_PREVIEW = new ConfigHotkey("inventoryPreview", "LEFT_ALT", KeybindSettings.PRESS_ALLOWEXTRA, "The key to activate the inventory preview feature");
public static final ConfigHotkey INVENTORY_PREVIEW_TOGGLE_SCREEN = new ConfigHotkey("inventoryPreviewToggleScreen", "BUTTON_3", KeybindSettings.create(KeybindSettings.Context.ANY, KeyAction.PRESS, true, true, false, true), "Open a screen for inventory preview\nYou can use your mouse to see tooltips");
public static final ConfigBoolean LIGHT_LEVEL_AUTO_HEIGHT = new ConfigBoolean("lightLevelAutoHeight", false, "If enabled, then the Light Level overlay will be\nautomatically raised to render on top of the block's shape.\n§6Note: This will make the overlay also render\n§6on top of things like slabs, where mobs will not be able to spawn,\n§6unless you turn on the collision check option as well.");
public static final ConfigBoolean LIGHT_LEVEL_COLORED_NUMBERS = new ConfigBoolean("lightLevelColoredNumbers", true, "Whether to use colored or white numbers\nfor the Light Level overlay numbers");
public static final ConfigBoolean LIGHT_LEVEL_COLLISION_CHECK = new ConfigBoolean("lightLevelCollisionCheck", false, "If enabled, then the Light Level overlay is not rendered\nif there is any block with a collision box in the way.\n§6Note: This is not a proper check for spawnability!\n§6This would omit any block even partially sticking into the lower spawn block!\n§6For example open trapdoors or doors would prevent the overlay from showing.");
Expand Down Expand Up @@ -85,6 +79,7 @@ public static class Generic
public static final ConfigHotkey OPEN_CONFIG_GUI = new ConfigHotkey("openConfigGui", "H,C", "A hotkey to open the in-game Config GUI");
public static final ConfigBoolean REQUIRE_SNEAK = new ConfigBoolean("requireSneak", false, "Require the player to be sneaking to render the info line HUD");
public static final ConfigHotkey REQUIRED_KEY = new ConfigHotkey("requiredKey", "", KeybindSettings.MODIFIER_INGAME_EMPTY, "Require holding this key to render the HUD");
public static final ConfigInteger SERVER_NBT_REQUEST_RATE = new ConfigInteger("serverNbtRequestRate", 2, "Limit request rate for server entity data syncer");
public static final ConfigHotkey SET_DISTANCE_REFERENCE_POINT = new ConfigHotkey("setDistanceReferencePoint", "", "A hotkey to store the player's current position\nas the reference point for the distance info line type");
public static final ConfigHotkey SHAPE_EDITOR = new ConfigHotkey("shapeEditor", "", "Opens the Shape Editor GUI for the selected shape");
public static final ConfigBoolean SHULKER_BOX_PREVIEW = new ConfigBoolean("shulkerBoxPreview", false, "Enables rendering a preview of the Shulker Box contents,\nwhen you hold shift while hovering over a Shulker Box item");
Expand All @@ -103,6 +98,11 @@ public static class Generic
public static final ConfigBoolean USE_CUSTOMIZED_COORDINATES = new ConfigBoolean("useCustomizedCoordinateFormat", true, "Use the customized coordinate format string");
public static final ConfigBoolean USE_FONT_SHADOW = new ConfigBoolean("useFontShadow", false, "Use font shadow");
public static final ConfigBoolean USE_TEXT_BACKGROUND = new ConfigBoolean("useTextBackground", true, "Use a solid background color behind the text");
public static final ConfigBoolean VILLAGER_CONVERSION_TICKS = new ConfigBoolean("villagerConversionTicks", true, "Show the conversion ticks for zombie villagers");
public static final ConfigBoolean VILLAGER_OFFER_ENCHANTMENT_BOOKS = new ConfigBoolean("villagerOfferEnchantmentBooks", true, "Show villager offers for enchanted books");
public static final ConfigBoolean VILLAGER_OFFER_HIGHEST_LEVEL_ONLY = new ConfigBoolean("villagerOfferHighestLevelOnly", false, "Show only villager offers for the highest level enchanted books");
public static final ConfigBoolean VILLAGER_OFFER_LOWEST_PRICE_NEARBY = new ConfigBoolean("villagerOfferLowestPriceNearby" , false, "Only show villager offers with the lowest price for the same enchantment");
public static final ConfigDouble VILLAGER_OFFER_PRICE_THRESHOLD = new ConfigDouble("villagerOfferPriceThreshold", 1, 0, 1, "Only show villager offers with prices below this ratio\nSet to 1.0 to display all offers");

public static final ImmutableList<IConfigBase> OPTIONS = ImmutableList.of(
AXOLOTL_TOOLTIPS,
Expand All @@ -112,7 +112,9 @@ public static class Generic
DEBUG_MESSAGES,
//DEBUG_RENDERER_PATH_MAX_DIST,
DONT_RESET_SEED_ON_DIMENSION_CHANGE,
FIX_VANILLA_DEBUG_RENDERERS,
ENTITY_DATA_SYNC,
ENTITY_DATA_SYNC_BACKUP,
//FIX_VANILLA_DEBUG_RENDERERS,
LIGHT_LEVEL_AUTO_HEIGHT,
LIGHT_LEVEL_COLLISION_CHECK,
LIGHT_LEVEL_COLORED_NUMBERS,
Expand All @@ -139,6 +141,7 @@ public static class Generic
MOVE_SHAPE_TO_PLAYER,
OPEN_CONFIG_GUI,
REQUIRED_KEY,
SERVER_NBT_REQUEST_RATE,
SET_DISTANCE_REFERENCE_POINT,
SHAPE_EDITOR,

Expand Down Expand Up @@ -172,7 +175,14 @@ public static class Generic
TEXT_POS_X,
TEXT_POS_Y,
TIME_DAY_DIVISOR,
TIME_TOTAL_DIVISOR
TIME_TOTAL_DIVISOR,
INVENTORY_PREVIEW,
INVENTORY_PREVIEW_TOGGLE_SCREEN,
VILLAGER_CONVERSION_TICKS,
VILLAGER_OFFER_ENCHANTMENT_BOOKS,
VILLAGER_OFFER_HIGHEST_LEVEL_ONLY,
VILLAGER_OFFER_LOWEST_PRICE_NEARBY,
VILLAGER_OFFER_PRICE_THRESHOLD
);

public static final List<IHotkey> HOTKEY_LIST = ImmutableList.of(
Expand All @@ -181,7 +191,9 @@ public static class Generic
OPEN_CONFIG_GUI,
REQUIRED_KEY,
SET_DISTANCE_REFERENCE_POINT,
SHAPE_EDITOR
SHAPE_EDITOR,
INVENTORY_PREVIEW,
INVENTORY_PREVIEW_TOGGLE_SCREEN
);
}

Expand Down Expand Up @@ -323,9 +335,12 @@ public static void saveToFile()
ConfigUtils.writeConfigBase(root, "StructureHotkeys", StructureToggle.HOTKEY_CONFIGS);
ConfigUtils.writeConfigBase(root, "StructureToggles", StructureToggle.TOGGLE_CONFIGS);

for (InfoToggle toggle : InfoToggle.VALUES)
if (objInfoLineOrders != null)
{
objInfoLineOrders.add(toggle.getName(), new JsonPrimitive(toggle.getIntegerValue()));
for (InfoToggle toggle : InfoToggle.VALUES)
{
objInfoLineOrders.add(toggle.getName(), new JsonPrimitive(toggle.getIntegerValue()));
}
}

root.add("config_version", new JsonPrimitive(CONFIG_VERSION));
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/fi/dy/masa/minihud/config/RendererToggle.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package fi.dy.masa.minihud.config;

import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;

import fi.dy.masa.malilib.config.ConfigType;
import fi.dy.masa.malilib.config.IConfigBoolean;
import fi.dy.masa.malilib.config.IConfigNotifiable;
Expand All @@ -18,6 +16,8 @@
import fi.dy.masa.malilib.util.StringUtils;
import fi.dy.masa.minihud.MiniHUD;

import javax.annotation.Nullable;

public enum RendererToggle implements IHotkeyTogglable, IConfigNotifiable<IConfigBoolean>
{
OVERLAY_BEACON_RANGE ("overlayBeaconRange", "", "Toggle the Beacon Range overlay renderer", "Beacon Range overlay"),
Expand All @@ -33,6 +33,7 @@ public enum RendererToggle implements IHotkeyTogglable, IConfigNotifiable<IConfi
OVERLAY_SPAWN_CHUNK_OVERLAY_REAL ("overlaySpawnChunkReal", "", "Toggle the spawn chunks overlay renderer", "Spawn Chunks (real) overlay"),
OVERLAY_SPAWN_CHUNK_OVERLAY_PLAYER ("overlaySpawnChunkPlayer", "", "Toggle the pseudo (player-following) spawn chunks overlay renderer", "Spawn Chunks (player-following, would-be) overlay"),
OVERLAY_STRUCTURE_MAIN_TOGGLE ("overlayStructureMainToggle", "", "Main toggle for all structure bounding boxes", "Structure Bounding Boxes main"),
OVERLAY_VILLAGER_INFO ("overlayVillagerInfo", "", "Toggle the villager offers render.\nDisplays he enchantment books it sells.", "Villager offers overlay"),
SHAPE_RENDERER ("shapeRenderer", "", "The main toggle for the shape renderer", "Shape Renderer"),

DEBUG_CHUNK_BORDER ("debugChunkBorder", "", "Toggles the vanilla Chunk Border debug renderer", "Chunk Border"),
Expand Down
Loading

0 comments on commit 48c91d9

Please sign in to comment.