Skip to content

Commit

Permalink
Version 2.0.0
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
LukeOnuke committed Jun 16, 2023
1 parent 99e7042 commit e155b6c
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 46 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 14 additions & 3 deletions src/main/java/com/lukeonuke/lukesadditions/LukesAdditions.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
Expand All @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Integer> fov = client.options.getFov();
if(isActive()){
oldFov = fov.getValue();
fov.setValue(30);
}else {
fov.setValue(oldFov);
}
}

@Override
public String getNameKey() {
return "gui.lukesAdditions.cinematicName";
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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();
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -10,7 +10,7 @@

import java.util.Objects;

public class FreeCam extends Toggleable{
public class FreeCam extends Toggleable {

private FreeCam(){

Expand Down Expand Up @@ -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";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ void target() {
}

@Override
String getName() {
public void toggleEvent() {

}
@Override
public String getNameKey() {
return "gui.lukesAdditions.attackBotName";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()){
Expand All @@ -28,6 +23,4 @@ public void tick(){
}

abstract void target();

abstract String getName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ void target() {
}

@Override
String getName() {
public void toggleEvent() {

}
@Override
public String getNameKey() {
return "gui.lukesAdditions.useBotName";
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
15 changes: 10 additions & 5 deletions src/main/resources/assets/lukes-additions/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit e155b6c

Please sign in to comment.