diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 92f4df62..306ea9eb 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -26,7 +26,6 @@ on: permissions: contents: write - jobs: build: runs-on: ubuntu-latest @@ -54,6 +53,7 @@ jobs: run: ./gradlew build --stacktrace - name: Send JAR to Discord Webhook + if: github.event_name == 'push' # Only send to Discord on push events env: DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} GITHUB_SHA: ${{ github.sha }} @@ -74,4 +74,16 @@ jobs: curl -X POST -H "Content-Type: multipart/form-data" \ -F "file=@$JAR_PATH" \ -F "payload_json={\"content\":\"$GIT_COMMIT_AUTHOR pushed $GIT_COMMIT_COMMENT_COUNT changes to the repository $GITHUB_REPOSITORY on branch $GITHUB_REF. Commit URL: $GIT_COMMIT_URL\"}" \ - $DISCORD_WEBHOOK_URL \ No newline at end of file + $DISCORD_WEBHOOK_URL + + - name: Find Correct JAR + id: findjar + run: | + output="$(find build/libs/ ! -name "*-sources.jar" -type f -printf "%f\n")" + echo "::set-output name=jarname::$output" + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.findjar.outputs.jarname }} + path: build/libs/${{ steps.findjar.outputs.jarname }} diff --git a/src/main/java/keystrokesmod/event/FOVUpdateEvent.java b/src/main/java/keystrokesmod/event/FOVUpdateEvent.java new file mode 100644 index 00000000..8d311aef --- /dev/null +++ b/src/main/java/keystrokesmod/event/FOVUpdateEvent.java @@ -0,0 +1,8 @@ +package keystrokesmod.event; + +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + +@Cancelable +public class FOVUpdateEvent extends Event { +} diff --git a/src/main/java/keystrokesmod/mixins/impl/client/MixinEntityRenderer.java b/src/main/java/keystrokesmod/mixins/impl/client/MixinEntityRenderer.java index c30d2d12..28e12a72 100644 --- a/src/main/java/keystrokesmod/mixins/impl/client/MixinEntityRenderer.java +++ b/src/main/java/keystrokesmod/mixins/impl/client/MixinEntityRenderer.java @@ -2,6 +2,8 @@ import com.google.common.base.Predicates; +import keystrokesmod.module.ModuleManager; +import keystrokesmod.module.impl.render.CustomFOV; import keystrokesmod.module.impl.other.RotationHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.EntityRenderer; @@ -9,12 +11,16 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.util.*; +import net.minecraftforge.client.event.FOVUpdateEvent; +import net.minecraftforge.common.MinecraftForge; +import org.jetbrains.annotations.NotNull; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; 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; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.List; @@ -111,4 +117,30 @@ public void getMouseOver(float p_getMouseOver_1_, CallbackInfo ci) { ci.cancel(); } + + + /** + * @author kefpull + * @reason attempt 1 have an option for CustomFOV to do the same thing as optifine's "Dynamic FOV:off". Hopefully this does not break the whole entire client :). + * I know we're supposed to use an event or something like that, so I will do that if I can. + *

