From 050e3286f02d6e23fdfde6ffb355f71b33af61f6 Mon Sep 17 00:00:00 2001 From: Jess Date: Fri, 24 May 2024 04:35:38 +0100 Subject: [PATCH] autosigntext --- .../java/com/baseband/client/init/Setup.java | 4 ++- .../client/mixins/MixinGuiEditSign.java | 31 +++++++++++++++++++ .../com/baseband/client/module/Category.java | 3 +- .../client/module/category/World.java | 11 +++++++ .../client/module/world/AutoSignText.java | 25 +++++++++++++++ .../src/main/resources/mixins.baseband.json | 9 +++--- 6 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 Client/src/main/java/com/baseband/client/mixins/MixinGuiEditSign.java create mode 100644 Client/src/main/java/com/baseband/client/module/category/World.java create mode 100644 Client/src/main/java/com/baseband/client/module/world/AutoSignText.java diff --git a/Client/src/main/java/com/baseband/client/init/Setup.java b/Client/src/main/java/com/baseband/client/init/Setup.java index 427ffbc..cda9dc1 100644 --- a/Client/src/main/java/com/baseband/client/init/Setup.java +++ b/Client/src/main/java/com/baseband/client/init/Setup.java @@ -13,6 +13,7 @@ import com.baseband.client.module.render.ClickGUI; import com.baseband.client.module.render.Freecam; import com.baseband.client.module.render.HUD; import com.baseband.client.module.render.Nametags; +import com.baseband.client.module.world.AutoSignText; /** * @author TudbuT @@ -38,7 +39,8 @@ public class Setup { new ElytraFly(), new ExtraChat(), new Velocity(), - new Nametags() + new Nametags(), + new AutoSignText() }; diff --git a/Client/src/main/java/com/baseband/client/mixins/MixinGuiEditSign.java b/Client/src/main/java/com/baseband/client/mixins/MixinGuiEditSign.java new file mode 100644 index 0000000..b861e1b --- /dev/null +++ b/Client/src/main/java/com/baseband/client/mixins/MixinGuiEditSign.java @@ -0,0 +1,31 @@ +package com.baseband.client.mixins; + +import com.baseband.client.init.BaseBand; +import com.baseband.client.module.world.AutoSignText; +import net.minecraft.client.gui.inventory.GuiEditSign; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.text.TextComponentString; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = GuiEditSign.class, priority = Integer.MAX_VALUE) +public class MixinGuiEditSign { + + @Final + @Shadow + private TileEntitySign tileSign; + + @Inject(method = "initGui", at = @At("RETURN")) + public void initGui(CallbackInfo callback) { + if(BaseBand.getModule(AutoSignText.class).enabled) { + tileSign.signText[0] = new TextComponentString(BaseBand.getModule(AutoSignText.class).signTextFirst); + tileSign.signText[1] = new TextComponentString(BaseBand.getModule(AutoSignText.class).signTextSecond); + tileSign.signText[2] = new TextComponentString(BaseBand.getModule(AutoSignText.class).signTextThird); + tileSign.signText[3] = new TextComponentString(BaseBand.getModule(AutoSignText.class).signTextFourth); + } + } +} diff --git a/Client/src/main/java/com/baseband/client/module/Category.java b/Client/src/main/java/com/baseband/client/module/Category.java index 4b44d8c..30852e8 100644 --- a/Client/src/main/java/com/baseband/client/module/Category.java +++ b/Client/src/main/java/com/baseband/client/module/Category.java @@ -17,7 +17,8 @@ public enum Category { CHAT("Chat", Chat.class), CLIENT("Client", Client.class), COMBAT("Combat", Combat.class), - MOVEMENT("Movement", Movement.class) + MOVEMENT("Movement", Movement.class), + WORLD("World", World.class) ; diff --git a/Client/src/main/java/com/baseband/client/module/category/World.java b/Client/src/main/java/com/baseband/client/module/category/World.java new file mode 100644 index 0000000..14ddb1f --- /dev/null +++ b/Client/src/main/java/com/baseband/client/module/category/World.java @@ -0,0 +1,11 @@ +package com.baseband.client.module.category; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface World { +} \ No newline at end of file diff --git a/Client/src/main/java/com/baseband/client/module/world/AutoSignText.java b/Client/src/main/java/com/baseband/client/module/world/AutoSignText.java new file mode 100644 index 0000000..17f424f --- /dev/null +++ b/Client/src/main/java/com/baseband/client/module/world/AutoSignText.java @@ -0,0 +1,25 @@ +package com.baseband.client.module.world; + +import com.baseband.client.configuration.annotation.Config; +import com.baseband.client.module.Feature; +import com.baseband.client.module.category.World; + +@World +public class AutoSignText extends Feature { + @Override + public String toString() { + return "AutoSignText"; + } + + @Config("Line 1") + public String signTextFirst = "Try editing this"; + + @Config("Line 2") + public String signTextSecond = "In the GUI!"; + + @Config("Line 3") + public String signTextThird = "Try editing this"; + + @Config("Line 4") + public String signTextFourth = "In the GUI!"; +} diff --git a/Client/src/main/resources/mixins.baseband.json b/Client/src/main/resources/mixins.baseband.json index e0cbc3c..9cfadd2 100644 --- a/Client/src/main/resources/mixins.baseband.json +++ b/Client/src/main/resources/mixins.baseband.json @@ -4,13 +4,14 @@ "package": "com.baseband.client.mixins", "minVersion": "0", "refmap": "mixins.baseband.refmap.json", - "mixins": [ + "client": [ "ICPacketChat", "IMinecraft", "IRenderManager", - "MixinNetworkManager", - "MixinFMLNetworkRegistry", "MixinEntityPlayerSP", - "MixinGuiNewChat" + "MixinFMLNetworkRegistry", + "MixinGuiNewChat", + "MixinNetworkManager", + "MixinGuiEditSign" ] } \ No newline at end of file