From 9a92ccbfec959760deb553609f1e5c928a62045c Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 8 Jul 2023 17:18:34 +0700 Subject: [PATCH] remove some commands for some reason --- .../chipmunkmod/command/CommandManager.java | 3 - .../commands/FullBrightCommand.java | 37 ----------- .../commands/LoopCrouchCommand.java | 37 ----------- .../chipmunkmod/commands/SelfCareCommand.java | 65 ------------------- .../mixin/ClientPlayNetworkHandlerMixin.java | 1 - .../chipmunkmod/mixin/KeyboardInputMixin.java | 54 --------------- .../mixin/LightmapTextureManagerMixin.java | 16 ----- .../chipmunkmod/modules/FullBright.java | 9 --- .../chipmunkmod/modules/LoopCrouch.java | 17 ----- src/main/resources/chipmunkmod.mixins.json | 2 - 10 files changed, 241 deletions(-) delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java b/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java index c31b01a..c8cfbb0 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java +++ b/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java @@ -33,14 +33,11 @@ public class CommandManager { ItemCommand.register(this.dispatcher, commandRegistryAccess); CustomChatCommand.register(this.dispatcher); EvalCommand.register(this.dispatcher); - FullBrightCommand.register(this.dispatcher); MusicCommand.register(this.dispatcher); RainbowNameCommand.register(this.dispatcher); SayCommand.register(this.dispatcher); - SelfCareCommand.register(this.dispatcher); AutoSkinCommand.register(this.dispatcher); ReloadConfigCommand.register(this.dispatcher); - LoopCrouchCommand.register(this.dispatcher); } public void executeCommand (String command) { diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java deleted file mode 100644 index 5f76436..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -package land.chipmunk.chipmunkmod.commands; - -import com.mojang.brigadier.Command; -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.context.CommandContext; -import land.chipmunk.chipmunkmod.modules.FullBright; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.text.Text; - -import static com.mojang.brigadier.arguments.BoolArgumentType.bool; -import static com.mojang.brigadier.arguments.BoolArgumentType.getBool; -import static land.chipmunk.chipmunkmod.command.CommandManager.argument; -import static land.chipmunk.chipmunkmod.command.CommandManager.literal; - -public class FullBrightCommand { - public static void register (CommandDispatcher dispatcher) { - dispatcher.register( - literal("fullbright") - .then( - argument("boolean", bool()) - .executes(FullBrightCommand::set) - ) - ); - } - - public static int set (CommandContext context) { - final FabricClientCommandSource source = context.getSource(); - - final boolean bool = getBool(context, "boolean"); - - FullBright.enabled = bool; - - source.sendFeedback(Text.literal("Fullbright is now " + (bool ? "enabled" : "disabled"))); - - return Command.SINGLE_SUCCESS; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java deleted file mode 100644 index 4e33156..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -package land.chipmunk.chipmunkmod.commands; - -import com.mojang.brigadier.Command; -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.context.CommandContext; -import land.chipmunk.chipmunkmod.modules.LoopCrouch; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.text.Text; - -import static com.mojang.brigadier.arguments.BoolArgumentType.bool; -import static com.mojang.brigadier.arguments.BoolArgumentType.getBool; -import static land.chipmunk.chipmunkmod.command.CommandManager.argument; -import static land.chipmunk.chipmunkmod.command.CommandManager.literal; - -public class LoopCrouchCommand { - public static void register (CommandDispatcher dispatcher) { - dispatcher.register( - literal("loopcrouch") - .then( - argument("enabled", bool()) - .executes(LoopCrouchCommand::run) - ) - ); - } - - public static int run (CommandContext context) { - final FabricClientCommandSource source = context.getSource(); - - final boolean enabled = getBool(context, "enabled"); - - LoopCrouch.INSTANCE.enabled = enabled; - - source.sendFeedback(Text.literal("Loop crouch is now " + (enabled ? "enabled" : "disabled"))); - - return Command.SINGLE_SUCCESS; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java deleted file mode 100644 index d80e00f..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java +++ /dev/null @@ -1,65 +0,0 @@ -package land.chipmunk.chipmunkmod.commands; - -import com.mojang.brigadier.Command; -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.context.CommandContext; -import land.chipmunk.chipmunkmod.modules.SelfCare; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.text.Text; - -import static com.mojang.brigadier.arguments.BoolArgumentType.bool; -import static com.mojang.brigadier.arguments.BoolArgumentType.getBool; -import static land.chipmunk.chipmunkmod.command.CommandManager.argument; -import static land.chipmunk.chipmunkmod.command.CommandManager.literal; - -public class SelfCareCommand { - public static void register (CommandDispatcher dispatcher) { - dispatcher.register( - literal("selfcare") - .then( - literal("op") - .then( - argument("boolean", bool()) - .executes(m -> setSelfCare(m, "op")) - ) - ) - .then( - literal("gamemode") - .then( - argument("boolean", bool()) - .executes(m -> setSelfCare(m, "gamemode")) - ) - ) - .then( - literal("cspy") - .then( - argument("boolean", bool()) - .executes(m -> setSelfCare(m, "cspy")) - ) - ) - ); - } - - // setSelfCare is probably not a good name for this - public static int setSelfCare (CommandContext context, String type) { - final FabricClientCommandSource source = context.getSource(); - final boolean bool = getBool(context, "boolean"); - - switch (type) { - case "op" -> { - SelfCare.INSTANCE.opEnabled = bool; - source.sendFeedback(Text.literal("The op self care is now " + (bool ? "enabled" : "disabled"))); - } - case "gamemode" -> { - SelfCare.INSTANCE.gamemodeEnabled = bool; - source.sendFeedback(Text.literal("The gamemode self care is now " + (bool ? "enabled" : "disabled"))); - } - case "cspy" -> { - SelfCare.INSTANCE.cspyEnabled = bool; - source.sendFeedback(Text.literal("The CommandSpy self care is now " + (bool ? "enabled" : "disabled"))); - } - } - - return Command.SINGLE_SUCCESS; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java index 0839a98..27c8c53 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java @@ -38,7 +38,6 @@ public class ClientPlayNetworkHandlerMixin { KaboomCheck.INSTANCE.onJoin(); CommandManager.INSTANCE = new CommandManager(ChipmunkMod.CONFIG.commands.prefix, commandRegistryAccess); SelfCare.INSTANCE.onJoin(); - LoopCrouch.INSTANCE.init(); SongPlayer.INSTANCE.coreReady(); RainbowName.INSTANCE.init(); } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java deleted file mode 100644 index 5465b1d..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java +++ /dev/null @@ -1,54 +0,0 @@ -package land.chipmunk.chipmunkmod.mixin; - -import land.chipmunk.chipmunkmod.modules.LoopCrouch; -import net.minecraft.client.input.Input; -import net.minecraft.client.input.KeyboardInput; -import net.minecraft.client.option.GameOptions; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(KeyboardInput.class) -public class KeyboardInputMixin extends Input { - @Final - @Mutable - @Shadow - private final GameOptions settings; - - public KeyboardInputMixin (GameOptions settings) { - this.settings = settings; - } - - @Inject(method = "tick", at = @At("TAIL")) - private void tick (boolean slowDown, float f, CallbackInfo ci) { - this.pressingForward = this.settings.forwardKey.isPressed(); - this.pressingBack = this.settings.backKey.isPressed(); - this.pressingLeft = this.settings.leftKey.isPressed(); - this.pressingRight = this.settings.rightKey.isPressed(); - this.movementForward = getMovementMultiplier(this.pressingForward, this.pressingBack); - this.movementSideways = getMovementMultiplier(this.pressingLeft, this.pressingRight); - this.jumping = this.settings.jumpKey.isPressed(); - - // ohio code - this.sneaking = LoopCrouch.INSTANCE.enabled ? - !LoopCrouch.INSTANCE.sneaking : - this.settings.sneakKey.isPressed(); - LoopCrouch.INSTANCE.sneaking = !LoopCrouch.INSTANCE.sneaking; - - if (slowDown) { - this.movementSideways *= f; - this.movementForward *= f; - } - } - - private float getMovementMultiplier(boolean positive, boolean negative) { - if (positive == negative) { - return 0.0f; - } - return positive ? 1.0f : -1.0f; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java deleted file mode 100644 index 9512c7c..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java +++ /dev/null @@ -1,16 +0,0 @@ -package land.chipmunk.chipmunkmod.mixin; - -import land.chipmunk.chipmunkmod.modules.FullBright; -import net.minecraft.client.render.LightmapTextureManager; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; - -@Mixin(LightmapTextureManager.class) -public class LightmapTextureManagerMixin { - @ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V")) - private void update (Args args) { - if (FullBright.enabled) args.set(2, 0xFFFFFFFF); - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java b/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java deleted file mode 100644 index 6448dbe..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java +++ /dev/null @@ -1,9 +0,0 @@ -package land.chipmunk.chipmunkmod.modules; - -import land.chipmunk.chipmunkmod.ChipmunkMod; - - - -public class FullBright { - public static boolean enabled = ChipmunkMod.CONFIG.fullbright; -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java b/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java deleted file mode 100644 index bf6f6b2..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java +++ /dev/null @@ -1,17 +0,0 @@ -package land.chipmunk.chipmunkmod.modules; - - - - -public class LoopCrouch { - public static final LoopCrouch INSTANCE = new LoopCrouch(); - - public boolean enabled = false; - - public boolean sneaking = false; - - public LoopCrouch () { - } - - public void init () {} -} diff --git a/src/main/resources/chipmunkmod.mixins.json b/src/main/resources/chipmunkmod.mixins.json index 9dd6e9e..bad472d 100644 --- a/src/main/resources/chipmunkmod.mixins.json +++ b/src/main/resources/chipmunkmod.mixins.json @@ -14,11 +14,9 @@ "ClientPlayNetworkHandlerAccessor", "ClientPlayNetworkHandlerMixin", "MinecraftClientAccessor", - "LightmapTextureManagerMixin", "DecoderHandlerMixin", "StringHelperMixin", "NbtIoMixin", - "KeyboardInputMixin", "ElderGuardianAppearanceParticleMixin", "IdentifierMixin", "DecoratedPotBlockEntitySherdsMixin",