aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-11-02 16:51:55 +0100
committer alemi <me@alemi.dev>2023-11-02 16:51:55 +0100
commit78b9ffa352c846ec06729a288f7b69de837a9f92 (patch)
tree975d10da9995ad7d15251875e657655c7d141430 /src/main
parentbf5405d64df9da5c3143a3216e04c2e909f329ae (diff)
feat: added initial bad impl of HandChanger
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/ftbsc/bscv/modules/self/HandChanger.java72
-rw-r--r--src/main/resources/META-INF/accesstransformer.cfg4
2 files changed, 76 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/self/HandChanger.java b/src/main/java/ftbsc/bscv/modules/self/HandChanger.java
new file mode 100644
index 0000000..c7f8a03
--- /dev/null
+++ b/src/main/java/ftbsc/bscv/modules/self/HandChanger.java
@@ -0,0 +1,72 @@
+package ftbsc.bscv.modules.self;
+
+import com.google.auto.service.AutoService;
+import ftbsc.bscv.api.ILoadable;
+import ftbsc.bscv.modules.AbstractModule;
+import ftbsc.bscv.tools.Setting;
+import net.minecraftforge.client.event.RenderHandEvent;
+import net.minecraftforge.common.ForgeConfigSpec;
+import net.minecraftforge.eventbus.api.SubscribeEvent;
+
+@AutoService(ILoadable.class)
+public class HandChanger extends AbstractModule {
+
+ public final ForgeConfigSpec.ConfigValue<Double> main;
+ public final ForgeConfigSpec.ConfigValue<Double> off;
+ public final ForgeConfigSpec.ConfigValue<Boolean> cancel_main;
+ public final ForgeConfigSpec.ConfigValue<Boolean> cancel_off;
+
+ public HandChanger() {
+ super();
+
+ this.main = Setting.Decimal.builder()
+ .min(0.)
+ .max(1.)
+ .name("main")
+ .comment("height of main hand")
+ .fallback(1.)
+ .build(this);
+
+ this.off = Setting.Decimal.builder()
+ .min(0.)
+ .max(1.)
+ .name("off")
+ .comment("height of off hand")
+ .fallback(1.)
+ .build(this);
+
+ this.cancel_main = Setting.Bool.builder()
+ .name("cancel-main")
+ .comment("completely prevent main hand rendering")
+ .fallback(false)
+ .build(this);
+
+ this.cancel_off = Setting.Bool.builder()
+ .name("cancel-off")
+ .comment("completely prevent off hand rendering")
+ .fallback(false)
+ .build(this);
+ }
+
+ @SubscribeEvent
+ public void onRenderHands(RenderHandEvent event) {
+ switch (event.getHand()) {
+ case MAIN_HAND:
+ if (this.cancel_main.get()) {
+ event.setCanceled(true);
+ } else if (this.main.get() != 1.0) {
+ MC.gameRenderer.itemInHandRenderer.mainHandHeight = this.main.get().floatValue(); // ACCESSTRANSFORMER public net.minecraft.client.renderer.FirstPersonRenderer field_187469_f
+ MC.gameRenderer.itemInHandRenderer.oMainHandHeight = this.main.get().floatValue(); // ACCESSTRANSFORMER public net.minecraft.client.renderer.FirstPersonRenderer field_187469_f
+ }
+ break;
+ case OFF_HAND:
+ if (this.cancel_off.get()) {
+ event.setCanceled(true);
+ } else if (this.off.get() != 1.0) {
+ MC.gameRenderer.itemInHandRenderer.offHandHeight = this.off.get().floatValue(); // ACCESSTRANSFORMER public net.minecraft.client.renderer.FirstPersonRenderer field_187470_g
+ MC.gameRenderer.itemInHandRenderer.oOffHandHeight = this.off.get().floatValue(); // ACCESSTRANSFORMER public net.minecraft.client.renderer.FirstPersonRenderer field_187470_g
+ }
+ break;
+ }
+ }
+}
diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg
index 5be5b4b..9e08035 100644
--- a/src/main/resources/META-INF/accesstransformer.cfg
+++ b/src/main/resources/META-INF/accesstransformer.cfg
@@ -5,3 +5,7 @@ public net.minecraft.network.play.client.CPlayerPacket field_149474_g # onGround
public net.minecraft.network.play.client.CPlayerPacket field_149477_b # y
public net.minecraft.client.multiplayer.PlayerController func_78750_j()V # ensureHasSentCarriedItem()
public net.minecraft.client.Minecraft field_71467_ac # rightClickDelay
+public net.minecraft.client.renderer.FirstPersonRenderer field_187469_f # mainHandHeight
+public net.minecraft.client.renderer.FirstPersonRenderer field_187470_g # oMainHandHeight
+public net.minecraft.client.renderer.FirstPersonRenderer field_187471_h # offHandHeight
+public net.minecraft.client.renderer.FirstPersonRenderer field_187472_i # oOffHandHeight