Skip to content

Commit

Permalink
Move the sprint keybind from the gameplay category to the movement ca…
Browse files Browse the repository at this point in the history
…tegory (#170)
  • Loading branch information
Alexdoru authored Feb 4, 2023
1 parent f274757 commit 86bd897
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/LoadingConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class LoadingConfig {
public boolean dropPickedLootOnDespawn;
public boolean enableDefaultLanPort;

public boolean changeSprintCategory;
public boolean enlargePotionArray;
public boolean fixBibliocraftPackets;
public boolean fixComponentsPoppingOff;
Expand Down Expand Up @@ -178,6 +179,7 @@ public LoadingConfig(File file) {
enableDefaultLanPort = config.get(Category.TWEAKS.toString(), "enableDefaultLanPort", true, "Open an integrated server on a static port.").getBoolean();
enableTileRendererProfiler = config.get(Category.TWEAKS.toString(), "enableTileRendererProfiler", true, "Shows renderer's impact on FPS in vanilla lagometer").getBoolean();

changeSprintCategory = config.get(Category.TWEAKS.toString(), "changeSprintCategory", true, "Moves the sprint keybind to the movement category").getBoolean();
fixComponentsPoppingOff = config.get(Category.TWEAKS.toString(), "fixComponentsPoppingOff", true, "Fix Project Red components popping off on unloaded chunks").getBoolean();
fixDebugBoundingBox = config.get(Category.FIXES.toString(), "fixDebugBoundingBox", true, "Fixes the debug hitbox of the player beeing offset").getBoolean();
fixDimensionChangeHearts = config.get(Category.FIXES.toString(), "fixDimensionChangeHearts", true, "Fix losing bonus hearts on dimension change").getBoolean();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
public enum Mixins {

// Vanilla Fixes
CHANGE_CATEGORY_SPRINT_KEY(new Builder("Moves the sprint keybind to the movement category")
.addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT).setPhase(Phase.EARLY)
.addMixinClasses("minecraft.MixinGameSetttings").setApplyIf(() -> Common.config.changeSprintCategory)),
FIX_RESOURCEPACK_FOLDER_OPENING(new Builder("Fix resource pack folder sometimes not opening on windows")
.setPhase(Phase.EARLY).addMixinClasses("minecraft.MixinGuiScreenResourcePacks").setSide(Side.CLIENT)
.setApplyIf(() -> Common.config.fixResourcePackOpening).addTargetedMod(TargetedMod.VANILLA)),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mitchej123.hodgepodge.mixins.early.minecraft;

import net.minecraft.client.settings.GameSettings;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Slice;

@Mixin(GameSettings.class)
public class MixinGameSetttings {

@ModifyConstant(
method = { "<init>()V", "<init>(Lnet/minecraft/client/Minecraft;Ljava/io/File;)V" },
constant = @Constant(stringValue = "key.categories.gameplay"),
slice = @Slice(
from = @At(
value = "FIELD",
target = "Lnet/minecraft/client/settings/GameSettings;keyBindPickBlock:Lnet/minecraft/client/settings/KeyBinding;"),
to = @At(
value = "FIELD",
target = "Lnet/minecraft/client/settings/GameSettings;keyBindSprint:Lnet/minecraft/client/settings/KeyBinding;")))
private String hodgepodge$ChangeSprintCategory(String original) {
return "key.categories.movement";
}

}

0 comments on commit 86bd897

Please sign in to comment.