Skip to content

Commit

Permalink
Fixed mixin issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruukas97 committed Sep 15, 2023
1 parent b7dae00 commit 4a7b492
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish'

String modid = 'infinityitemeditor'
version = '1.2.3'
version = '1.2.4'
group = modid // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = modid

Expand Down Expand Up @@ -133,7 +133,7 @@ dependencies {

compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.spongepowered:mixin:0.8:processor'
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

testCompileOnly 'org.projectlombok:lombok:1.18.20'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.20'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package infinityitemeditor.mixin;

import infinityitemeditor.util.CharUtils;
import net.minecraft.util.SharedConstants;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
Expand All @@ -13,7 +14,7 @@ public class SharedConstantsMixin {
*/
@Overwrite
public static boolean isAllowedChatCharacter(char c) { //func_71566_a
return (c != 167 && c >= ' ' && c != 127) || c == '\u00a7';
return CharUtils.isAllowedChatCharacter(c);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import infinityitemeditor.data.base.DataString;
import infinityitemeditor.mixin.SharedConstantsMixin;
import infinityitemeditor.screen.widgets.StyledButton;
import infinityitemeditor.util.CharUtils;
import infinityitemeditor.util.ColorUtils.Color;
import infinityitemeditor.util.GuiUtil;
import net.minecraft.client.gui.screen.Screen;
Expand Down Expand Up @@ -122,7 +123,7 @@ public boolean keyPressed(int keyCode, int scan, int modifier) {
public boolean charTyped(char key, int modifier) {
if (super.charTyped(key, modifier))
return true;
if (key == 167 || SharedConstantsMixin.isAllowedChatCharacter(key)) {
if (key == 167 || CharUtils.isAllowedChatCharacter(key)) {
String s = text.get();
text.set(s.substring(0, cursor) + key + s.substring(cursor));
cursor++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import infinityitemeditor.mixin.SharedConstantsMixin;
import infinityitemeditor.styles.StyleManager;
import infinityitemeditor.styles.StyleVanilla;
import infinityitemeditor.util.CharUtils;
import infinityitemeditor.util.GuiUtil;
import lombok.Getter;
import lombok.Setter;
Expand Down Expand Up @@ -420,7 +421,7 @@ public boolean charTyped(char char1, int char2) {
if (!this.getActive()) {
return false;
}
if (!SharedConstantsMixin.isAllowedChatCharacter(char1)) {
if (!CharUtils.isAllowedChatCharacter(char1)) {
return false;
}
this.writeText(Character.toString(char1));
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/infinityitemeditor/util/CharUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package infinityitemeditor.util;

public class CharUtils {
public static boolean isAllowedChatCharacter(char c) { //func_71566_a
return (c != 167 && c >= ' ' && c != 127) || c == '\u00a7';
}
}

0 comments on commit 4a7b492

Please sign in to comment.