Skip to content

Commit

Permalink
Updated to 1.16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rlj1202 committed Jul 19, 2020
1 parent e5cecdd commit 99075c8
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 33 deletions.
23 changes: 11 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.2.0'
version = '1.3.0'
group = 'redlaboratory.hangulinput' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'HangulInput'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.

println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20190719-1.14.3'
mappings channel: 'snapshot', version: '20200514-1.16'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
Expand Down Expand Up @@ -96,7 +97,8 @@ dependencies {
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
// minecraft 'net.minecraftforge:forge:1.14.4-28.0.55'
// minecraft 'net.minecraftforge:forge:1.15.1-30.0.7'
minecraft 'net.minecraftforge:forge:1.15.2-31.1.0'
//minecraft 'net.minecraftforge:forge:1.15.2-31.1.0'
minecraft 'net.minecraftforge:forge:1.16.1-32.0.70'

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
Expand Down Expand Up @@ -142,18 +144,15 @@ jar {
}

// Example configuration to allow publishing using the maven-publish task
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
// Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')

publishing {
publications {
mavenJava(MavenPublication) {
artifact reobfArtifact
artifact jar
}
}
repositories {
Expand Down
36 changes: 27 additions & 9 deletions src/main/java/redlaboratory/hangulinput/HangulInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ public HangulInput() {
public void onGuiInitPost(GuiScreenEvent.InitGuiEvent.Post event) {
if (event.getGui() == null) return;

int guiwidth = event.getGui().width;
int guiheight = event.getGui().height;
// TODO
// int guiwidth = event.getGui().width;
// int guiheight = event.getGui().height;
int guiwidth = event.getGui().field_230708_k_;
int guiheight = event.getGui().field_230709_l_;

if (event.getGui() instanceof ChatScreen) {
event.addWidget(new InputModeIndicatorWidget(
Expand All @@ -57,9 +60,14 @@ public void onGuiInitPost(GuiScreenEvent.InitGuiEvent.Post event) {
12, 12, "", HANGUL_BUILDER
));
} else if (event.getGui() instanceof CreativeScreen) {
// event.addWidget(new InputModeIndicatorWidget(
// guiwidth / 2 + 77,
// guiheight / 2 - 64,
// 12, 12, "", HANGUL_BUILDER
// ));
event.addWidget(new InputModeIndicatorWidget(
guiwidth / 2 + 77,
guiheight / 2 - 64,
guiwidth - 14,
guiheight - 14,
12, 12, "", HANGUL_BUILDER
));
} else if (event.getGui() instanceof WorldSelectionScreen) {
Expand Down Expand Up @@ -124,12 +132,16 @@ public void onGuiKeyboardPressed(GuiScreenEvent.KeyboardKeyPressedEvent.Pre even
} else if (event.getKeyCode() == GLFW.GLFW_KEY_BACKSPACE) {
event.setCanceled(true);

event.getGui().keyPressed(GLFW.GLFW_KEY_BACKSPACE, event.getModifiers(), 0);
// TODO
// event.getGui().keyPressed(GLFW.GLFW_KEY_BACKSPACE, event.getModifiers(), 0);
event.getGui().func_231046_a_(GLFW.GLFW_KEY_BACKSPACE, event.getModifiers(), 0);

HangulBuilder.Result result = HANGUL_BUILDER.remove();

if (result.flagUpdate) {
event.getGui().charTyped(result.updatedLetter, 0);
// TODO
// event.getGui().charTyped(result.updatedLetter, 0);
event.getGui().func_231042_a_(result.updatedLetter, 0);
}

if (!result.flagUpdate && !result.flagAdd) {
Expand Down Expand Up @@ -162,11 +174,17 @@ public void onGuiKeyboard(GuiScreenEvent.KeyboardCharTypedEvent event) {
HangulBuilder.Result result = HANGUL_BUILDER.add(event.getCodePoint());

if (result.flagUpdate) {
event.getGui().keyPressed(GLFW.GLFW_KEY_BACKSPACE, event.getModifiers(), 0);
event.getGui().charTyped(result.updatedLetter, 0);
// TODO
// event.getGui().keyPressed(GLFW.GLFW_KEY_BACKSPACE, event.getModifiers(), 0);
// event.getGui().charTyped(result.updatedLetter, 0);
event.getGui().func_231046_a_(GLFW.GLFW_KEY_BACKSPACE, event.getModifiers(), 0);
event.getGui().func_231042_a_(result.updatedLetter, 0);

}
if (result.flagAdd) {
event.getGui().charTyped(result.addedLetter, 0);
// TODO
// event.getGui().charTyped(result.addedLetter, 0);
event.getGui().func_231042_a_(result.addedLetter, 0);
}

LOGGER.info("key typed : " + result);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package redlaboratory.hangulinput;

import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.Widget;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import redlaboratory.hangulutils.HangulBuilder;
Expand All @@ -15,25 +17,44 @@ public class InputModeIndicatorWidget extends Widget {
private int fontColor = 0xffffffff;

public InputModeIndicatorWidget(int x, int y, int width, int height, String msg, HangulBuilder hangulBuilder) {
super(x, y, width, height, msg);
super(x, y, width, height, ITextComponent.func_241827_a_(msg));
this.hangulBuilder = hangulBuilder;
}

@Override
public void render(int mouseX, int mouseY, float partialTicks) {
public void func_230430_a_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) {
//super.func_230430_a_(matrix, mouseX, mouseY, partialTicks);

Minecraft minecraft = Minecraft.getInstance();

fill(x, y, x + width, y + height, bgColor);
minecraft.fontRenderer.drawStringWithShadow(
int x = field_230690_l_;
int y = field_230691_m_;
int width = field_230688_j_;
int height = field_230689_k_;

func_238467_a_(matrix, x, y, x + width, y + height, bgColor);
minecraft.fontRenderer.func_238405_a_(
matrix,
hangulBuilder.isHangulMode() ? "\uD55C" : "\uC601",
x + (int) ((width - 8) / 2.0), y + (int) ((height - 8) / 2.0),
fontColor
);
}

@Override
public void renderButton(int mouseX, int mouseY, float partialTicks) {
super.renderButton(mouseX, mouseY, partialTicks);
public void func_230431_b_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) {
super.func_230431_b_(matrix, mouseX, mouseY, partialTicks);
}

// public void render(int mouseX, int mouseY, float partialTicks) {
// Minecraft minecraft = Minecraft.getInstance();

// fill(x, y, x + width, y + height, bgColor);
// minecraft.fontRenderer.drawStringWithShadow(
// hangulBuilder.isHangulMode() ? "\uD55C" : "\uC601",
// x + (int) ((width - 8) / 2.0), y + (int) ((height - 8) / 2.0),
// fontColor
// );
// }

}
11 changes: 5 additions & 6 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
# 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="[31,)" #mandatory (26 is current forge version)
loaderVersion="[32,)" #mandatory (26 is current forge version)
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="http://my.issue.tracker/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="hangulinput" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="1.2.0"
#version="${file.jarVersion}" #mandatory
version="${file.jarVersion}" #mandatory
# A display name for the mod
displayName="Hangul Input" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
Expand All @@ -30,7 +29,7 @@ logoFile="logo.png" #optional
authors="rlj1202" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
Converts latin strokes into korean alphabet strokes
Converts latin strokes into korean alphabet strokes.
'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.hangulinput]] #optional
Expand All @@ -39,7 +38,7 @@ Converts latin strokes into korean alphabet strokes
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[31,)" #mandatory
versionRange="[32,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
Expand All @@ -48,6 +47,6 @@ Converts latin strokes into korean alphabet strokes
[[dependencies.hangulinput]]
modId="minecraft"
mandatory=true
versionRange="[1.15.2]"
versionRange="[1.16.1]"
ordering="NONE"
side="CLIENT"

0 comments on commit 99075c8

Please sign in to comment.