Skip to content

Commit

Permalink
Support Minecraft 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonCaramel committed Jun 8, 2023
1 parent d68edb3 commit 0de977a
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false
}

architectury {
Expand Down
14 changes: 7 additions & 7 deletions common/src/main/java/jp/axer/cocoainput/util/TinyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.regex.Pattern;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.components.Button;
Expand Down Expand Up @@ -216,20 +216,20 @@ protected void init() {
}

@Override
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
public void render(GuiGraphics helper, int mouseX, int mouseY, float delta) {
this.renderBackground(helper);

if (mouseY >= 40 && mouseY <= 39 + entries.size() * 30) {
int low = ((mouseY - 10) / 30) * 30 + 10 + 2;
fill(matrices, 0, low, width, low + 30 - 4, 0x33FFFFFF);
helper.fill(0, low, width, low + 30 - 4, 0x33FFFFFF);
}

super.render(matrices, mouseX, mouseY, delta);
drawCenteredString(matrices, font, title, width / 2, 15, 0xFFFFFF);
super.render(helper, mouseX, mouseY, delta);
helper.drawCenteredString(font, title, width / 2, 15, 0xFFFFFF);

int y = 40;
for (EntryInfo info : entries) {
drawString(matrices, font, Component.literal(info.comment), 12, y + 10, 0xFFFFFF);
helper.drawString(font, Component.literal(info.comment), 12, y + 10, 0xFFFFFF);
/*
if (info.error != null && info.error.getKey().isMouseOver(mouseX,mouseY))
renderTooltip(matrices, info.error.getValue(), mouseX, mouseY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.world.level.block.StandingSignBlock;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.screens.inventory.AbstractSignEditScreen;
import net.minecraft.network.chat.Component;

public final class AbstractSignEditScreenWrapper extends IMEReceiver {

Expand All @@ -25,14 +24,14 @@ public AbstractSignEditScreenWrapper(AbstractSignEditScreen field) {

@Override
protected void setText(String text) {
owner.sign.setMessage(owner.line, Component.literal(text));
owner.setMessage(text);
String[] util = owner.messages;
util[owner.line] = text;
}

@Override
protected String getText() {
return owner.sign.getMessage(owner.line, false).getString();
return owner.messages[owner.line];
}

@Override
Expand Down Expand Up @@ -69,7 +68,7 @@ public Rect getRect() {
y += 30;
}
return new Rect(
owner.width / 2 + fontRendererObj.width(owner.sign.getMessage(owner.line, false).toString().substring(0, originalCursorPosition)) / 2,
owner.width / 2 + fontRendererObj.width(owner.messages[owner.line].substring(0, originalCursorPosition)) / 2,
// owner.width / 2 + fontRendererObj.width(owner.sign.getMessage(owner.line,false).getString()) / 2,
y,
0,
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/CocoaInput.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ accessible field net/minecraft/client/gui/components/EditBox value Ljava/lang/St
accessible field net/minecraft/client/gui/components/EditBox frame I
accessible method net/minecraft/client/gui/components/EditBox onValueChange (Ljava/lang/String;)V

accessible method net/minecraft/client/gui/screens/inventory/AbstractSignEditScreen setMessage (Ljava/lang/String;)V
accessible field net/minecraft/client/gui/screens/inventory/AbstractSignEditScreen line I
accessible field net/minecraft/client/gui/screens/inventory/AbstractSignEditScreen frame I
accessible field net/minecraft/client/gui/screens/inventory/AbstractSignEditScreen sign Lnet/minecraft/world/level/block/entity/SignBlockEntity;
Expand Down
2 changes: 1 addition & 1 deletion fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Dependencies
modmenu_version=6.1.0-rc.1
modmenu_version=7.0.0
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 @@ -37,7 +37,7 @@
],

"depends": {
"fabricloader": ">=0.14.17",
"minecraft": ">=1.19.4"
"fabricloader": ">=0.14.21",
"minecraft": "1.20"
}
}
6 changes: 3 additions & 3 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader = "javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion = "[45,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion = "[46,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license = "Minecraft Mod Public License Japanese Transration"
Expand Down Expand Up @@ -41,11 +41,11 @@ Support IME input on macOS, Windows, X11(Linux).
[[dependencies.cocoainput]]
modId = "forge"
mandatory = true
versionRange = "[45,)"
versionRange = "[46,)"
side = "CLIENT"

[[dependencies.cocoainput]]
modId = "minecraft"
mandatory = true
versionRange = "1.19.4"
versionRange = "1.20"
side = "CLIENT"
6 changes: 3 additions & 3 deletions forge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"pack": {
"description": "CocoaInput Resources",
"pack_format": 13,
"forge:resource_pack_format": 13,
"forge:data_pack_format": 12
"pack_format": 15,
"forge:resource_pack_format": 15,
"forge:data_pack_format": 15
}
}
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
org.gradle.jvmargs=-Xmx2G

archives_base_name=CocoaInput
mod_version=4.2.1-EXPERIMENTAL
mod_version=4.3.0-EXPERIMENTAL
maven_group=jp.axer.cocoainput

minecraft_version=1.19.4
minecraft_version=1.20

fabric_loader_version=0.14.17
forge_version=1.19.4-45.0.1
fabric_loader_version=0.14.21
forge_version=1.20-46.0.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down

0 comments on commit 0de977a

Please sign in to comment.