From e1bc0f7fe8e95d961f534890bfbb6dbf1409bae7 Mon Sep 17 00:00:00 2001 From: DarkKronicle Date: Tue, 2 Nov 2021 13:45:01 -0600 Subject: [PATCH] Updating OwO --- build.gradle | 2 +- gradle.properties | 2 +- .../config/gui/WidgetSoundButton.java | 15 ++++++++++++++ .../filters/matchreplace/OwOTextReplace.java | 20 +++++++++---------- 4 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetSoundButton.java diff --git a/build.gradle b/build.gradle index ee761cb..6b14349 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ dependencies { modImplementation "fi.dy.masa.malilib:malilib-fabric-1.17.1:${project.malilib_version}" modImplementation "com.github.DarkKronicle:AdvancedChatCore:${project.advancedchat_version}" - implementation "com.github.maowcraft:owo:${project.owo_version}" + implementation "io.github.maowimpl:owo:${project.owo_version}" include "com.github.maowcraft:owo:${project.owo_version}" implementation 'org.openjdk.nashorn:nashorn-core:15.3' diff --git a/gradle.properties b/gradle.properties index 1030a24..9ccdb57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,4 @@ org.gradle.jvmargs=-Xmx1G --add-exports jdk.compiler/com.sun.tools.javac.api=ALL --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED advancedchat_version=1.1.0-beta1 -owo_version=master-SNAPSHOT +owo_version=2.0.0 diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetSoundButton.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetSoundButton.java new file mode 100644 index 0000000..8c0c154 --- /dev/null +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetSoundButton.java @@ -0,0 +1,15 @@ +package io.github.darkkronicle.advancedchatfilters.config.gui; + +import fi.dy.masa.malilib.gui.GuiTextFieldGeneric; +import fi.dy.masa.malilib.gui.widgets.WidgetDropDownList; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.sound.SoundManager; + +public class WidgetSoundButton extends GuiTextFieldGeneric { + + public WidgetSoundButton(int x, int y, int width, int height, TextRenderer textRenderer) { + super(x, y, width, height, textRenderer); + MinecraftClient.getInstance().getSoundManager().get + } +} diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/filters/matchreplace/OwOTextReplace.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/filters/matchreplace/OwOTextReplace.java index bd03f2c..3d47fcf 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/filters/matchreplace/OwOTextReplace.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/filters/matchreplace/OwOTextReplace.java @@ -7,6 +7,9 @@ */ package io.github.darkkronicle.advancedchatfilters.filters.matchreplace; +import dev.maow.owo.api.OwO; +import dev.maow.owo.api.OwOProvider; +import dev.maow.owo.util.OwOFactory; import io.github.darkkronicle.advancedchatcore.util.FindType; import io.github.darkkronicle.advancedchatcore.util.FluidText; import io.github.darkkronicle.advancedchatcore.util.RawText; @@ -18,8 +21,6 @@ import java.util.HashMap; import java.util.List; import java.util.Optional; -import maow.owo.OwO; -import maow.owo.util.ParsingUtil; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.text.Style; @@ -27,6 +28,12 @@ @Environment(EnvType.CLIENT) public class OwOTextReplace implements IMatchReplace { + private final OwO owo; + + public OwOTextReplace() { + this.owo = OwOFactory.INSTANCE.create(); + } + @Override public Optional filter(ReplaceFilter filter, FluidText text, SearchResult search) { HashMap replaceMatches = new HashMap<>(); @@ -47,17 +54,10 @@ public Optional filter(ReplaceFilter filter, FluidText text, SearchRe m, (current, match1) -> new FluidText( - current.withMessage(OwO.INSTANCE.translate(match1.match)))); + current.withMessage(owo.translate(OwO.TranslateMode.PLAIN, match1.match)))); } } text.replaceStrings(replaceMatches); - text.append( - new RawText( - " " - + ParsingUtil.parseRandomizedLetters( - ParsingUtil.getRandomElement(OwO.INSTANCE.getSuffixes())), - Style.EMPTY), - true); return Optional.of(text); } }