Skip to content

Commit

Permalink
update to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Boxadactle committed Aug 20, 2024
1 parent e18308d commit 2292f00
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 87 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Changes
- Rewritten for 1.20.6
- Rewritten for 1.20.1
- Fixed config saving bug
- Allow debug help translations in all languages
- Added button tooltips to debug key screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class DebugKeybindMain {

public static final String MOD_ID = "debugkeybind";

public static final String VERSION = "01.0.0";
public static final String VERSION = "12.0.0";

public static final String VERSION_STRING = MOD_NAME + " v" + VERSION;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
package dev.boxadactle.debugkeybind.command;

import com.mojang.brigadier.builder.ArgumentBuilder;
import dev.boxadactle.boxlib.command.BCommandManager;
import dev.boxadactle.boxlib.command.BCommandSourceStack;
import dev.boxadactle.boxlib.command.api.BClientSubcommand;
import dev.boxadactle.boxlib.command.api.BSubcommand;
import dev.boxadactle.boxlib.command.api.subcommand.BasicSubcommand;
import dev.boxadactle.debugkeybind.keybind.DebugKeybinds;

public class CopySubcommand implements BClientSubcommand {
@Override
public ArgumentBuilder<BCommandSourceStack, ?> getSubcommand() {
return BCommandManager.literal("copy");
}

@Override
public void build(ArgumentBuilder<BCommandSourceStack, ?> builder) {
builder.then(new DebugSubcommand("location", DebugKeybinds.COPY_LOCATION).buildSubcommand());
builder.then(new DebugSubcommand("inspect_data", DebugKeybinds.INSPECT).buildSubcommand());
public class CopySubcommand {
public static BSubcommand create() {
return new BasicSubcommand("copy", (ignored) -> -1)
.registerSubcommand(new DebugSubcommand("location", DebugKeybinds.COPY_LOCATION))
.registerSubcommand(new DebugSubcommand("inspect_data", DebugKeybinds.INSPECT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@
import com.mojang.brigadier.builder.ArgumentBuilder;
import dev.boxadactle.boxlib.command.BCommandManager;
import dev.boxadactle.boxlib.command.BCommandSourceStack;
import dev.boxadactle.boxlib.command.api.BClientSubcommand;
import dev.boxadactle.boxlib.command.api.subcommand.BasicSubcommand;
import dev.boxadactle.boxlib.scheduling.Scheduling;
import dev.boxadactle.boxlib.util.ClientUtils;
import dev.boxadactle.debugkeybind.keybind.DebugKeybind;
import dev.boxadactle.debugkeybind.mixin.DebugInvoker;

public class DebugSubcommand implements BClientSubcommand {
public class DebugSubcommand extends BasicSubcommand {

String name;
DebugKeybind keybind;

public DebugSubcommand(String name, DebugKeybind keybind) {
super(name, null);
this.name = name;
this.keybind = keybind;
}

@Override
public ArgumentBuilder<BCommandSourceStack, ?> getSubcommand() {
return BCommandManager.literal(name);
}

@Override
public void build(ArgumentBuilder<BCommandSourceStack, ?> builder) {
builder.executes(context -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package dev.boxadactle.debugkeybind.command;

import dev.boxadactle.boxlib.command.api.BClientCommand;
import dev.boxadactle.boxlib.command.api.BCommand;
import dev.boxadactle.boxlib.util.ClientUtils;
import dev.boxadactle.debugkeybind.keybind.DebugKeybinds;

public class F3Command {

public static BClientCommand create() {
return BClientCommand.create("f3", (context) -> {
public static BCommand create() {
return BCommand.create("f3", (context) -> {
ClientUtils.getClient().getDebugOverlay().toggleOverlay();
return 0;
})
.registerSubcommand(new ReloadSubcommand())
.registerSubcommand(new ToggleSubcommand())
.registerSubcommand(new CopySubcommand())
.registerSubcommand(ReloadSubcommand.create())
.registerSubcommand(ToggleSubcommand.create())
.registerSubcommand(CopySubcommand.create())
.registerSubcommand(new DebugSubcommand("clear_chat", DebugKeybinds.CLEAR_CHAT))
.registerSubcommand(new DebugSubcommand("creative_spectator", DebugKeybinds.CREATIVE_SPECTATOR))
.registerSubcommand(new DebugSubcommand("clear_chat", DebugKeybinds.CLEAR_CHAT))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@

package dev.boxadactle.debugkeybind.command;

import com.mojang.brigadier.builder.ArgumentBuilder;
import dev.boxadactle.boxlib.command.BCommandManager;
import dev.boxadactle.boxlib.command.BCommandSourceStack;
import dev.boxadactle.boxlib.command.api.BClientSubcommand;
import dev.boxadactle.boxlib.command.api.BSubcommand;
import dev.boxadactle.boxlib.command.api.subcommand.BasicSubcommand;
import dev.boxadactle.debugkeybind.keybind.DebugKeybinds;

public class ReloadSubcommand implements BClientSubcommand {
@Override
public ArgumentBuilder<BCommandSourceStack, ?> getSubcommand() {
return BCommandManager.literal("reload");
}

@Override
public void build(ArgumentBuilder<BCommandSourceStack, ?> builder) {
builder.then(new DebugSubcommand("chunks", DebugKeybinds.RELOAD_CHUNKS).buildSubcommand());
builder.then(new DebugSubcommand("resources", DebugKeybinds.RELOAD_RESOURCEPACKS).buildSubcommand());
public class ReloadSubcommand {
public static BSubcommand create() {
return new BasicSubcommand("reload", (ignored) -> -1)
.registerSubcommand(new DebugSubcommand("chunks", DebugKeybinds.RELOAD_CHUNKS))
.registerSubcommand(new DebugSubcommand("resources", DebugKeybinds.RELOAD_RESOURCEPACKS));
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
package dev.boxadactle.debugkeybind.command;

import com.mojang.brigadier.builder.ArgumentBuilder;
import dev.boxadactle.boxlib.command.BCommandManager;
import dev.boxadactle.boxlib.command.BCommandSourceStack;
import dev.boxadactle.boxlib.command.api.BClientSubcommand;
import dev.boxadactle.boxlib.command.api.BSubcommand;
import dev.boxadactle.boxlib.command.api.subcommand.BasicSubcommand;
import dev.boxadactle.debugkeybind.keybind.DebugKeybinds;

public class ToggleSubcommand implements BClientSubcommand {
@Override
public ArgumentBuilder<BCommandSourceStack, ?> getSubcommand() {
return BCommandManager.literal("toggle");
}

@Override
public void build(ArgumentBuilder<BCommandSourceStack, ?> builder) {
builder.then(new DebugSubcommand("hitboxes", DebugKeybinds.SHOW_HITBOXES).buildSubcommand());
builder.then(new DebugSubcommand("chunk_borders", DebugKeybinds.CHUNK_BORDERS).buildSubcommand());
builder.then(new DebugSubcommand("advanced_tooltips", DebugKeybinds.ADVANCED_TOOLTIPS).buildSubcommand());
builder.then(new DebugSubcommand("pause_on_lost_focus", DebugKeybinds.PAUSE_FOCUS).buildSubcommand());
builder.then(new DebugSubcommand("profiling", DebugKeybinds.PROFILING).buildSubcommand());
public class ToggleSubcommand {
public static BSubcommand create() {
return new BasicSubcommand("toggle", (ignored) -> -1)
.registerSubcommand(new DebugSubcommand("hitboxes", DebugKeybinds.SHOW_HITBOXES))
.registerSubcommand(new DebugSubcommand("chunk_borders", DebugKeybinds.CHUNK_BORDERS))
.registerSubcommand(new DebugSubcommand("advanced_tooltips", DebugKeybinds.ADVANCED_TOOLTIPS))
.registerSubcommand(new DebugSubcommand("pause_on_lost_focus", DebugKeybinds.PAUSE_FOCUS))
.registerSubcommand(new DebugSubcommand("profiling", DebugKeybinds.PROFILING));
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
package dev.boxadactle.debugkeybind.mixin;

import dev.boxadactle.debugkeybind.gui.DebugKeybindsScreen;
import net.minecraft.client.Options;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.OptionsList;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.controls.ControlsScreen;
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
import net.minecraft.client.gui.screens.options.controls.ControlsScreen;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.List;

@Mixin(ControlsScreen.class)
public abstract class ControlsScreenMixin extends Screen {
public abstract class ControlsScreenMixin extends OptionsSubScreen {

@Shadow @Nullable private OptionsList list;

protected ControlsScreenMixin(Component component) {
super(component);
public ControlsScreenMixin(Screen screen, Options options, Component component) {
super(screen, options, component);
}

@Inject(method = "init", at = @At("RETURN"))
@Inject(method = "addOptions", at = @At("RETURN"))
private void addButton(CallbackInfo ci) {
list.addSmall(List.of(Button.builder(
Component.translatable("controls.keybinds.debug"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package dev.boxadactle.debugkeybind.mixin;

import com.mojang.blaze3d.vertex.PoseStack;
import dev.boxadactle.boxlib.util.GuiUtils;
import dev.boxadactle.debugkeybind.keybind.DebugKeybinds;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.controls.KeyBindsList;
import net.minecraft.client.gui.screens.options.controls.KeyBindsList;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import org.spongepowered.asm.mixin.Final;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ private void overrideHelpMenu(int i, CallbackInfoReturnable<Boolean> cir) {

ChatComponent chatComponent = this.minecraft.gui.getChat();
chatComponent.addMessage(debugKeybind$translateHelpMessage("debug.reload_chunks.help", debugKey, DebugKeybinds.RELOAD_CHUNKS));
chatComponent.addMessage(debugKeybind$translateHelpMessage("debug.reload_chunks.help", debugKey, DebugKeybinds.RELOAD_CHUNKS));
chatComponent.addMessage(debugKeybind$translateHelpMessage("debug.show_hitboxes.help", debugKey, DebugKeybinds.SHOW_HITBOXES));
chatComponent.addMessage(debugKeybind$translateHelpMessage("debug.copy_location.help", debugKey, DebugKeybinds.COPY_LOCATION));
chatComponent.addMessage(debugKeybind$translateHelpMessage("debug.clear_chat.help", debugKey, DebugKeybinds.CLEAR_CHAT));
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
],
"depends": {
"fabricloader": "*",
"minecraft": "1.20.*",
"boxlib": "13.*"
"minecraft": "1.21.*",
"boxlib": "14.*"
},
"recommends": {
"modmenu": "*"
Expand Down
4 changes: 4 additions & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ configurations {
}
}

configurations.configureEach {
resolutionStrategy.force("net.sf.jopt-simple:jopt-simple:5.0.4")
}

dependencies {
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"

Expand Down
4 changes: 2 additions & 2 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ side="BOTH"
[[dependencies.debugkeybind]]
modId="minecraft"
mandatory=true
versionRange="[1.20,)"
versionRange="[1.21,)"
ordering="NONE"
side="BOTH"

[[dependencies.debugkeybind]]
modId="boxlib"
mandatory=true
versionRange="[13.0.0,14.0.0)"
versionRange="[14.0.0,15.0.0)"
ordering="NONE"
side="CLIENT"
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true

# Mod properties
mod_version = 11.0.0
mod_version = 12.0.0
maven_group = dev.boxadactle
archives_name = DebugKeybind
enabled_platforms = fabric,forge,neoforge

# Minecraft properties
minecraft_version = 1.20.6
minecraft_version = 1.21.1

# Dependencies
fabric_loader_version = 0.15.11
fabric_api_version = 0.100.4+1.20.6
neoforge_version = 20.6.119
forge_version = 50.1.12
fabric_api_version = 0.102.1+1.21.1
neoforge_version = 21.1.6
forge_version = 52.0.4

modmenu_version = 10.0.0
boxlib_version = 13.3.2
modmenu_version = 11.0.1
boxlib_version = 14.3.0

#publishing
game_versions = 1.20.6,1.20.5
game_versions = 1.21.1,1.21
project_id_curseforge = 901782
project_id_modrinth = DX9ioka8
release_type = release
Expand Down
4 changes: 2 additions & 2 deletions neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ A basic mod that adds keybinds for the F3 menu
[[dependencies.debugkeybind]]
modId="minecraft"
mandatory=true
versionRange="[1.20.5,)"
versionRange="[1.21,)"
ordering="NONE"
side="BOTH"

[[dependencies.debugkeybind]]
modId = "boxlib"
type = "required"
versionRange = "[13.0.0, 14.0.0)"
versionRange = "[14.0.0, 15.0.0)"
ordering = "NONE"
side = "BOTH"

Expand Down

0 comments on commit 2292f00

Please sign in to comment.