+ * Source for method: line 412 in EntityRenderer.class + */ + + @Inject(method = "getFOVModifier", at = @At("RETURN"), cancellable = true) + public void onGetFOVModifier(@NotNull CallbackInfoReturnable cir) { + + if (ModuleManager.customFOV != null && ModuleManager.customFOV.forceStaticFOV != null) { + + if (ModuleManager.customFOV.isEnabled() && ModuleManager.customFOV.forceStaticFOV.isToggled()) { + + cir.setReturnValue(CustomFOV.getDesiredFOV()); + + } + + } + } + + + } diff --git a/src/main/java/keystrokesmod/module/ModuleManager.java b/src/main/java/keystrokesmod/module/ModuleManager.java index 26bfa4d1..bfb48261 100644 --- a/src/main/java/keystrokesmod/module/ModuleManager.java +++ b/src/main/java/keystrokesmod/module/ModuleManager.java @@ -60,6 +60,7 @@ public class ModuleManager { public static NoCameraClip noCameraClip; public static AutoPlay autoPlay; public static CustomName customName; + public static CustomFOV customFOV; public static CommandChat commandChat; public static Phase phase; public static PingSpoof pingSpoof; @@ -272,6 +273,7 @@ public void register() { this.addModule(new ChestESP()); this.addModule(customCape = new CustomCape()); this.addModule(customName = new CustomName()); + this.addModule(customFOV = new CustomFOV()); this.addModule(freeLook = new FreeLook()); this.addModule(fullBright = new FullBright()); this.addModule(hud = new HUD()); diff --git a/src/main/java/keystrokesmod/module/impl/render/Animations.java b/src/main/java/keystrokesmod/module/impl/render/Animations.java index 12a6fd77..62c4480a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Animations.java +++ b/src/main/java/keystrokesmod/module/impl/render/Animations.java @@ -6,6 +6,7 @@ import keystrokesmod.module.impl.combat.KillAura; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Utils; @@ -27,17 +28,54 @@ public class Animations extends Module { private final ModeSetting swingAnimation = new ModeSetting("Swing animation", new String[]{"None", "1.9+", "Smooth", "Punch", "Shove"}, 0); private final ModeSetting otherAnimation = new ModeSetting("Other animation", new String[]{"None", "1.7"}, 1); private final ButtonSetting fakeSlotReset = new ButtonSetting("Fake slot reset", false); - private final SliderSetting x = new SliderSetting("X", 0, -1, 1, 0.05); - private final SliderSetting y = new SliderSetting("Y", 0, -1, 1, 0.05); - private final SliderSetting z = new SliderSetting("Z", 0, -1, 1, 0.05); - private final SliderSetting swingSpeed = new SliderSetting("Swing speed", 0, -200, 50, 5); - private final SliderSetting swingSpeedWhileBlocking = new SliderSetting("Swing speed while blocking", 0, -200, 50, 5); + + private final ButtonSetting modifyAnimations = new ButtonSetting("Customize Animations", false); + private final SliderSetting staticStartSwingProgress = new SliderSetting("Starting Swing Progress", 0, -1, 2.5, 0.1, modifyAnimations::isToggled); + private final SliderSetting swingSpeed = new SliderSetting("Swing speed", 0, -200, 50, 5, modifyAnimations::isToggled); + private final SliderSetting swingSpeedWhileBlocking = new SliderSetting("Swing speed while blocking", 0, -200, 50, 5, modifyAnimations::isToggled); + //translation + private final SliderSetting translatex = new SliderSetting("X", 0, -4, 4, 0.05); + private final SliderSetting translatey = new SliderSetting("Y", 0, -2, 2, 0.05); + private final SliderSetting translatez = new SliderSetting("Z", 0, -10, 10, 0.05); + + private final ButtonSetting precustomtranslation = new ButtonSetting("Custom Translation (pre)", false); + private final SliderSetting pretranslatex = new SliderSetting("X", 0, -4, 4, 0.05, precustomtranslation::isToggled); + private final SliderSetting pretranslatey = new SliderSetting("Y", 0, -2, 2, 0.05, precustomtranslation::isToggled); + private final SliderSetting pretranslatez = new SliderSetting("Z", 0, -6, 3, 0.05, precustomtranslation::isToggled); + + private final ButtonSetting customscaling = new ButtonSetting("Custom Scaling", false); + private final SliderSetting scalex = new SliderSetting("ScaleX", 1, -1, 5, 0.05, customscaling::isToggled); + private final SliderSetting scaley = new SliderSetting("ScaleY", 1, -1, 5, 0.05, customscaling::isToggled); + private final SliderSetting scalez = new SliderSetting("ScaleZ", 1, -1, 5, 0.05, customscaling::isToggled); + + private final ButtonSetting customrotation = new ButtonSetting("Custom Rotation", false); + private final SliderSetting rotatex = new SliderSetting("rotation x", 0, -180, 180, 1, customrotation::isToggled); + private final SliderSetting rotatey = new SliderSetting("rotation y", 0, -180, 180, 1, customrotation::isToggled); + private final SliderSetting rotatez = new SliderSetting("rotation z", 0, -180, 180, 1, customrotation::isToggled); + + private int swing; + private static final double staticscalemultiplier_x = 1; + private static final double staticscalemultiplier_y = 1; + private static final double staticscalemultiplier_z = 1; + float staticStartSwingProgressFloat; + + public Animations() { super("Animations", category.render); - this.registerSetting(blockAnimation, swingAnimation, otherAnimation, swingWhileDigging, clientSide, fakeSlotReset, x, y, z, swingSpeed, swingSpeedWhileBlocking); + + this.registerSetting(blockAnimation, swingAnimation, otherAnimation, swingWhileDigging, clientSide, fakeSlotReset); + this.registerSetting(modifyAnimations); + this.registerSetting(staticStartSwingProgress, swingSpeed, swingSpeedWhileBlocking); + this.registerSetting(new DescriptionSetting("Custom Translation")); + this.registerSetting(translatex, translatey, translatez); + this.registerSetting(precustomtranslation, pretranslatex, pretranslatey, pretranslatez); + this.registerSetting(customscaling, scalex, scaley, scalez); + this.registerSetting(customrotation, rotatex, rotatey, rotatez); + + } @SubscribeEvent @@ -78,16 +116,41 @@ public void onRenderItem(@NotNull RenderItemEvent event) { float swingProgress = event.getSwingProgress(); final float convertedProgress = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float) Math.PI); - this.translate(x.getInput(), y.getInput(), z.getInput()); + + if(modifyAnimations.isToggled()) { + staticStartSwingProgressFloat = ((float) staticStartSwingProgress.getInput()); + } else{ + staticStartSwingProgressFloat = 0.0F; + } + + if(precustomtranslation.isToggled()) { + this.pretranslate(pretranslatex.getInput(), pretranslatey.getInput(), pretranslatez.getInput()); + + } + + if(customrotation.isToggled()) { + this.rotate((float) rotatex.getInput(), (float) rotatey.getInput(), (float) rotatez.getInput()); + + } + + if(customscaling.isToggled()) { + this.scale(1, 1, 1); + } + + + this.translate(translatex.getInput(), translatey.getInput(), translatez.getInput()); + if (event.isUseItem()) { switch (itemAction) { case NONE: switch ((int) otherAnimation.getInput()) { case 0: - itemRenderer.transformFirstPersonItem(animationProgression, 0.0F); + //none + itemRenderer.transformFirstPersonItem(animationProgression, staticStartSwingProgressFloat); break; case 1: + //1.7 itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); break; } @@ -95,17 +158,20 @@ public void onRenderItem(@NotNull RenderItemEvent event) { case BLOCK: switch ((int) blockAnimation.getInput()) { case 0: - itemRenderer.transformFirstPersonItem(animationProgression, 0.0F); + //none + itemRenderer.transformFirstPersonItem(animationProgression, staticStartSwingProgressFloat); itemRenderer.blockTransformation(); break; case 1: + //1.7 itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); itemRenderer.blockTransformation(); break; case 2: - itemRenderer.transformFirstPersonItem(animationProgression, 0.0F); + //smooth + itemRenderer.transformFirstPersonItem(animationProgression, staticStartSwingProgressFloat); final float y = -convertedProgress * 2.0F; this.translate(0.0F, y / 10.0F + 0.1F, 0.0F); GlStateManager.rotate(y * 10.0F, 0.0F, 1.0F, 0.0F); @@ -115,7 +181,8 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 3: - itemRenderer.transformFirstPersonItem(animationProgression / 2.0F, 0.0F); + //exhibition + itemRenderer.transformFirstPersonItem(animationProgression / 2.0F, staticStartSwingProgressFloat); this.translate(0.0F, 0.3F, -0.0F); GlStateManager.rotate(-convertedProgress * 31.0F, 1.0F, 0.0F, 2.0F); GlStateManager.rotate(-convertedProgress * 33.0F, 1.5F, (convertedProgress / 1.1F), 0.0F); @@ -123,6 +190,7 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 4: + //stab final float spin = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float) Math.PI); this.translate(0.6f, 0.3f, -0.6f + -spin * 0.7); @@ -134,7 +202,8 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 5: - itemRenderer.transformFirstPersonItem(animationProgression, 0.0F); + //spin + itemRenderer.transformFirstPersonItem(animationProgression, staticStartSwingProgressFloat); this.translate(0, 0.2F, -1); GlStateManager.rotate(-59, -1, 0, 3); // Don't cast as float @@ -143,16 +212,17 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 6: - itemRenderer.transformFirstPersonItem(animationProgression, 0.0F); + //sigma + itemRenderer.transformFirstPersonItem(animationProgression, staticStartSwingProgressFloat); this.translate(0.0f, 0.1F, 0.0F); itemRenderer.blockTransformation(); GlStateManager.rotate(convertedProgress * 35.0F / 2.0F, 0.0F, 1.0F, 1.5F); GlStateManager.rotate(-convertedProgress * 135.0F / 4.0F, 1.0f, 1.0F, 0.0F); - break; case 7: - itemRenderer.transformFirstPersonItem(animationProgression / 2.0F, 0.0F); + //wood + itemRenderer.transformFirstPersonItem(animationProgression / 2.0F, staticStartSwingProgressFloat); this.translate(0.0F, 0.3F, -0.0F); GlStateManager.rotate(-convertedProgress * 30.0F, 1.0F, 0.0F, 2.0F); GlStateManager.rotate(-convertedProgress * 44.0F, 1.5F, (convertedProgress / 1.2F), 0.0F); @@ -161,6 +231,7 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 8: + //swong itemRenderer.transformFirstPersonItem(animationProgression / 2.0F, swingProgress); GlStateManager.rotate(convertedProgress * 30.0F / 2.0F, -convertedProgress, -0.0F, 9.0F); GlStateManager.rotate(convertedProgress * 40.0F, 1.0F, -convertedProgress / 2.0F, -0.0F); @@ -170,6 +241,7 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 9: + //chill itemRenderer.transformFirstPersonItem(-0.25F, 1.0F + convertedProgress / 10.0F); GL11.glRotated(-convertedProgress * 25.0F, 1.0F, 0.0F, 0.0F); itemRenderer.blockTransformation(); @@ -177,6 +249,7 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 10: + //komorebi this.translate(0.41F, -0.25F, -0.5555557F); this.translate(0.0F, 0, 0.0F); GlStateManager.rotate(35.0F, 0f, 1.5F, 0.0F); @@ -191,10 +264,16 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 11: + //rhys itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); itemRenderer.blockTransformation(); this.translate(-0.3F, -0.1F, -0.0F); + break; + case 12: + //Allah + itemRenderer.transformFirstPersonItem(animationProgression, staticStartSwingProgressFloat); + itemRenderer.blockTransformation(); break; } break; @@ -202,10 +281,12 @@ public void onRenderItem(@NotNull RenderItemEvent event) { case DRINK: switch ((int) otherAnimation.getInput()) { case 0: + //none func_178104_a(mc.thePlayer.getHeldItem(), mc.thePlayer, event.getPartialTicks()); itemRenderer.transformFirstPersonItem(animationProgression, 0.0F); break; case 1: + //1.7 func_178104_a(mc.thePlayer.getHeldItem(), mc.thePlayer, event.getPartialTicks()); itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); break; @@ -214,10 +295,12 @@ public void onRenderItem(@NotNull RenderItemEvent event) { case BOW: switch ((int) otherAnimation.getInput()) { case 0: + //none itemRenderer.transformFirstPersonItem(animationProgression, 0.0F); func_178098_a(mc.thePlayer.getHeldItem(), event.getPartialTicks(), mc.thePlayer); break; case 1: + //1.7 itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); func_178098_a(mc.thePlayer.getHeldItem(), event.getPartialTicks(), mc.thePlayer); break; @@ -230,11 +313,13 @@ public void onRenderItem(@NotNull RenderItemEvent event) { } else { switch ((int) swingAnimation.getInput()) { case 0: + //none func_178105_d(swingProgress); itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); break; case 1: + //1.9+ func_178105_d(swingProgress); itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); this.translate(0, -((swing - 1) - @@ -242,16 +327,19 @@ public void onRenderItem(@NotNull RenderItemEvent event) { break; case 2: + //smooth itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); func_178105_d(animationProgression); break; case 3: + //punch itemRenderer.transformFirstPersonItem(animationProgression, swingProgress); func_178105_d(swingProgress); break; case 4: + //shove itemRenderer.transformFirstPersonItem(animationProgression, animationProgression); func_178105_d(swingProgress); break; @@ -277,23 +365,66 @@ public void onPreMotion(PreMotionEvent event) { @SubscribeEvent public void onSwingAnimation(@NotNull SwingAnimationEvent event) { - if (mc.thePlayer.getItemInUseCount() == 1 || mc.thePlayer.isUsingItem()) { + + if ((mc.thePlayer.getItemInUseCount() == 1 || mc.thePlayer.isUsingItem()) && modifyAnimations.isToggled()) { event.setAnimationEnd((int) (event.getAnimationEnd() * ((-swingSpeedWhileBlocking.getInput() / 100) + 1))); } else { event.setAnimationEnd((int) (event.getAnimationEnd() * ((-swingSpeed.getInput() / 100) + 1))); } } + private void translate(double x, double y, double z) { GlStateManager.translate( - x + this.x.getInput(), - y + this.y.getInput(), - z + this.z.getInput() + x + this.translatex.getInput(), + y + this.translatey.getInput(), + z + this.translatez.getInput() ); } + private void pretranslate(double x, double y, double z) { + GlStateManager.translate( + x + this.pretranslatex.getInput(), + y + this.pretranslatey.getInput(), + z + this.pretranslatez.getInput() + ); + } + + private void scale(double staticscalemultiplier_x, double staticscalemultiplier_y, double staticscalemultiplier_z) { + GlStateManager.scale( + staticscalemultiplier_x * this.scalex.getInput(), + staticscalemultiplier_y * this.scaley.getInput(), + staticscalemultiplier_z * this.scalez.getInput() + ); + } + + private void rotate(float rotatex, float rotatey, float rotatez) { + //x rotation + GlStateManager.rotate( + (float) this.rotatex.getInput(), + 1, + 0, + 0 + ); + + //y rotation + GlStateManager.rotate( + (float) this.rotatey.getInput(), + 0, + 1, + 0 + ); + + //z rotation + GlStateManager.rotate( + (float) this.rotatez.getInput(), + 0, + 0, + 1 + ); + } /** - * @see net.minecraft.client.renderer.ItemRenderer#func_178105_d(float swingProgress) + //* @see net.minecraft.client.renderer.ItemRenderer#func_178105_d(float swingProgress) */ private void func_178105_d(float swingProgress) { float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * 3.1415927F); @@ -303,7 +434,7 @@ private void func_178105_d(float swingProgress) { } /** - * @see net.minecraft.client.renderer.ItemRenderer#func_178104_a(AbstractClientPlayer player, float swingProgress) + //* @see net.minecraft.client.renderer.ItemRenderer#func_178104_a(AbstractClientPlayer player, float swingProgress) */ private void func_178104_a(ItemStack itemToRender, @NotNull AbstractClientPlayer p_178104_1_, float p_178104_2_) { if (itemToRender == null) return; @@ -324,7 +455,7 @@ private void func_178104_a(ItemStack itemToRender, @NotNull AbstractClientPlayer } /** - * @see net.minecraft.client.renderer.ItemRenderer#func_178098_a(float, AbstractClientPlayer) + //* @see net.minecraft.client.renderer.ItemRenderer#func_178098_a(float, AbstractClientPlayer) */ private void func_178098_a(@NotNull ItemStack itemToRender, float p_178098_1_, @NotNull AbstractClientPlayer p_178098_2_) { GlStateManager.rotate(-18.0F, 0.0F, 0.0F, 1.0F); diff --git a/src/main/java/keystrokesmod/module/impl/render/CustomFOV.java b/src/main/java/keystrokesmod/module/impl/render/CustomFOV.java new file mode 100644 index 00000000..02a90565 --- /dev/null +++ b/src/main/java/keystrokesmod/module/impl/render/CustomFOV.java @@ -0,0 +1,61 @@ +package keystrokesmod.module.impl.render; + + +import keystrokesmod.event.WorldChangeEvent; +import keystrokesmod.module.Module; +import keystrokesmod.module.ModuleManager; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.SliderSetting; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.client.event.FOVUpdateEvent; + + +public class CustomFOV extends Module { + + + private float savedFOVSetting; + + private static final SliderSetting setFOV = new SliderSetting("FOV:", 70, 1, 179, 1); + public final ButtonSetting forceStaticFOV = new ButtonSetting("Static", false); + + public CustomFOV() { + super("CustomFOV", category.render); + //this.registerSetting(new DescriptionSetting("Currently very broken")); + this.registerSetting(setFOV); + this.registerSetting(forceStaticFOV); + } + + @Override + public void onEnable() { + savedFOVSetting = mc.gameSettings.fovSetting; + + mc.gameSettings.fovSetting = (float) setFOV.getInput(); + } + + @Override + public void onDisable() { + mc.gameSettings.fovSetting = savedFOVSetting; + } + + @SubscribeEvent + public void onWorldChangeEvent(WorldChangeEvent event) { + mc.gameSettings.fovSetting = (float) setFOV.getInput(); + } + + @SubscribeEvent + public void onFOVUpdateEvent(FOVUpdateEvent event) { + mc.gameSettings.fovSetting = (float) setFOV.getInput(); + } + + public static float getDesiredFOV() { + return (float) setFOV.getInput(); + } + + + + + + + + +}