From 5bc7512ac359c0254ab767342f7acc93c492df6d Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Fri, 16 Sep 2022 22:34:57 +0200 Subject: [PATCH] Fix keybind journeymap (#110) * Prevent unbinded Journeymap keybinds from triggering when pressing certain keys * Added an Enum for category names --- dependencies.gradle | 1 + .../hodgepodge/core/LoadingConfig.java | 295 ++++++++++++------ .../mitchej123/hodgepodge/mixins/Mixins.java | 3 + .../hodgepodge/mixins/TargetedMod.java | 2 +- .../mixins/journeymap/MixinConstants.java | 24 ++ 5 files changed, 230 insertions(+), 95 deletions(-) create mode 100644 src/main/java/com/mitchej123/hodgepodge/mixins/journeymap/MixinConstants.java diff --git a/dependencies.gradle b/dependencies.gradle index 2c40726c..d8dcbe9e 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -23,6 +23,7 @@ dependencies { compileOnly("com.github.GTNewHorizons:Galacticraft:3.0.44-GTNH:dev") compileOnly("com.github.GTNewHorizons:Baubles:1.0.1.14:dev") compileOnly fileTree(dir: 'dependencies', includes: ['TravellersGear-1.7.10-1.16.8-GTNH.jar']) + compileOnly('curse.maven:journeymap-32274:2367915') // Thermos Compat, compile only not run in dev by default compileOnly files("dependencies/Thermos-1.7.10-1614-stripped.jar") diff --git a/src/main/java/com/mitchej123/hodgepodge/core/LoadingConfig.java b/src/main/java/com/mitchej123/hodgepodge/core/LoadingConfig.java index 9dbfc4b0..abcf9117 100644 --- a/src/main/java/com/mitchej123/hodgepodge/core/LoadingConfig.java +++ b/src/main/java/com/mitchej123/hodgepodge/core/LoadingConfig.java @@ -58,6 +58,7 @@ public class LoadingConfig { public boolean speedupChunkCoordinatesHashCode; public boolean speedupProgressBar; public boolean speedupVanillaFurnace; + public boolean fixJourneymapKeybinds; public boolean deduplicateForestryCompatInBOP; public boolean speedupBOPFogHandling; public boolean makeBigFirsPlantable; @@ -99,169 +100,228 @@ public class LoadingConfig { public static BlockMatcher crossedSquares = new BlockMatcher(); public static BlockMatcher blockVine = new BlockMatcher(); + enum Category { + ASM, + DEBUG, + FIXES, + OVERALL, + SPEEDUPS, + TWEAKS, + POLLUTION_RECOLOR; + + @Override + public String toString() { + return name().toLowerCase(); + } + } + public LoadingConfig(File file) { config = new Configuration(file); requiredMods = config.get( - "overall", "requiredMods", defaultRequiredMods, "Subset of TargetMods that are required") + Category.OVERALL.toString(), + "requiredMods", + defaultRequiredMods, + "Subset of TargetMods that are required") .getStringList(); - requiredModsInDev = config.get("overall", "requiredModsInDev", false, "Require the Required Mods in dev") + requiredModsInDev = config.get( + Category.OVERALL.toString(), "requiredModsInDev", false, "Require the Required Mods in dev") .getBoolean(); - fixWorldGetBlock = config.get("fixes", "fixWorldGetBlock", true, "Fix unprotected getBlock() in World") + fixWorldGetBlock = config.get( + Category.FIXES.toString(), "fixWorldGetBlock", true, "Fix unprotected getBlock() in World") .getBoolean(); fixNorthWestBias = config.get( - "fixes", "fixNorthWestBias", true, "Fix northwest bias on RandomPositionGenerator") + Category.FIXES.toString(), + "fixNorthWestBias", + true, + "Fix northwest bias on RandomPositionGenerator") .getBoolean(); fixFenceConnections = config.get( - "fixes", "fixFenceConnections", true, "Fix fence connections with other types of fence") + Category.FIXES.toString(), + "fixFenceConnections", + true, + "Fix fence connections with other types of fence") .getBoolean(); fixIc2DirectInventoryAccess = config.get( - "fixes", "fixIc2DirectInventoryAccess", true, "Fix IC2's direct inventory access") + Category.FIXES.toString(), + "fixIc2DirectInventoryAccess", + true, + "Fix IC2's direct inventory access") .getBoolean(); - fixIc2ReactorDupe = config.get("fixes", "fixIc2ReactorDupe", true, "Fix IC2's reactor dupe") + fixIc2ReactorDupe = config.get(Category.FIXES.toString(), "fixIc2ReactorDupe", true, "Fix IC2's reactor dupe") .getBoolean(); optimizeIc2ReactorInventoryAccess = config.get( - "fixes", + Category.FIXES.toString(), "optimizeIc2ReactorInventoryAccess", true, "Optimize inventory access to IC2 nuclear reactor") .getBoolean(); fixIc2Nightvision = config.get( - "fixes", "fixIc2Nightvision", true, "Prevent IC2's nightvision from blinding you") + Category.FIXES.toString(), + "fixIc2Nightvision", + true, + "Prevent IC2's nightvision from blinding you") .getBoolean(); - fixIc2Hazmat = config.get("fixes", "fixIc2Hazmat", true, "Fix IC2 armors to avoid giving poison") + fixIc2Hazmat = config.get( + Category.FIXES.toString(), "fixIc2Hazmat", true, "Fix IC2 armors to avoid giving poison") .getBoolean(); fixVanillaUnprotectedGetBlock = config.get( - "fixes", + Category.FIXES.toString(), "fixVanillaUnprotectedGetBlock", true, "Fixes various unchecked vanilla getBlock() methods") .getBoolean(); fixIc2UnprotectedGetBlock = config.get( - "fixes", "fixIc2UnprotectedGetBlock", true, "Fixes various unchecked IC2 getBlock() methods") + Category.FIXES.toString(), + "fixIc2UnprotectedGetBlock", + true, + "Fixes various unchecked IC2 getBlock() methods") .getBoolean(); fixThaumcraftUnprotectedGetBlock = config.get( - "fixes", + Category.FIXES.toString(), "fixThaumcraftUnprotectedGetBlock", true, "Various Thaumcraft unchecked getBlock() patches") .getBoolean(); fixGTSawSpawningWaterWithIceBLock = config.get( - "fixes", + Category.FIXES.toString(), "fixGTSawSpawningWaterWithIceBLock", true, "Fixes GT bug that spawns a water source after breaking an ice block with a GT Saw") .getBoolean(); - fixHungerOverhaul = config.get("fixes", "fixHungerOverhaul", true, "Fix hunger overhaul low stat effects") + fixHungerOverhaul = config.get( + Category.FIXES.toString(), "fixHungerOverhaul", true, "Fix hunger overhaul low stat effects") .getBoolean(); - removeUpdateChecks = config.get("fixes", "removeUpdateChecks", true, "Remove old/stale/outdated update checks.") + removeUpdateChecks = config.get( + Category.FIXES.toString(), + "removeUpdateChecks", + true, + "Remove old/stale/outdated update checks.") .getBoolean(); fixGuiGameOver = config.get( - "fixes", "fixGuiGameOver", true, "Fix Game Over GUI buttons disabled if switching fullscreen") + Category.FIXES.toString(), + "fixGuiGameOver", + true, + "Fix Game Over GUI buttons disabled if switching fullscreen") .getBoolean(); - fixHopperHitBox = config.get("fixes", "fixHopperHitBox", true, "Fix vanilla hopper hit box") + fixHopperHitBox = config.get(Category.FIXES.toString(), "fixHopperHitBox", true, "Fix vanilla hopper hit box") .getBoolean(); fixGetBlockLightValue = config.get( - "fixes", + Category.FIXES.toString(), "fixGetBlockLightValue", true, "Fix vanilla light calculation sometimes cause NPE on thermos") .getBoolean(); fixFireSpread = config.get( - "fixes", "fixFireSpread", true, "Fix vanilla fire spread sometimes cause NPE on thermos") + Category.FIXES.toString(), + "fixFireSpread", + true, + "Fix vanilla fire spread sometimes cause NPE on thermos") .getBoolean(); - fixUrlDetection = config.get("fixes", "fixUrlDetection", true, "Fix URISyntaxException in forge.") + fixUrlDetection = config.get( + Category.FIXES.toString(), "fixUrlDetection", true, "Fix URISyntaxException in forge.") .getBoolean(); fixDimensionChangeHearts = config.get( - "fixes", "fixDimensionChangeHearts", true, "Fix losing bonus hearts on dimension change") + Category.FIXES.toString(), + "fixDimensionChangeHearts", + true, + "Fix losing bonus hearts on dimension change") .getBoolean(); - fixPotionLimit = config.get("fixes", "fixPotionLimit", true, "Fix potions >= 128") + fixPotionLimit = config.get(Category.FIXES.toString(), "fixPotionLimit", true, "Fix potions >= 128") .getBoolean(); fixImmobileFireballs = config.get( - "fixes", + Category.FIXES.toString(), "fixImmobileFireballs", true, "Fix the bug that makes fireballs stop moving when chunk unloads") .getBoolean(); fixPerspectiveCamera = config.get( - "fixes", + Category.FIXES.toString(), "fixPerspectiveCamera", true, "Prevent tall grass and such to affect the perspective camera") .getBoolean(); fixDebugBoundingBox = config.get( - "fixes", "fixDebugBoundingBox", true, "Fixes the debug hitbox of the player beeing offset") + Category.FIXES.toString(), + "fixDebugBoundingBox", + true, + "Fixes the debug hitbox of the player beeing offset") .getBoolean(); fixGlStateBugs = config.get( - "fixes", + Category.FIXES.toString(), "fixGlStateBugs", true, "Fix vanilla GL state bugs causing lighting glitches in various perspectives (MC-10135).") .getBoolean(); deduplicateForestryCompatInBOP = config.get( - "fixes", + Category.FIXES.toString(), "deduplicateForestryCompatInBOP", true, "Removes duplicate Fermenter and Squeezer recipes and flower registration") .getBoolean(); - fixHopperVoidingItems = config.get("fixes", "fixHopperVoidingItems", true, "Fix Drawer + Hopper voiding items") + fixHopperVoidingItems = config.get( + Category.FIXES.toString(), "fixHopperVoidingItems", true, "Fix Drawer + Hopper voiding items") .getBoolean(); - fixHugeChatKick = config.get("fixes", "fixHugeChatKick", true, "Fix oversized chat message kicking player.") + fixHugeChatKick = config.get( + Category.FIXES.toString(), + "fixHugeChatKick", + true, + "Fix oversized chat message kicking player.") .getBoolean(); logHugeChat = config.get( - "fixes", + Category.FIXES.toString(), "logHugeChat", true, "Log oversized chat message to console. WARNING: might create huge log files if this happens very often.") .getBoolean(); fixWorldServerLeakingUnloadedEntities = config.get( - "fixes", + Category.FIXES.toString(), "fixWorldServerLeakingUnloadedEntities", true, "Fix WorldServer leaking entities when no players are present in a dimension") .getBoolean(); fixResizableFullscreen = config.get( - "fixes", + Category.FIXES.toString(), "fixResizableFullscreen", true, "Fix game window becoming not resizable after toggling fullscrean in any way") .getBoolean(); fixUnfocusedFullscreen = config.get( - "fixes", "fixUnfocusedFullscreen", true, "Fix exiting fullscreen when you tab out of the game") - .getBoolean(); - addToggleDebugMessage = config.get( - "tweaks", - "addToggleDebugMessage", + Category.FIXES.toString(), + "fixUnfocusedFullscreen", true, - "Add a debug message in the chat when toggling vanilla debug options") + "Fix exiting fullscreen when you tab out of the game") .getBoolean(); speedupAnimations = config.get( - "fixes", + Category.FIXES.toString(), "speedupAnimations", true, "Drastically speedup animated textures (Basically the same as with optifine animations off but animations are working)") .getBoolean(); fixPotionIterating = config.get( - "fixes", + Category.FIXES.toString(), "fixPotionIterating", true, "Fix crashes with ConcurrentModificationException because of incorrectly iterating over active potions") .getBoolean(); fixIgnisFruitAABB = config.get( - "fixes", "fixIgnisFruitAABB", true, "Fix Axis aligned Bounding Box of Ignis Fruit") + Category.FIXES.toString(), + "fixIgnisFruitAABB", + true, + "Fix Axis aligned Bounding Box of Ignis Fruit") .getBoolean(); fixNetherLeavesFaceRendering = config.get( - "fixes", + Category.FIXES.toString(), "fixNetherLeavesFaceRendering", true, "If fancy graphics are enabled, Nether Leaves render sides with other Nether Leaves adjacent too") .getBoolean(); - optimizeASMDataTable = config.get( - "speedups", - "optimizeASMDataTable", + fixJourneymapKeybinds = config.get( + Category.FIXES.toString(), + "fixJourneymapKeybinds", true, - "Optimize ASMDataTable getAnnotationsFor for faster startup") + "Prevent unbinded keybinds from triggering when pressing certain keys") .getBoolean(); squashBedErrorMessage = config.get( "fixes", @@ -270,140 +330,180 @@ public LoadingConfig(File file) { "Stop \"You can only sleep at night\" message filling the chat") .getBoolean(); - increaseParticleLimit = config.get("tweaks", "increaseParticleLimit", true, "Increase particle limit") + increaseParticleLimit = config.get( + Category.TWEAKS.toString(), "increaseParticleLimit", true, "Increase particle limit") .getBoolean(); particleLimit = Math.max( Math.min( - config.get("tweaks", "particleLimit", 8000, "Particle limit [4000-16000]") + config.get(Category.TWEAKS.toString(), "particleLimit", 8000, "Particle limit [4000-16000]") .getInt(), 16000), 4000); fixPotionEffectRender = config.get( - "tweaks", + Category.TWEAKS.toString(), "fixPotionEffectRender", true, "Fix vanilla potion effects rendering above the NEI tooltips in the inventory") .getBoolean(); fixPotionRenderOffset = config.get( - "tweaks", + Category.TWEAKS.toString(), "fixPotionRenderOffset", true, "Prevents the inventory from shifting when the player has active potion effects") .getBoolean(); installAnchorAlarm = config.get( - "tweaks", "installAnchorAlarm", true, "Wake up passive & personal anchors on player login") + Category.TWEAKS.toString(), + "installAnchorAlarm", + true, + "Wake up passive & personal anchors on player login") .getBoolean(); - preventPickupLoot = config.get("tweaks", "preventPickupLoot", true, "Prevent monsters from picking up loot.") + preventPickupLoot = config.get( + Category.TWEAKS.toString(), "preventPickupLoot", true, "Prevent monsters from picking up loot.") .getBoolean(); dropPickedLootOnDespawn = config.get( - "tweaks", "dropPickedLootOnDespawn", true, "Drop picked loot on entity despawn") + Category.TWEAKS.toString(), + "dropPickedLootOnDespawn", + true, + "Drop picked loot on entity despawn") .getBoolean(); hideIc2ReactorSlots = config.get( - "tweaks", + Category.TWEAKS.toString(), "hideIc2ReactorSlots", true, "Prevent IC2's reactor's coolant slots from being accessed by automations if not a fluid reactor") .getBoolean(); displayIc2FluidLocalizedName = config.get( - "tweaks", + Category.TWEAKS.toString(), "displayIc2FluidLocalizedName", true, "Display fluid localized name in IC2 fluid cell tooltip") .getBoolean(); enableTileRendererProfiler = config.get( - "tweaks", + Category.TWEAKS.toString(), "enableTileRendererProfiler", true, "Shows renderer's impact on FPS in vanilla lagometer") .getBoolean(); addCVSupportToWandPedestal = config.get( - "tweaks", + Category.TWEAKS.toString(), "addCVSupportToWandPedestal", true, "Add CV support to Thaumcraft wand recharge pedestal") .getBoolean(); makeBigFirsPlantable = config.get( - "tweaks", + Category.TWEAKS.toString(), "makeBigFirsPlantable", true, "Allow 5 Fir Sapling planted together ('+' shape) to grow to a big fir tree") .getBoolean(); - ic2SeedMaxStackSize = config.get("tweaks", "ic2SeedMaxStackSize", 64, "IC2 seed max stack size") + ic2SeedMaxStackSize = config.get( + Category.TWEAKS.toString(), "ic2SeedMaxStackSize", 64, "IC2 seed max stack size") .getInt(); addSystemInfo = config.get( - "tweaks", + Category.TWEAKS.toString(), "addSystemInfo", true, "Adds system info to the F3 overlay (Java version and vendor; GPU name; OpenGL version; CPU cores; OS name, version and architecture)") .getBoolean(); fixHudLightingGlitch = config.get( - "tweaks", "fixHudLightingGlitch", true, "Fix hotbars being dark when Project Red is installed") + Category.TWEAKS.toString(), + "fixHudLightingGlitch", + true, + "Fix hotbars being dark when Project Red is installed") .getBoolean(); fixComponentsPoppingOff = config.get( - "tweaks", + Category.TWEAKS.toString(), "fixComponentsPoppingOff", true, "Fix Project Red components popping off on unloaded chunks") .getBoolean(); thirstyTankContainer = config.get( - "tweaks", "thirstyTankContainer", true, "Implement container for thirsty tank") + Category.TWEAKS.toString(), + "thirstyTankContainer", + true, + "Implement container for thirsty tank") .getBoolean(); enableDefaultLanPort = config.get( - "tweaks", "enableDefaultLanPort", true, "Open an integrated server on a static port.") + Category.TWEAKS.toString(), + "enableDefaultLanPort", + true, + "Open an integrated server on a static port.") .getBoolean(); defaultLanPort = config.get( - "tweaks", + Category.TWEAKS.toString(), "defaultLanPort", 25565, "Specify default LAN port to open an integrated server on. Set to 0 to always open the server on an automatically allocated port.") .getInt(); + addToggleDebugMessage = config.get( + Category.TWEAKS.toString(), + "addToggleDebugMessage", + true, + "Add a debug message in the chat when toggling vanilla debug options") + .getBoolean(); + optimizeASMDataTable = config.get( + Category.SPEEDUPS.toString(), + "optimizeASMDataTable", + true, + "Optimize ASMDataTable getAnnotationsFor for faster startup") + .getBoolean(); tcpNoDelay = config.get( - "speedups", + Category.SPEEDUPS.toString(), "tcpNoDelay", true, "Sets TCP_NODELAY to true, reducing network latency in multiplayer. Works on server as well as client. From makamys/CoreTweaks") .getBoolean(); - speedupChunkCoordinatesHashCode = config.get( - "speedups", "speedupChunkCoordinatesHashCode", true, "Speedup ChunkCoordinates hashCode") + Category.SPEEDUPS.toString(), + "speedupChunkCoordinatesHashCode", + true, + "Speedup ChunkCoordinates hashCode") .getBoolean(); speedupVanillaFurnace = config.get( - "speedups", "speedupVanillaFurnace", true, "Speedup Vanilla Furnace recipe lookup") + Category.SPEEDUPS.toString(), + "speedupVanillaFurnace", + true, + "Speedup Vanilla Furnace recipe lookup") .getBoolean(); speedupBOPFogHandling = config.get( - "speedups", "speedupBOPFogHandling", true, "Speedup biome fog rendering in BiomesOPlenty") + Category.SPEEDUPS.toString(), + "speedupBOPFogHandling", + true, + "Speedup biome fog rendering in BiomesOPlenty") .getBoolean(); - speedupProgressBar = config.get("asm", "speedupProgressBar", true, "Speedup progressbar") + speedupProgressBar = config.get(Category.ASM.toString(), "speedupProgressBar", true, "Speedup progressbar") .getBoolean(); // Disable for now as it is not compatible with anything modifying RenderBlocks - pollutionAsm = config.get("asm", "pollutionAsm", false, "Enable pollution rendering ASM") + pollutionAsm = config.get(Category.ASM.toString(), "pollutionAsm", false, "Enable pollution rendering ASM") .getBoolean(); cofhWorldTransformer = config.get( - "asm", + Category.ASM.toString(), "cofhWorldTransformer", true, "Enable Glease's ASM patch to disable unused CoFH tileentity cache") .getBoolean(); - biblocraftRecipes = config.get("asm", "biblocraftRecipes", true, "Remove recipe generation from BiblioCraft") + biblocraftRecipes = config.get( + Category.ASM.toString(), "biblocraftRecipes", true, "Remove recipe generation from BiblioCraft") .getBoolean(); - thermosCraftServerClass = config.get( - "asm", + Category.ASM.toString(), "thermosCraftServerClass", "org.bukkit.craftbukkit.v1_7_R4.CraftServer", "If using Bukkit/Thermos, the CraftServer package.") .getString(); - renderDebug = config.get( - "debug", + Category.DEBUG.toString(), "renderDebug", true, "Enable GL state debug hooks. Will not do anything useful unless mode is changed to nonzero.") .getBoolean(); renderDebugMode = config.get( - "debug", "renderDebugMode", 0, "Default GL state debug mode. 0 - off, 1 - reduced, 2 - full") + Category.DEBUG.toString(), + "renderDebugMode", + 0, + "Default GL state debug mode. 0 - off, 1 - reduced, 2 - full") .setMinValue(0) .setMaxValue(2) .getInt(); @@ -417,22 +517,29 @@ public static void postInitClient() { config = new Configuration(new File(Launch.minecraftHome, "config/hodgepodge.cfg")); } - standardBlocks.updateClassList( - config.get("pollutionrecolor", "renderStandardBlock", defaultPollutionRenderStandardBlock) - .getStringList()); - liquidBlocks.updateClassList( - config.get("pollutionrecolor", "renderBlockLiquid", defaultPollutionRenderLiquidBlocks) - .getStringList()); - doublePlants.updateClassList( - config.get("pollutionrecolor", "renderBlockDoublePlant", defaultPollutionRenderDoublePlant) - .getStringList()); - crossedSquares.updateClassList( - config.get("pollutionrecolor", "renderCrossedSquares", defaultPollutionRenderCrossedSquares) - .getStringList()); - blockVine.updateClassList(config.get("pollutionrecolor", "renderblockVine", defaultPollutionRenderblockVine) + standardBlocks.updateClassList(config.get( + Category.POLLUTION_RECOLOR.toString(), + "renderStandardBlock", + defaultPollutionRenderStandardBlock) .getStringList()); + liquidBlocks.updateClassList(config.get( + Category.POLLUTION_RECOLOR.toString(), "renderBlockLiquid", defaultPollutionRenderLiquidBlocks) + .getStringList()); + doublePlants.updateClassList(config.get( + Category.POLLUTION_RECOLOR.toString(), + "renderBlockDoublePlant", + defaultPollutionRenderDoublePlant) + .getStringList()); + crossedSquares.updateClassList(config.get( + Category.POLLUTION_RECOLOR.toString(), + "renderCrossedSquares", + defaultPollutionRenderCrossedSquares) + .getStringList()); + blockVine.updateClassList( + config.get(Category.POLLUTION_RECOLOR.toString(), "renderblockVine", defaultPollutionRenderblockVine) + .getStringList()); - config.getCategory("pollutionrecolor").setComment(pollutionRecolorComment); + config.getCategory(Category.POLLUTION_RECOLOR.toString()).setComment(pollutionRecolorComment); if (config.hasChanged()) config.save(); } diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java index c9789f2a..8320c268 100644 --- a/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java @@ -260,6 +260,9 @@ public enum Mixins { FIX_FURNACE_ITERATION( "projecte.MixinObjHandler", () -> Hodgepodge.config.speedupVanillaFurnace, TargetedMod.PROJECTE), + FIX_JOURNEYMAP_KEYBINDS( + "journeymap.MixinConstants", () -> Hodgepodge.config.fixJourneymapKeybinds, TargetedMod.JOURNEYMAP), + // Pam's Harvest the Nether FIX_IGNIS_FRUIT_AABB( "harvestthenether.MixinBlockPamFruit", diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/TargetedMod.java b/src/main/java/com/mitchej123/hodgepodge/mixins/TargetedMod.java index 28fdfba7..71728910 100644 --- a/src/main/java/com/mitchej123/hodgepodge/mixins/TargetedMod.java +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/TargetedMod.java @@ -19,7 +19,7 @@ public enum TargetedMod { TRAVELLERSGEAR("TravellersGear", "TravellersGear"), // Temporary solution to force load it early GTNHLIB("GTNHLib", "gtnhlib"), - ; + JOURNEYMAP("journeymap", "journeymap"); public final String modName; public final String jarName; diff --git a/src/main/java/com/mitchej123/hodgepodge/mixins/journeymap/MixinConstants.java b/src/main/java/com/mitchej123/hodgepodge/mixins/journeymap/MixinConstants.java new file mode 100644 index 00000000..690dc69e --- /dev/null +++ b/src/main/java/com/mitchej123/hodgepodge/mixins/journeymap/MixinConstants.java @@ -0,0 +1,24 @@ +package com.mitchej123.hodgepodge.mixins.journeymap; + +import journeymap.client.Constants; +import net.minecraft.client.settings.KeyBinding; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Constants.class) +public class MixinConstants { + + /** + * @author Alexdoru + * @reason Prevent unbinded keybinds from triggering when pressing certain keys + */ + @Inject(method = "isPressed", at = @At("HEAD"), remap = false, cancellable = true) + private static void isPressed(KeyBinding keyBinding, CallbackInfoReturnable cir) { + if (keyBinding.getKeyCode() == 0) { + cir.setReturnValue(false); + cir.cancel(); + } + } +}