add loop crouch or sex.,,.,.
This commit is contained in:
parent
98689d2fa7
commit
ef1d0f4970
6 changed files with 114 additions and 6 deletions
|
@ -40,6 +40,7 @@ public class CommandManager {
|
|||
SelfCareCommand.register(this.dispatcher);
|
||||
AutoSkinCommand.register(this.dispatcher);
|
||||
ReloadConfigCommand.register(this.dispatcher);
|
||||
LoopCrouchCommand.register(this.dispatcher);
|
||||
}
|
||||
|
||||
public void executeCommand (String command) {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
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<FabricClientCommandSource> dispatcher) {
|
||||
dispatcher.register(
|
||||
literal("loopcrouch")
|
||||
.then(
|
||||
argument("enabled", bool())
|
||||
.executes(LoopCrouchCommand::run)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static int run (CommandContext<FabricClientCommandSource> 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;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
package land.chipmunk.chipmunkmod.mixin;
|
||||
|
||||
import land.chipmunk.chipmunkmod.modules.Players;
|
||||
import land.chipmunk.chipmunkmod.modules.RainbowName;
|
||||
import land.chipmunk.chipmunkmod.modules.SongPlayer;
|
||||
import land.chipmunk.chipmunkmod.modules.*;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -15,7 +13,6 @@ import net.minecraft.registry.CombinedDynamicRegistries;
|
|||
import net.minecraft.client.network.ClientDynamicRegistryType;
|
||||
import land.chipmunk.chipmunkmod.ChipmunkMod;
|
||||
import land.chipmunk.chipmunkmod.command.CommandManager;
|
||||
import land.chipmunk.chipmunkmod.modules.SelfCare;
|
||||
|
||||
@Mixin(net.minecraft.client.network.ClientPlayNetworkHandler.class)
|
||||
public class ClientPlayNetworkHandlerMixin {
|
||||
|
@ -28,12 +25,13 @@ public class ClientPlayNetworkHandlerMixin {
|
|||
|
||||
CommandManager.INSTANCE = new CommandManager(ChipmunkMod.CONFIG.commands.prefix, commandRegistryAccess);
|
||||
SelfCare.INSTANCE.init();
|
||||
LoopCrouch.INSTANCE.init();
|
||||
SongPlayer.INSTANCE.coreReady();
|
||||
RainbowName.INSTANCE.init();
|
||||
}
|
||||
|
||||
@Inject(method = "onGameJoin", at = @At("HEAD"))
|
||||
private void onGameJoiHead (GameJoinS2CPacket packet, CallbackInfo ci) {
|
||||
private void onGameJoinHead (GameJoinS2CPacket packet, CallbackInfo ci) {
|
||||
Players.INSTANCE.init();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package land.chipmunk.chipmunkmod.modules;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class LoopCrouch {
|
||||
public static final LoopCrouch INSTANCE = new LoopCrouch();
|
||||
|
||||
@Getter @Setter private boolean enabled = false;
|
||||
|
||||
@Getter @Setter private boolean sneaking = false;
|
||||
|
||||
public LoopCrouch () {
|
||||
}
|
||||
|
||||
public void init () {}
|
||||
}
|
|
@ -15,7 +15,8 @@
|
|||
"LightmapTextureManagerMixin",
|
||||
"DecoderHandlerMixin",
|
||||
"StringHelperMixin",
|
||||
"NbtIoMixin"
|
||||
"NbtIoMixin",
|
||||
"KeyboardInputMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Reference in a new issue