Skip to content

Commit

Permalink
Add keybind translations & some renames
Browse files Browse the repository at this point in the history
  • Loading branch information
RedVortexDev committed Feb 23, 2024
1 parent f405bb2 commit 908267d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
17 changes: 6 additions & 11 deletions src/main/java/dev/dfonline/codeclient/CodeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import dev.dfonline.codeclient.action.Action;
import dev.dfonline.codeclient.action.None;
import dev.dfonline.codeclient.config.Config;
import dev.dfonline.codeclient.dev.BuildClip;
import dev.dfonline.codeclient.dev.BuildPhaser;
import dev.dfonline.codeclient.dev.Debug.Debug;
import dev.dfonline.codeclient.dev.LastPos;
import dev.dfonline.codeclient.dev.NoClip;
Expand Down Expand Up @@ -34,13 +34,9 @@
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
import net.minecraft.network.packet.s2c.play.CloseScreenS2CPacket;
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.ParticleS2CPacket;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import org.apache.commons.logging.Log;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFW;
import org.slf4j.Logger;
Expand Down Expand Up @@ -74,15 +70,15 @@ public class CodeClient implements ModInitializer {
public static boolean shouldReload = false;

/**
* For all recieving packet events and debugging.
* For all receiving packet events and debugging.
* @return If the packet should be cancelled and not acted on. True to ignore.
* @param <T> Server2Client
*/
public static <T extends PacketListener> boolean handlePacket(Packet<T> packet) {

if(currentAction.onReceivePacket(packet)) return true;
if(Debug.handlePacket(packet)) return true;
if(BuildClip.handlePacket(packet)) return true;
if(BuildPhaser.handlePacket(packet)) return true;
if(ChestPeeker.handlePacket(packet)) return true;
Event.handlePacket(packet);
LastPos.handlePacket(packet);
Expand Down Expand Up @@ -116,7 +112,7 @@ public static boolean noClipOn() {
*/
public static <T extends PacketListener> boolean onSendPacket(Packet<T> packet) {
if(CodeClient.currentAction.onSendPacket(packet)) return true;
if(BuildClip.onPacket(packet)) return true;
if(BuildPhaser.onPacket(packet)) return true;
Event.onSendPacket(packet);
String name = packet.getClass().getName().replace("net.minecraft.network.packet.c2s.play.","");
if(packet instanceof CommandExecutionC2SPacket commandExecutionC2SPacket) {
Expand All @@ -133,7 +129,7 @@ public static void onTick() {

currentAction.onTick();
Debug.tick();
BuildClip.tick();
BuildPhaser.tick();
ChestPeeker.tick();
RecentChestInsert.tick();

Expand Down Expand Up @@ -196,8 +192,7 @@ public void onInitialize() {
autoJoin = AutoJoin.GAME;
}

editBind = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.codeclient.actionpallete",
editBind = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.codeclient.codepalette",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_Y,
"category.codeclient.dev"
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/dev/dfonline/codeclient/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import dev.dfonline.codeclient.action.None;
import dev.dfonline.codeclient.action.impl.*;
import dev.dfonline.codeclient.config.Config;
import dev.dfonline.codeclient.dev.BuildClip;
import dev.dfonline.codeclient.dev.LastPos;
import dev.dfonline.codeclient.dev.BuildPhaser;
import dev.dfonline.codeclient.hypercube.actiondump.ActionDump;
import dev.dfonline.codeclient.hypercube.template.Template;
import dev.dfonline.codeclient.location.*;
Expand Down Expand Up @@ -72,7 +71,7 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
dispatcher.register(literal("fixcc").executes(context -> {
CodeClient.currentAction = new None();
CodeClient.location = null;
BuildClip.disableClipping();
BuildPhaser.disableClipping();
SocketHandler.setConnection(null);
ActionDump.clear();
Config.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/dfonline/codeclient/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public YetAnotherConfigLib getLibConfig() {
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Auto Focus Search"))
.description(OptionDescription.of(Text.literal("When opening the Code Palette (").append(Text.keybind("key.codeclient.actionpallete")).append(") automatically select the search bar."),Text.literal("This is disabled because it interferes with navigation binds.")))
.description(OptionDescription.of(Text.literal("When opening the Code Palette (").append(Text.keybind("key.codeclient.codepalette")).append(") automatically select the search bar."),Text.literal("This is disabled because it interferes with navigation binds.")))
.binding(
false,
() -> FocusSearch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.player.PlayerAbilities;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtString;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
Expand All @@ -30,7 +27,7 @@
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;

public class BuildClip {
public class BuildPhaser {
private static boolean clipping = false;
public static boolean isClipping() {
return clipping;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.dfonline.codeclient.mixin.entity.player;

import dev.dfonline.codeclient.dev.BuildClip;
import dev.dfonline.codeclient.dev.BuildPhaser;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -11,6 +11,6 @@
public class MAbstractClientPlayerEntity {
@Inject(method = "isSpectator", at = @At("HEAD"), cancellable = true)
public void isSpectator(CallbackInfoReturnable<Boolean> cir) {
if(BuildClip.isClipping()) cir.setReturnValue(true);
if(BuildPhaser.isClipping()) cir.setReturnValue(true);
}
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/codeclient/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"category.codeclient.dev": "CodeClient",

"key.codeclient.codepalette": "Code Palette",
"key.codeclient.phaser": "Phaser"
}

0 comments on commit 908267d

Please sign in to comment.