From 1ac99bf21446f4c0ff386ac127be4df3678bfa92 Mon Sep 17 00:00:00 2001 From: Spamidpaewfew2 <87201477+Spamidpaewfew2@users.noreply.github.com> Date: Sun, 9 Jul 2023 15:45:41 +0100 Subject: [PATCH] Changed mod configuration & added new directory --- .github/workflows/main.yml | 3 ++- Changelog.md | 2 +- src/main/java/arozxmod/Autoclicker.java | 8 +++---- src/main/java/arozxmod/BoatFlying.java | 11 +++++++++ src/main/java/arozxmod/ClientInitializer.java | 10 ++++---- .../arozxmod/{ArozxMod.java => Config.java} | 2 +- src/main/java/arozxmod/Flying.java | 8 ++----- src/main/java/arozxmod/NightVision.java | 2 +- .../mixin/FishingBobberEntityMixin.java | 4 ++-- .../arozxmod/mixin/GameMenuScreenMixin.java | 4 ++-- .../arozxmod/{ => screens}/ArozxScreen.java | 23 ++++++++++--------- .../{ => screens}/AutoclickerScreen.java | 16 +++++++------ 12 files changed, 52 insertions(+), 41 deletions(-) rename src/main/java/arozxmod/{ArozxMod.java => Config.java} (94%) rename src/main/java/arozxmod/{ => screens}/ArozxScreen.java (83%) rename src/main/java/arozxmod/{ => screens}/AutoclickerScreen.java (84%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2ca3795..319fb0a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,8 @@ jobs: matrix: # Use these Java versions java: [ - 17, # Current Java LTS & minimum supported by Minecraft + 17, # Current Java LTS & minimum supported by Minecraft + 20, # Latest Java stable release supported by Minecraft ] # and run on both Linux and Windows os: [ubuntu-22.04, windows-2022] diff --git a/Changelog.md b/Changelog.md index faf2bfd..ab31f36 100644 --- a/Changelog.md +++ b/Changelog.md @@ -15,7 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Moved autoclicker to new menu - Updated fabric.mod.json - Changed classtypes in ArozxScreen.java - +- Added ability to have a fixed cps ## [1.0.1] - 2023-07-05 diff --git a/src/main/java/arozxmod/Autoclicker.java b/src/main/java/arozxmod/Autoclicker.java index b93a156..01107ee 100644 --- a/src/main/java/arozxmod/Autoclicker.java +++ b/src/main/java/arozxmod/Autoclicker.java @@ -25,8 +25,8 @@ public class Autoclicker { public static void onUpdate() { assert MinecraftClient.getInstance().player != null; - if (ArozxMod.autoclickerEnabledL) { - if (ArozxMod.cpsEnabled) { + if (Config.autoclickerEnabledL) { + if (Config.cpsEnabled) { if (count > 0) { cps = 20/cps; count--; @@ -53,8 +53,8 @@ public static void onUpdate() { } } // Right autoclicker - if (ArozxMod.autoclickerEnabledR) { - if (ArozxMod.cpsEnabled) { + if (Config.autoclickerEnabledR) { + if (Config.cpsEnabled) { if (count > 0) { count--; } else { diff --git a/src/main/java/arozxmod/BoatFlying.java b/src/main/java/arozxmod/BoatFlying.java index 76f2eab..7827b56 100644 --- a/src/main/java/arozxmod/BoatFlying.java +++ b/src/main/java/arozxmod/BoatFlying.java @@ -5,11 +5,16 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class BoatFlying { + public static final Logger LOGGER = LoggerFactory.getLogger("BoatFlyingMod"); + private static boolean changeForwardSpeed; private static double upwardSpeed = 0.15; private static double forwardSpeed; + static int toggle = 0; public static void onUpdate() { // Check if the player is riding a vehicle @@ -26,6 +31,12 @@ public static void onUpdate() { // Up/down movement if (MinecraftClient.getInstance().options.jumpKey.isPressed()) { motionY = upwardSpeed; + if (toggle == 0 || velocity.y <= -0.035) { + toggle = 40; + // debug + LOGGER.info("Fall"+toggle); + } + toggle--; } else if (MinecraftClient.getInstance().options.sprintKey.isPressed()) { motionY = velocity.y; } diff --git a/src/main/java/arozxmod/ClientInitializer.java b/src/main/java/arozxmod/ClientInitializer.java index 12966b1..0d889c1 100644 --- a/src/main/java/arozxmod/ClientInitializer.java +++ b/src/main/java/arozxmod/ClientInitializer.java @@ -14,19 +14,19 @@ public class ClientInitializer implements ClientModInitializer { public static int count = Autoclicker.cps; public static boolean playerJoin = false; private static void onStartTick(MinecraftClient client) { - if(ArozxMod.flyingEnabled) { + if(Config.flyingEnabled) { BoatFlying.onUpdate(); } - if(ArozxMod.normalFlyingEnabled) { + if(Config.normalFlyingEnabled) { Flying.tick(client); } - if(ArozxMod.noFallEnabled && playerJoin) { + if(Config.noFallEnabled && playerJoin) { NoFall.onUpdate(client); } - if(ArozxMod.nightVisionEnabled) { + if(Config.nightVisionEnabled) { NightVision.onUpdate(client); } - if(ArozxMod.autoclickerEnabledL || ArozxMod.autoclickerEnabledR) { + if(Config.autoclickerEnabledL || Config.autoclickerEnabledR) { Autoclicker.onUpdate(); } } diff --git a/src/main/java/arozxmod/ArozxMod.java b/src/main/java/arozxmod/Config.java similarity index 94% rename from src/main/java/arozxmod/ArozxMod.java rename to src/main/java/arozxmod/Config.java index b955204..9a10997 100644 --- a/src/main/java/arozxmod/ArozxMod.java +++ b/src/main/java/arozxmod/Config.java @@ -1,6 +1,6 @@ package arozxmod; -public class ArozxMod { +public class Config { public static boolean autoFishingEnabled = false; public static boolean normalFlyingEnabled = false; public static boolean flyingEnabled = false; diff --git a/src/main/java/arozxmod/Flying.java b/src/main/java/arozxmod/Flying.java index 40fcf0b..9a56eb3 100644 --- a/src/main/java/arozxmod/Flying.java +++ b/src/main/java/arozxmod/Flying.java @@ -3,14 +3,10 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.entity.Entity; import net.minecraft.util.math.Vec3d; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class Flying { - - public static final Logger LOGGER = LoggerFactory.getLogger("FlyingMod"); - + //public static final Logger LOGGER = LoggerFactory.getLogger("FlyingMod"); static int toggle = 0; static int MAX_SPEED = 3; @@ -20,7 +16,7 @@ public class Flying { public static void tick(MinecraftClient client) { - if(client.player!=null && ArozxMod.normalFlyingEnabled) { + if(client.player!=null && Config.normalFlyingEnabled) { // debug // LOGGER.info(String.valueOf(client.player)); diff --git a/src/main/java/arozxmod/NightVision.java b/src/main/java/arozxmod/NightVision.java index eab78f6..bb3d07c 100644 --- a/src/main/java/arozxmod/NightVision.java +++ b/src/main/java/arozxmod/NightVision.java @@ -20,7 +20,7 @@ public static void onUpdate(MinecraftClient client) { private static void updateGamma() { - if (ArozxMod.nightVisionEnabled) { + if (Config.nightVisionEnabled) { setGamma(16); return; } diff --git a/src/main/java/arozxmod/mixin/FishingBobberEntityMixin.java b/src/main/java/arozxmod/mixin/FishingBobberEntityMixin.java index b8559d7..cee39c2 100644 --- a/src/main/java/arozxmod/mixin/FishingBobberEntityMixin.java +++ b/src/main/java/arozxmod/mixin/FishingBobberEntityMixin.java @@ -1,6 +1,6 @@ package arozxmod.mixin; -import arozxmod.ArozxMod; +import arozxmod.Config; import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.projectile.FishingBobberEntity; import org.spongepowered.asm.mixin.Mixin; @@ -20,7 +20,7 @@ public void onTrackedDataSet(TrackedData data, CallbackInfo ci) { MinecraftClient client = MinecraftClient.getInstance(); - if (caughtFish && ArozxMod.autoFishingEnabled) { + if (caughtFish && Config.autoFishingEnabled) { client.interactionManager.interactItem(client.player, Hand.MAIN_HAND); try { diff --git a/src/main/java/arozxmod/mixin/GameMenuScreenMixin.java b/src/main/java/arozxmod/mixin/GameMenuScreenMixin.java index 61e7929..de57a9f 100644 --- a/src/main/java/arozxmod/mixin/GameMenuScreenMixin.java +++ b/src/main/java/arozxmod/mixin/GameMenuScreenMixin.java @@ -1,7 +1,7 @@ package arozxmod.mixin; -import arozxmod.ArozxScreen; -import arozxmod.AutoclickerScreen; +import arozxmod.screens.ArozxScreen; +import arozxmod.screens.AutoclickerScreen; import net.minecraft.client.gui.screen.GameMenuScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; diff --git a/src/main/java/arozxmod/ArozxScreen.java b/src/main/java/arozxmod/screens/ArozxScreen.java similarity index 83% rename from src/main/java/arozxmod/ArozxScreen.java rename to src/main/java/arozxmod/screens/ArozxScreen.java index 4cde7eb..fe3da95 100644 --- a/src/main/java/arozxmod/ArozxScreen.java +++ b/src/main/java/arozxmod/screens/ArozxScreen.java @@ -1,5 +1,6 @@ -package arozxmod; +package arozxmod.screens; +import arozxmod.Config; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.screen.Screen; @@ -18,31 +19,31 @@ public ArozxScreen(Screen parent, GameOptions gameOptions) { } Text autoFishingText() { - if (ArozxMod.autoFishingEnabled) + if (Config.autoFishingEnabled) return (Text.literal("Autofishing enabled")); else return (Text.literal("Autofishing disabled")); } Text flyingText() { - if (ArozxMod.normalFlyingEnabled) + if (Config.normalFlyingEnabled) return (Text.literal("Flying enabled")); else return (Text.literal("Flying disabled")); } Text boatText() { - if (ArozxMod.flyingEnabled) + if (Config.flyingEnabled) return (Text.literal("Boat flying enabled")); else return (Text.literal("Boat flying disabled")); } Text noFallText() { - if (ArozxMod.noFallEnabled) + if (Config.noFallEnabled) return (Text.literal("No fall enabled")); else return (Text.literal("No fall disabled")); } Text nightVisionText() { - if (ArozxMod.nightVisionEnabled) + if (Config.nightVisionEnabled) return (Text.literal("Night vision enabled")); else return (Text.literal("Night vision disabled")); @@ -53,31 +54,31 @@ protected void init() { // Night vision button this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 6, 200, 20, nightVisionText(), (button) -> { - ArozxMod.nightVisionEnabled = !ArozxMod.nightVisionEnabled; + Config.nightVisionEnabled = !Config.nightVisionEnabled; button.setMessage(nightVisionText()); })); // Autofishing button this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 34, 200, 20, autoFishingText(), (button) -> { - ArozxMod.autoFishingEnabled = !ArozxMod.autoFishingEnabled; + Config.autoFishingEnabled = !Config.autoFishingEnabled; button.setMessage(autoFishingText()); })); // Flying button this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 62, 200, 20, flyingText(), (button) -> { - ArozxMod.normalFlyingEnabled = !ArozxMod.normalFlyingEnabled; + Config.normalFlyingEnabled = !Config.normalFlyingEnabled; button.setMessage(flyingText()); })); // Boat flying button this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 90, 200, 20, boatText(), (button) -> { - ArozxMod.flyingEnabled = !ArozxMod.flyingEnabled; + Config.flyingEnabled = !Config.flyingEnabled; button.setMessage(boatText()); })); // No fall button this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 118, 200, 20, noFallText(), (button) -> { - ArozxMod.noFallEnabled = !ArozxMod.noFallEnabled; + Config.noFallEnabled = !Config.noFallEnabled; button.setMessage(noFallText()); })); // Back button diff --git a/src/main/java/arozxmod/AutoclickerScreen.java b/src/main/java/arozxmod/screens/AutoclickerScreen.java similarity index 84% rename from src/main/java/arozxmod/AutoclickerScreen.java rename to src/main/java/arozxmod/screens/AutoclickerScreen.java index f43051a..852890d 100644 --- a/src/main/java/arozxmod/AutoclickerScreen.java +++ b/src/main/java/arozxmod/screens/AutoclickerScreen.java @@ -1,5 +1,7 @@ -package arozxmod; +package arozxmod.screens; +import arozxmod.Config; +import arozxmod.Autoclicker; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.gui.screen.Screen; @@ -18,19 +20,19 @@ public AutoclickerScreen(Screen parent, GameOptions gameOptions) { } Text autoclickerTextL() { - if (ArozxMod.autoclickerEnabledL) + if (Config.autoclickerEnabledL) return (Text.literal("Left autoclicker enabled")); else return (Text.literal("Left autoclicker disabled")); } Text autoclickerTextR() { - if (ArozxMod.autoclickerEnabledR) + if (Config.autoclickerEnabledR) return (Text.literal("Right autoclicker enabled")); else return (Text.literal("Right autoclicker disabled")); } Text cpsText() { - if (ArozxMod.cpsEnabled) + if (Config.cpsEnabled) return (Text.literal("Custom cps enabled")); else return (Text.literal("Custom cps disabled")); @@ -42,19 +44,19 @@ protected void init() { this.addDrawableChild(new ButtonWidget(this.width / 2 - 150, this.height / 6 + 118, 150, 20, cpsText(), (button) -> { Autoclicker.cps =5; - ArozxMod.cpsEnabled = !ArozxMod.cpsEnabled; + Config.cpsEnabled = !Config.cpsEnabled; button.setMessage(cpsText()); })); // Right autoclicker button this.addDrawableChild(new ButtonWidget(this.width / 2, this.height / 6 + 146, 150, 20, autoclickerTextR(), (button) -> { - ArozxMod.autoclickerEnabledR = !ArozxMod.autoclickerEnabledR; + Config.autoclickerEnabledR = !Config.autoclickerEnabledR; button.setMessage(autoclickerTextR()); })); // Left autoclicker button this.addDrawableChild(new ButtonWidget(this.width / 2 - 150, this.height / 6 + 146, 150, 20, autoclickerTextL(), (button) -> { - ArozxMod.autoclickerEnabledL = !ArozxMod.autoclickerEnabledL; + Config.autoclickerEnabledL = !Config.autoclickerEnabledL; button.setMessage(autoclickerTextL()); })); // Back button