From e155b6c7caead9737138f66d2f1139aa491cf20f Mon Sep 17 00:00:00 2001 From: Luka Kresoja <57074484+LukeOnuke@users.noreply.github.com> Date: Fri, 16 Jun 2023 18:30:58 +0200 Subject: [PATCH] Version 2.0.0 # Additions - **Cinematic camera mode**, lowers your FOV to make it more akin to a DLSR camera. Can be toggled with `KP_SUBTRACT` (`keypad -`) - Toggle messages now display if it has been toggled on or off. # Fixes - Now use saner keyboard defaults. --- README.md | 8 +++--- gradle.properties | 2 +- .../lukesadditions/LukesAdditions.java | 17 ++++++++++--- .../lukesadditions/additions/Cinematic.java | 25 +++++++++++++++++++ .../lukesadditions/additions/Toggleable.java | 19 ++++++++++++++ .../additions/{ => freecam}/FreeCam.java | 11 +++++--- .../bot/AttackToggleableBotTarget.java | 6 ++++- .../bot/ToggleableBotTarget.java | 11 ++------ .../bot/UseToggleableBotTarget.java | 6 ++++- .../mixin/ClientPlayNetworkHandlerMixin.java | 3 +-- .../ClientPlayerInteractionManagerMixin.java | 2 +- .../lukesadditions/mixin/EntityMixin.java | 4 +-- .../mixin/EntityRenderDispatcherMixin.java | 2 +- .../mixin/GameOptionsMixin.java | 2 +- .../mixin/HeldItemRendererMixin.java | 3 +-- .../lukesadditions/mixin/InGameHudMixin.java | 2 +- .../mixin/MinecraftClientInvoker.java | 4 --- .../mixin/MinecraftClientMixin.java | 3 +-- .../mixin/PlayerEntityRendererMixin.java | 2 +- .../mixin/WorldRendererMixin.java | 2 +- .../assets/lukes-additions/lang/en_us.json | 15 +++++++---- 21 files changed, 103 insertions(+), 46 deletions(-) create mode 100644 src/main/java/com/lukeonuke/lukesadditions/additions/Cinematic.java rename src/main/java/com/lukeonuke/lukesadditions/additions/{ => freecam}/FreeCam.java (83%) diff --git a/README.md b/README.md index 7fdbd83..6bff2be 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,17 @@ Those improvements include: - Freecam - Timer use - Timer attack +- Cinematic camera mode # Configuration You can change the keybinds in minecraft's keybind settings. There is currently no way to change the interval of attack or use. The default keybinds are: -- `KP_ADD` toggle timer use. -- `KP_ENTER` toggle timer attack. -- `MOUSE_BUTTON_1` toggle freecam. +- `KP_ADD` (`keypad +`) toggle timer use. +- `KP_ENTER` (`keypad enter`) toggle timer attack. +- `KP_DECIMAL` (`keypad .`) toggle freecam. +- `KP_SUBTRACT` (`keypad -`) toggle cinematic. Intervals for the timer bots are : - use - **0.1s 2 ticks**. diff --git a/gradle.properties b/gradle.properties index f78a7d3..b0f14e8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,6 @@ loader_version=0.14.21 fabric_version=0.83.1+1.20.1 # Mod Properties -mod_version=1.1.0 +mod_version=2.0.0 maven_group=com.lukeonuke.lukesadditions archives_base_name=lukes-additions \ No newline at end of file diff --git a/src/main/java/com/lukeonuke/lukesadditions/LukesAdditions.java b/src/main/java/com/lukeonuke/lukesadditions/LukesAdditions.java index 29049c2..aeed201 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/LukesAdditions.java +++ b/src/main/java/com/lukeonuke/lukesadditions/LukesAdditions.java @@ -1,6 +1,7 @@ package com.lukeonuke.lukesadditions; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.Cinematic; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import com.lukeonuke.lukesadditions.bot.AttackToggleableBotTarget; import com.lukeonuke.lukesadditions.bot.UseToggleableBotTarget; import net.fabricmc.api.ModInitializer; @@ -22,6 +23,7 @@ public class LukesAdditions implements ModInitializer { public static KeyBinding toggleUse; public static KeyBinding toggleAttack; public static KeyBinding toggleFreeCam; + public static KeyBinding toggleCinematic; @Override public void onInitialize() { // This code runs as soon as Minecraft is in a mod-load-ready state. @@ -44,19 +46,28 @@ public void onInitialize() { toggleFreeCam = KeyBindingHelper.registerKeyBinding(new KeyBinding( "key.lukesAdditions.toggleFreeCam", // The translation key of the keybinding's name - InputUtil.Type.MOUSE, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse. - GLFW.GLFW_MOUSE_BUTTON_1, // The keycode of the key + InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse. + GLFW.GLFW_KEY_KP_DECIMAL, // The keycode of the key + "category.lukesAdditions.additions" // The translation key of the keybinding's category. + )); + + toggleCinematic = KeyBindingHelper.registerKeyBinding(new KeyBinding( + "key.lukesAdditions.toggleCinematic", // The translation key of the keybinding's name + InputUtil.Type.KEYSYM, // The type of the keybinding, KEYSYM for keyboard, MOUSE for mouse. + GLFW.GLFW_KEY_KP_SUBTRACT, // The keycode of the key "category.lukesAdditions.additions" // The translation key of the keybinding's category. )); UseToggleableBotTarget useToggleableBotTarget = new UseToggleableBotTarget(); AttackToggleableBotTarget attackToggleableBotTarget = new AttackToggleableBotTarget(); FreeCam freeCam = FreeCam.getInstance(); + Cinematic cinematic = new Cinematic(); ClientTickEvents.END_CLIENT_TICK.register(client -> { if(toggleUse.wasPressed()) useToggleableBotTarget.toggle(); if(toggleAttack.wasPressed()) attackToggleableBotTarget.toggle(); if(toggleFreeCam.wasPressed()) freeCam.toggle(); + if(toggleCinematic.wasPressed()) cinematic.toggle(); }); ClientTickEvents.END_WORLD_TICK.register(world -> { diff --git a/src/main/java/com/lukeonuke/lukesadditions/additions/Cinematic.java b/src/main/java/com/lukeonuke/lukesadditions/additions/Cinematic.java new file mode 100644 index 0000000..a4bc9ec --- /dev/null +++ b/src/main/java/com/lukeonuke/lukesadditions/additions/Cinematic.java @@ -0,0 +1,25 @@ +package com.lukeonuke.lukesadditions.additions; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.option.SimpleOption; +import net.minecraft.util.Formatting; + +public class Cinematic extends Toggleable{ + final MinecraftClient client = MinecraftClient.getInstance(); + private int oldFov; + @Override + public void toggleEvent() { + SimpleOption fov = client.options.getFov(); + if(isActive()){ + oldFov = fov.getValue(); + fov.setValue(30); + }else { + fov.setValue(oldFov); + } + } + + @Override + public String getNameKey() { + return "gui.lukesAdditions.cinematicName"; + } +} diff --git a/src/main/java/com/lukeonuke/lukesadditions/additions/Toggleable.java b/src/main/java/com/lukeonuke/lukesadditions/additions/Toggleable.java index 9cd7000..592afe1 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/additions/Toggleable.java +++ b/src/main/java/com/lukeonuke/lukesadditions/additions/Toggleable.java @@ -1,6 +1,11 @@ package com.lukeonuke.lukesadditions.additions; +import com.lukeonuke.lukesadditions.LukesAdditions; import lombok.Getter; +import net.minecraft.client.MinecraftClient; +import net.minecraft.text.Text; + +import java.util.Objects; public abstract class Toggleable { @Getter @@ -9,8 +14,22 @@ public abstract class Toggleable { public boolean toggle() { isActive = !isActive; toggleEvent(); + + MinecraftClient client = MinecraftClient.getInstance(); + if (!Objects.isNull(client.player)) + client.player.sendMessage( + Text.translatable("gui.lukesAdditions.toggle", + Text.translatable(getNameKey()).getString(), + isActive() ? + Text.translatable("gui.lukesAdditions.toggleable.on").getString() : + Text.translatable("gui.lukesAdditions.toggleable.off").getString()), + true); + LukesAdditions.LOGGER.info(""); + return isActive; } abstract public void toggleEvent(); + + public abstract String getNameKey(); } diff --git a/src/main/java/com/lukeonuke/lukesadditions/additions/FreeCam.java b/src/main/java/com/lukeonuke/lukesadditions/additions/freecam/FreeCam.java similarity index 83% rename from src/main/java/com/lukeonuke/lukesadditions/additions/FreeCam.java rename to src/main/java/com/lukeonuke/lukesadditions/additions/freecam/FreeCam.java index 869505a..dea7588 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/additions/FreeCam.java +++ b/src/main/java/com/lukeonuke/lukesadditions/additions/freecam/FreeCam.java @@ -1,6 +1,6 @@ -package com.lukeonuke.lukesadditions.additions; +package com.lukeonuke.lukesadditions.additions.freecam; -import com.lukeonuke.lukesadditions.additions.freecam.FreeCameraEntity; +import com.lukeonuke.lukesadditions.additions.Toggleable; import com.lukeonuke.lukesadditions.mixin.PlayerEntityInvoker; import lombok.Getter; import net.minecraft.client.MinecraftClient; @@ -10,7 +10,7 @@ import java.util.Objects; -public class FreeCam extends Toggleable{ +public class FreeCam extends Toggleable { private FreeCam(){ @@ -47,7 +47,10 @@ public void toggleEvent() { client.chunkCullingEnabled = !isActive(); ((PlayerEntityInvoker) client.player).invokeGetAbilities().allowModifyWorld = !isActive(); + } - client.player.sendMessage(Text.translatable("gui.lukesAdditions.toggleFreeCam"), true); + @Override + public String getNameKey() { + return "gui.lukesAdditions.freeCamName"; } } diff --git a/src/main/java/com/lukeonuke/lukesadditions/bot/AttackToggleableBotTarget.java b/src/main/java/com/lukeonuke/lukesadditions/bot/AttackToggleableBotTarget.java index 2f0ee86..68c997f 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/bot/AttackToggleableBotTarget.java +++ b/src/main/java/com/lukeonuke/lukesadditions/bot/AttackToggleableBotTarget.java @@ -12,7 +12,11 @@ void target() { } @Override - String getName() { + public void toggleEvent() { + + } + @Override + public String getNameKey() { return "gui.lukesAdditions.attackBotName"; } } diff --git a/src/main/java/com/lukeonuke/lukesadditions/bot/ToggleableBotTarget.java b/src/main/java/com/lukeonuke/lukesadditions/bot/ToggleableBotTarget.java index 216f441..664d3a5 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/bot/ToggleableBotTarget.java +++ b/src/main/java/com/lukeonuke/lukesadditions/bot/ToggleableBotTarget.java @@ -7,18 +7,13 @@ import net.minecraft.text.Text; public abstract class ToggleableBotTarget extends Toggleable { - @Getter - private final MinecraftClient minecraftClient = MinecraftClient.getInstance(); @Getter @Setter private int tickCounter = 0; - @Override - public void toggleEvent(){ - if(minecraftClient.player != null) minecraftClient.player.sendMessage(Text.translatable("gui.lukesAdditions.toggleBot", Text.translatable(getName()).getString()), true); - } - + @Getter + private MinecraftClient minecraftClient = MinecraftClient.getInstance(); public void tick(){ if(isActive()){ @@ -28,6 +23,4 @@ public void tick(){ } abstract void target(); - - abstract String getName(); } diff --git a/src/main/java/com/lukeonuke/lukesadditions/bot/UseToggleableBotTarget.java b/src/main/java/com/lukeonuke/lukesadditions/bot/UseToggleableBotTarget.java index c4a2d9c..412c1c0 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/bot/UseToggleableBotTarget.java +++ b/src/main/java/com/lukeonuke/lukesadditions/bot/UseToggleableBotTarget.java @@ -13,7 +13,11 @@ void target() { } @Override - String getName() { + public void toggleEvent() { + + } + @Override + public String getNameKey() { return "gui.lukesAdditions.useBotName"; } } diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/ClientPlayNetworkHandlerMixin.java index eca263e..cfdb3fb 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/ClientPlayNetworkHandlerMixin.java @@ -1,9 +1,8 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; -import net.minecraft.entity.damage.DamageSource; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/ClientPlayerInteractionManagerMixin.java index 7bf1c7c..a685a85 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/ClientPlayerInteractionManagerMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/ClientPlayerInteractionManagerMixin.java @@ -1,6 +1,6 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerInteractionManager; import net.minecraft.entity.Entity; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/EntityMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/EntityMixin.java index aa80f97..1d7e706 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/EntityMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/EntityMixin.java @@ -1,8 +1,6 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.LukesAdditions; -import com.lukeonuke.lukesadditions.additions.FreeCam; -import com.lukeonuke.lukesadditions.additions.freecam.FreeCameraEntity; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.MinecraftClient; import net.minecraft.entity.Entity; import net.minecraft.util.math.Vec3d; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/EntityRenderDispatcherMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/EntityRenderDispatcherMixin.java index 763f101..0b7d313 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/EntityRenderDispatcherMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/EntityRenderDispatcherMixin.java @@ -1,6 +1,6 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import com.lukeonuke.lukesadditions.additions.freecam.FreeCameraEntity; import net.minecraft.client.render.Frustum; import net.minecraft.client.render.entity.EntityRenderDispatcher; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/GameOptionsMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/GameOptionsMixin.java index ba4d212..b822451 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/GameOptionsMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/GameOptionsMixin.java @@ -1,6 +1,6 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.option.GameOptions; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/HeldItemRendererMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/HeldItemRendererMixin.java index aa778ca..09c80ba 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/HeldItemRendererMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/HeldItemRendererMixin.java @@ -1,12 +1,11 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.HeldItemRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; -import net.minecraft.util.Arm; import net.minecraft.util.Hand; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/InGameHudMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/InGameHudMixin.java index f90c782..44a5787 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/InGameHudMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/InGameHudMixin.java @@ -1,6 +1,6 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.entity.player.PlayerEntity; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/MinecraftClientInvoker.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/MinecraftClientInvoker.java index 7be7c81..f52901b 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/MinecraftClientInvoker.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/MinecraftClientInvoker.java @@ -1,12 +1,8 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; import net.minecraft.client.MinecraftClient; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(MinecraftClient.class) public interface MinecraftClientInvoker { diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/MinecraftClientMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/MinecraftClientMixin.java index 58f9427..f8f0dca 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/MinecraftClientMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/MinecraftClientMixin.java @@ -1,7 +1,6 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.LukesAdditions; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.MinecraftClient; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/PlayerEntityRendererMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/PlayerEntityRendererMixin.java index 3e7adfb..1886504 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/PlayerEntityRendererMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/PlayerEntityRendererMixin.java @@ -1,6 +1,6 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.MinecraftClient; import net.minecraft.client.model.ModelPart; import net.minecraft.client.network.AbstractClientPlayerEntity; diff --git a/src/main/java/com/lukeonuke/lukesadditions/mixin/WorldRendererMixin.java b/src/main/java/com/lukeonuke/lukesadditions/mixin/WorldRendererMixin.java index 7f121b1..f9871de 100644 --- a/src/main/java/com/lukeonuke/lukesadditions/mixin/WorldRendererMixin.java +++ b/src/main/java/com/lukeonuke/lukesadditions/mixin/WorldRendererMixin.java @@ -1,6 +1,6 @@ package com.lukeonuke.lukesadditions.mixin; -import com.lukeonuke.lukesadditions.additions.FreeCam; +import com.lukeonuke.lukesadditions.additions.freecam.FreeCam; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.*; import net.minecraft.client.util.math.MatrixStack; diff --git a/src/main/resources/assets/lukes-additions/lang/en_us.json b/src/main/resources/assets/lukes-additions/lang/en_us.json index 3a995b7..3084d60 100644 --- a/src/main/resources/assets/lukes-additions/lang/en_us.json +++ b/src/main/resources/assets/lukes-additions/lang/en_us.json @@ -1,13 +1,18 @@ { - "category.lukesAdditions.bot": "Bot", + "category.lukesAdditions.bot": "Lukes Additions - Bot", + "category.lukesAdditions.additions": "Lukes Additions - Additions", "key.lukesAdditions.toggleUseBot": "Toggle Use Bot", "key.lukesAdditions.toggleAttackBot": "Toggle Attack Bot", "key.lukesAdditions.toggleFreeCam": "Toggle FreeCam", + "key.lukesAdditions.toggleCinematic": "Toggle Cinematic FOV", - "gui.lukesAdditions.toggleBot": "§bToggled §1%s§b bot.", - "gui.lukesAdditions.useBotName": "Use", - "gui.lukesAdditions.attackBotName": "Attack", + "gui.lukesAdditions.toggle": "Toggled %s %s.", + "gui.lukesAdditions.toggleable.on": "§aON", + "gui.lukesAdditions.toggleable.off": "§cOFF", - "gui.lukesAdditions.toggleFreeCam": "§bToggled §1Freecam§r" + "gui.lukesAdditions.useBotName": "§9Use Timer Bot", + "gui.lukesAdditions.attackBotName": "§9Attack Timer Bot", + "gui.lukesAdditions.freeCamName": "§9FreeCam", + "gui.lukesAdditions.cinematicName": "§9Cinematic" } \ No newline at end of file