summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r--src/main/java/ftbsc/bscv/modules/self/HandChanger.java72
1 files changed, 72 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;
+ }
+ }
+}