Skip to content

Commit

Permalink
Update to Minecraft 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerozgen committed Oct 27, 2024
1 parent 87053c7 commit 3490c62
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.7
fabric_version=0.106.0+1.21.1
fabric_version=0.107.0+1.21.3

# Mod Properties
mod_version=1.7+1.21.1
mod_version=1.7+1.21.3
maven_group=jerozgen
archives_base_name=language-reload

# Dependencies
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
modmenu_version=11.0.3
# https://modrinth.com/mod/modmenu/versions
modmenu_version=12.0.0-beta.1
10 changes: 3 additions & 7 deletions src/main/java/jerozgen/languagereload/mixin/KeyboardMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,16 @@ private void onProcessF3(int key, CallbackInfoReturnable<Boolean> cir) {
}
}

@Inject(method = "onKey", at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/gui/screen/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V"),
cancellable = true)
@Inject(method = "onKey", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Keyboard;debugCrashStartTime:J", ordinal = 0), cancellable = true)
private void onOnKey(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) {
if (InputUtil.isKeyPressed(window, GLFW.GLFW_KEY_F3) && key == GLFW.GLFW_KEY_J) {
if (client.currentScreen != null && InputUtil.isKeyPressed(window, GLFW.GLFW_KEY_F3) && key == GLFW.GLFW_KEY_J) {
if (action != 0)
processLanguageReloadKeys();
ci.cancel();
}
}

@Inject(method = "onChar", at = @At(value = "INVOKE",
target = "Lnet/minecraft/client/gui/screen/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V",
ordinal = 0), cancellable = true)
@Inject(method = "onChar", at = @At("HEAD"), cancellable = true)
private void onOnChar(long window, int codePoint, int modifiers, CallbackInfo ci) {
if (InputUtil.isKeyPressed(window, GLFW.GLFW_KEY_F3) && InputUtil.isKeyPressed(window, GLFW.GLFW_KEY_J)) {
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ public void setFocused(boolean focused) {
header.add(searchBox);
}

@Inject(method = "initTabNavigation", at = @At("HEAD"), cancellable = true)
protected void onInitTabNavigation(CallbackInfo ci) {
super.initTabNavigation();
@Inject(method = "refreshWidgetPositions", at = @At("HEAD"), cancellable = true)
protected void onRefreshWidgetPositions(CallbackInfo ci) {
super.refreshWidgetPositions();

var listWidth = Math.min(width / 2 - 4, 200);
availableLanguageList.position(listWidth, layout);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package jerozgen.languagereload.mixin;

import com.google.common.collect.Maps;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import jerozgen.languagereload.access.ITranslationStorage;
import jerozgen.languagereload.config.Config;
import net.minecraft.client.resource.language.TranslationStorage;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.DeprecatedLanguageData;
import net.minecraft.util.Language;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -32,6 +35,15 @@ void onConstructed(Map<String, String> translations, boolean rightToLeft, Callba
separateTranslationsOnLoad = null;
}

@WrapOperation(method = "load(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Z)Lnet/minecraft/client/resource/language/TranslationStorage;",
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/DeprecatedLanguageData;apply(Ljava/util/Map;)V"))
private static void onLoad$applyDeprecatedLanguageData(DeprecatedLanguageData data, Map<String, String> translations, Operation<Void> applier) {
applier.call(data, translations);
for (Map<String, String> map : separateTranslationsOnLoad.values()) {
applier.call(data, map);
}
}

@Inject(method = "load(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Z)Lnet/minecraft/client/resource/language/TranslationStorage;",
at = @At("HEAD"))
private static void onLoad(ResourceManager resourceManager, List<String> definitions, boolean rightToLeft, CallbackInfoReturnable<TranslationStorage> cir) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"depends": {
"fabric-resource-loader-v0": "*",
"fabricloader": ">=0.15.10",
"minecraft": ">=1.21"
"minecraft": ">=1.21.2"
},
"suggests": {
"modmenu": "*"
Expand Down

0 comments on commit 3490c62

Please sign in to comment.