Skip to content

Commit

Permalink
Changed mod configuration & added new directory
Browse files Browse the repository at this point in the history
  • Loading branch information
arozx committed Jul 9, 2023
1 parent 8e47a8f commit 1ac99bf
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 41 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/arozxmod/Autoclicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
Expand All @@ -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 {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/arozxmod/BoatFlying.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/arozxmod/ClientInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/arozxmod/Flying.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/arozxmod/NightVision.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void onUpdate(MinecraftClient client) {

private static void updateGamma() {

if (ArozxMod.nightVisionEnabled) {
if (Config.nightVisionEnabled) {
setGamma(16);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/arozxmod/mixin/FishingBobberEntityMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/arozxmod/mixin/GameMenuScreenMixin.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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"));
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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"));
Expand All @@ -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
Expand Down

0 comments on commit 1ac99bf

Please sign in to comment.