forked from ChomeNS/chipmunkmod
Compare commits
3 commits
4dbf7925cc
...
98ec1f7741
Author | SHA1 | Date | |
---|---|---|---|
98ec1f7741 | |||
9260fb46b2 | |||
8b6b7b71fc |
26 changed files with 277 additions and 71 deletions
|
@ -12,7 +12,6 @@ import java.util.HashMap;
|
|||
|
||||
public class Configuration {
|
||||
public CommandManager commands = new CommandManager();
|
||||
public CommandCore core = new CommandCore();
|
||||
public Bots bots = new Bots();
|
||||
public CustomChat customChat = new CustomChat();
|
||||
public AntiSpam antiSpam = new AntiSpam();
|
||||
|
@ -26,10 +25,6 @@ public class Configuration {
|
|||
public String prefix = ".";
|
||||
}
|
||||
|
||||
public static class CommandCore {
|
||||
public SimpleBlockArea relativeArea = new SimpleBlockArea(new SimpleBlockPos(0, 0, 0), new SimpleBlockPos(15, 0, 15));
|
||||
}
|
||||
|
||||
public static class Bots {
|
||||
public BotInfo hbot = new BotInfo("#", null);
|
||||
public BotInfo sbot = new BotInfo(":", null);
|
||||
|
|
|
@ -37,8 +37,8 @@ public class CommandManager {
|
|||
SayCommand.register(this.dispatcher);
|
||||
AutoSkinCommand.register(this.dispatcher);
|
||||
ReloadConfigCommand.register(this.dispatcher);
|
||||
// LoopCrouchCommand.register(this.dispatcher); // ^???????????????????
|
||||
DebugCommand.register(this.dispatcher);
|
||||
SelfCareCommand.register(this.dispatcher);
|
||||
ClearAntiChatSpamQueueCommand.register(this.dispatcher);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.mojang.brigadier.Command;
|
|||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import land.chipmunk.chipmunkmod.modules.CustomChat;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.fun.CustomChatModule;
|
||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
|
@ -39,6 +40,7 @@ public class CustomChatCommand {
|
|||
final FabricClientCommandSource source = context.getSource();
|
||||
final boolean bool = getBool(context, "boolean");
|
||||
CustomChat.INSTANCE.enabled = bool;
|
||||
CustomChatModule.INSTANCE.isEnabled = bool;
|
||||
source.sendFeedback(Text.literal("Custom chat is now " + (bool ? "on" : "off")));
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
|
|
|
@ -2,10 +2,21 @@ package land.chipmunk.chipmunkmod.commands;
|
|||
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import land.chipmunk.chipmunkmod.ChipmunkMod;
|
||||
import land.chipmunk.chipmunkmod.modules.SelfCare;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.anti_annoyances.SelfCareModule;
|
||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.text.Text;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mojang.brigadier.arguments.BoolArgumentType.bool;
|
||||
import static com.mojang.brigadier.arguments.BoolArgumentType.getBool;
|
||||
|
@ -13,6 +24,8 @@ import static land.chipmunk.chipmunkmod.command.CommandManager.argument;
|
|||
import static land.chipmunk.chipmunkmod.command.CommandManager.literal;
|
||||
|
||||
public class SelfCareCommand {
|
||||
private static final Logger log = LoggerFactory.getLogger(SelfCareCommand.class);
|
||||
|
||||
public static void register (CommandDispatcher<FabricClientCommandSource> dispatcher) {
|
||||
dispatcher.register(
|
||||
literal("selfcare")
|
||||
|
@ -44,6 +57,57 @@ public class SelfCareCommand {
|
|||
.executes(m -> setSelfCare(m, "icu"))
|
||||
)
|
||||
)
|
||||
.then(
|
||||
literal("skin")
|
||||
.then(
|
||||
argument("skin", StringArgumentType.string())
|
||||
.executes(context -> {
|
||||
final FabricClientCommandSource source = context.getSource();
|
||||
final String skin = StringArgumentType.getString(context, "skin");
|
||||
|
||||
SelfCare.INSTANCE.hasSkin = false;
|
||||
SelfCare.INSTANCE.skin = skin;
|
||||
if(skin.equals("off")) {
|
||||
SelfCareModule.INSTANCE.skinOption.setOptionValue(false);
|
||||
source.sendFeedback(Text.literal("Disabled skin self care"));
|
||||
} else {
|
||||
SelfCareModule.INSTANCE.skinOption.setOptionValue(true);
|
||||
SelfCareModule.INSTANCE.skinUsernameOption.setOptionValue(skin);
|
||||
source.sendFeedback(Text.literal("Skin self care enabled for " + skin + "'s skin"));
|
||||
}
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
})
|
||||
.suggests((context, builder) -> {
|
||||
List<String> possibilities = new ArrayList<>();
|
||||
possibilities.add("off");
|
||||
|
||||
String currentContext;
|
||||
try {
|
||||
currentContext = StringArgumentType.getString(context, "skin");
|
||||
} catch(IllegalArgumentException e) {
|
||||
currentContext = "";
|
||||
}
|
||||
ClientPlayNetworkHandler networkHandler = MinecraftClient.getInstance().getNetworkHandler();
|
||||
if(networkHandler == null) {
|
||||
// probably impossible, but can't hurt having this
|
||||
possibilities.add(ChipmunkMod.CONFIG.defaultUsername);
|
||||
} else {
|
||||
for(PlayerListEntry player : networkHandler.getPlayerList()) {
|
||||
log.info("Found possibility {}", player.getProfile().getName());
|
||||
possibilities.add(player.getProfile().getName());
|
||||
}
|
||||
}
|
||||
|
||||
for(String possibility : possibilities) {
|
||||
if(possibility.toLowerCase().startsWith(currentContext.toLowerCase())) {
|
||||
builder.suggest(possibility);
|
||||
}
|
||||
}
|
||||
return builder.buildFuture();
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -55,18 +119,22 @@ public class SelfCareCommand {
|
|||
switch (type) {
|
||||
case "op" -> {
|
||||
SelfCare.INSTANCE.opEnabled = bool;
|
||||
SelfCareModule.INSTANCE.opOption.setOptionValue(bool);
|
||||
source.sendFeedback(Text.literal("The op self care is now " + (bool ? "enabled" : "disabled")));
|
||||
}
|
||||
case "gamemode" -> {
|
||||
SelfCare.INSTANCE.gamemodeEnabled = bool;
|
||||
SelfCareModule.INSTANCE.gmcOption.setOptionValue(bool);
|
||||
source.sendFeedback(Text.literal("The gamemode self care is now " + (bool ? "enabled" : "disabled")));
|
||||
}
|
||||
case "cspy" -> {
|
||||
SelfCare.INSTANCE.cspyEnabled = bool;
|
||||
SelfCareModule.INSTANCE.cspyOption.setOptionValue(bool);
|
||||
source.sendFeedback(Text.literal("The CommandSpy self care is now " + (bool ? "enabled" : "disabled")));
|
||||
}
|
||||
case "icu" -> {
|
||||
SelfCare.INSTANCE.icuEnabled = bool;
|
||||
SelfCareModule.INSTANCE.icuOption.setOptionValue(bool);
|
||||
source.sendFeedback(Text.literal("The iControlU self care is now " + (bool ? "enabled" : "disabled")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.spongepowered.asm.mixin.Unique;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(net.minecraft.client.gui.hud.ChatHud.class)
|
||||
public abstract class ChatHudMixin {
|
||||
|
@ -72,7 +71,7 @@ public abstract class ChatHudMixin {
|
|||
@Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", cancellable = true)
|
||||
public void chipmunkmod$generalAddMessageMixin(Text message, MessageSignatureData signatureData, MessageIndicator indicator, CallbackInfo ci) {
|
||||
ChatHudLine chatHudLine = new ChatHudLine(this.client.inGameHud.getTicks(), message, signatureData, indicator);
|
||||
if(AntiChatSpamModule.instance.isEnabled && message.equals(AntiChatSpamModule.latestPassedThroughMessage)) {
|
||||
if(AntiChatSpamModule.INSTANCE.isEnabled && message.equals(AntiChatSpamModule.latestPassedThroughMessage)) {
|
||||
AntiChatSpamModule.latestPassedThroughMessage = Text.empty();
|
||||
customLogChatMessage(chatHudLine);
|
||||
addVisibleMessage(chatHudLine);
|
||||
|
@ -102,7 +101,7 @@ public abstract class ChatHudMixin {
|
|||
// if(pattern.pattern().matcher(message.getString()).matches()) ci.cancel();
|
||||
// }
|
||||
// ChipmunkMod.LOGGER.info("gex3");
|
||||
if(AntiChatSpamModule.instance.isEnabled) {
|
||||
if(AntiChatSpamModule.INSTANCE.isEnabled) {
|
||||
Executor.antiChatSpamService.submit(() -> {
|
||||
try {
|
||||
Debug.debug("started a run or wahever", "AntiChatSpam.addMessage.future");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package land.chipmunk.chipmunkmod.mixin;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import land.chipmunk.chipmunkmod.listeners.Listener;
|
||||
import land.chipmunk.chipmunkmod.listeners.ListenerManager;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.lag_prevention.AntiParticleKickModule;
|
||||
|
@ -56,7 +55,7 @@ public class ClientConnectionMixin {
|
|||
// mabe mabe mabe
|
||||
// lol i had my own im just gonna cop ypaste that :D
|
||||
if(packet instanceof ParticleS2CPacket) {
|
||||
if(AntiParticleKickModule.instance.isEnabled && ((ParticleS2CPacket) packet).getCount()>1000) {
|
||||
if(AntiParticleKickModule.INSTANCE.isEnabled && ((ParticleS2CPacket) packet).getCount()>1000) {
|
||||
if(((ParticleS2CPacket) packet).getCount()>1000) Chat.sendGold("ChipmunkMod prevented a particle kick!");
|
||||
ci.cancel();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
public class ElderGuardianAppearanceParticleMixin {
|
||||
@Inject(method = "createParticle(Lnet/minecraft/particle/SimpleParticleType;Lnet/minecraft/client/world/ClientWorld;DDDDDD)Lnet/minecraft/client/particle/Particle;", at = @At("HEAD"), cancellable = true)
|
||||
private void testClient$limitGuardianParticles(SimpleParticleType defaultParticleType, ClientWorld clientWorld, double d, double e, double f, double g, double h, double i, CallbackInfoReturnable<Particle> cir) {
|
||||
if(BlockGuardianParticlesModule.instance.isEnabled || SharedVariables.elderGuardianParticleTimer > 0) {
|
||||
if(BlockGuardianParticlesModule.INSTANCE.isEnabled || SharedVariables.elderGuardianParticleTimer > 0) {
|
||||
cir.setReturnValue(null);
|
||||
cir.cancel();
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ public class FontStorageMixin {
|
|||
|
||||
@Inject(method = "getObfuscatedGlyphRenderer", at = @At("HEAD"), cancellable = true)
|
||||
private void chipmunkmod$preventObfuscatedGlyphLag(Glyph glyph, CallbackInfoReturnable<GlyphRenderer> cir) {
|
||||
if(!AntiTextObfuscationLagModule.instance.isEnabled) return;
|
||||
if(AntiTextObfuscationLagModule.instance.exceededLimitThisTick || Instant.now().toEpochMilli() - AntiTextObfuscationLagModule.instance.renderTimeStart.toEpochMilli() > 18) {
|
||||
AntiTextObfuscationLagModule.instance.exceededLimitThisTick = true;
|
||||
if(!AntiTextObfuscationLagModule.INSTANCE.isEnabled) return;
|
||||
if(AntiTextObfuscationLagModule.INSTANCE.exceededLimitThisTick || Instant.now().toEpochMilli() - AntiTextObfuscationLagModule.INSTANCE.renderTimeStart.toEpochMilli() > 18) {
|
||||
AntiTextObfuscationLagModule.INSTANCE.exceededLimitThisTick = true;
|
||||
cir.setReturnValue(blankGlyphRenderer);
|
||||
}
|
||||
// Debug.debug("Render time: "+(Instant.now().toEpochMilli() - AntiTextObfuscationLagModule.instance.renderTimeStart.toEpochMilli()), "AntiTextObfuscationLag.mixin");
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.time.Instant;
|
|||
public class WorldRendererMixin {
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
private void chipmunkmod$saveRenderStartTime(CallbackInfo ci) {
|
||||
AntiTextObfuscationLagModule.instance.renderTimeStart = Instant.now();
|
||||
AntiTextObfuscationLagModule.instance.exceededLimitThisTick = false;
|
||||
AntiTextObfuscationLagModule.INSTANCE.renderTimeStart = Instant.now();
|
||||
AntiTextObfuscationLagModule.INSTANCE.exceededLimitThisTick = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import land.chipmunk.chipmunkmod.ChipmunkMod;
|
|||
import land.chipmunk.chipmunkmod.data.BlockArea;
|
||||
import land.chipmunk.chipmunkmod.listeners.Listener;
|
||||
import land.chipmunk.chipmunkmod.listeners.ListenerManager;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.other.CommandCoreModule;
|
||||
import land.chipmunk.chipmunkmod.util.MathUtilities;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.CommandBlock;
|
||||
|
@ -50,6 +51,7 @@ public class CommandCore {
|
|||
|
||||
final TimerTask task = new TimerTask() {
|
||||
public void run () {
|
||||
if(!CommandCoreModule.INSTANCE.isEnabled) return;
|
||||
tick();
|
||||
}
|
||||
};
|
||||
|
@ -57,6 +59,7 @@ public class CommandCore {
|
|||
final TimerTask refillTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(!CommandCoreModule.INSTANCE.isEnabled) return;
|
||||
if (clientPlayerEntityFilled) {
|
||||
clientPlayerEntityFilled = false;
|
||||
return;
|
||||
|
@ -94,7 +97,10 @@ public class CommandCore {
|
|||
}
|
||||
|
||||
public void reloadRelativeArea () {
|
||||
noPos = ChipmunkMod.CONFIG.core.relativeArea.toBlockArea();
|
||||
noPos = new BlockArea(new BlockPos(0, 0, 0),
|
||||
new BlockPos(CommandCoreModule.INSTANCE.coreSizeX.optionValue-1,
|
||||
CommandCoreModule.INSTANCE.coreSizeY.optionValue-1,
|
||||
CommandCoreModule.INSTANCE.coreSizeZ.optionValue-1));
|
||||
}
|
||||
|
||||
public void check () {
|
||||
|
@ -217,12 +223,12 @@ public class CommandCore {
|
|||
}
|
||||
|
||||
public void run (String command) {
|
||||
// should probably throw an illegalstateexception but i dont feel like handling it everywhere
|
||||
if(!CommandCoreModule.INSTANCE.isEnabled) return;
|
||||
final ClientConnection connection = client.getNetworkHandler().getConnection();
|
||||
|
||||
if (block == null) return;
|
||||
|
||||
System.out.println(command);
|
||||
|
||||
if (KaboomCheck.INSTANCE.isKaboom) {
|
||||
connection.send(
|
||||
new UpdateCommandBlockC2SPacket(
|
||||
|
@ -262,6 +268,7 @@ public class CommandCore {
|
|||
}
|
||||
|
||||
public CompletableFuture<NbtCompound> runTracked (String command) {
|
||||
if(!CommandCoreModule.INSTANCE.isEnabled) return CompletableFuture.failedFuture(new IllegalStateException("The core is disabled!"));
|
||||
final ClientConnection connection = client.getNetworkHandler().getConnection();
|
||||
|
||||
if (block == null) return new CompletableFuture<>();
|
||||
|
|
|
@ -112,7 +112,7 @@ public class SelfCare extends Listener {
|
|||
cleanup();
|
||||
return;
|
||||
}
|
||||
if(!SelfCareModule.instance.isEnabled) return;
|
||||
if(!SelfCareModule.INSTANCE.isEnabled) return;
|
||||
|
||||
final ClientPlayerEntity player = client.player;
|
||||
if (player != null && !player.hasPermissionLevel(2) && opEnabled) { if (serverHasCommand("op")) networkHandler.sendChatCommand("op @s[type=player]"); }
|
||||
|
@ -121,7 +121,7 @@ public class SelfCare extends Listener {
|
|||
}
|
||||
|
||||
public void chatTick () {
|
||||
if(!SelfCareModule.instance.isEnabled) return;
|
||||
if(!SelfCareModule.INSTANCE.isEnabled) return;
|
||||
final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler();
|
||||
|
||||
if (!cspy && cspyEnabled) { if (serverHasCommand("c")) networkHandler.sendChatCommand("c on"); }
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package land.chipmunk.chipmunkmod.testclient.gui;
|
||||
|
||||
import land.chipmunk.chipmunkmod.testclient.gui.components.Module;
|
||||
import land.chipmunk.chipmunkmod.ChipmunkMod;
|
||||
import land.chipmunk.chipmunkmod.testclient.gui.components.Category;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.anti_annoyances.AntiChatSpamModule;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.anti_annoyances.SelfCareModule;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.fun.CustomChatModule;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.fun.RainbowNameModule;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.lag_prevention.AntiParticleKickModule;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.lag_prevention.AntiTextObfuscationLagModule;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.lag_prevention.BlockGuardianParticlesModule;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.anti_annoyances.AntiTeleportModule;
|
||||
import land.chipmunk.chipmunkmod.testclient.modules.other.CommandCoreModule;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
|
@ -159,24 +160,25 @@ Gui extends Screen{
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void addComponents() {
|
||||
new Category("Lag prevention")
|
||||
.withModule(AntiParticleKickModule.instance) //TODO: make kick prevention module
|
||||
.withModule(BlockGuardianParticlesModule.instance)
|
||||
.withModule(AntiTextObfuscationLagModule.instance)
|
||||
.withModule(AntiParticleKickModule.INSTANCE)
|
||||
.withModule(BlockGuardianParticlesModule.INSTANCE)
|
||||
.withModule(AntiTextObfuscationLagModule.INSTANCE)
|
||||
.register();
|
||||
new Category("Anti annoyances")
|
||||
.withModule(AntiChatSpamModule.instance)
|
||||
.withModule(AntiChatSpamModule.INSTANCE)
|
||||
.withModule(new AntiTeleportModule())
|
||||
.withModule(SelfCareModule.instance)
|
||||
.withModule(SelfCareModule.INSTANCE)
|
||||
.register();
|
||||
new Category("Fun")
|
||||
.withModule(RainbowNameModule.instance)
|
||||
.withModule(RainbowNameModule.INSTANCE)
|
||||
.withModule(CustomChatModule.INSTANCE)
|
||||
.register();
|
||||
new Category("Other")
|
||||
.withModule(CommandCoreModule.INSTANCE)
|
||||
.register();
|
||||
// new Category("OP")
|
||||
// .withModule(AutoOpModule.instance) //TODO: make selfcare module
|
||||
// .register();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,9 +13,11 @@ public abstract class Option<ValueType> {
|
|||
optionValue = defaultValue;
|
||||
}
|
||||
|
||||
public ModuleMemory.Option<ValueType> toMemoryOption() {return new ModuleMemory.Option<>(name, optionValue);}
|
||||
public Class<ValueType> getType() {return (Class<ValueType>) optionValue.getClass();} // ignore this error intellij has the stupid
|
||||
|
||||
// these two should match perfectly, meaning that setValueFromString(getValueAsString()); should do nothing
|
||||
public abstract void setValueFromString(String string);
|
||||
public abstract String getValueAsString();
|
||||
// these two should match perfectly, meaning that setValueFromString(getValueAsString()); should do nothing
|
||||
|
||||
public abstract void setOptionValue(ValueType optionValue);
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@ public class BooleanCheckboxOption extends Option<Boolean> {
|
|||
|
||||
@Override
|
||||
public void setValueFromString(String string) {
|
||||
optionValue = Boolean.valueOf(string);
|
||||
checkboxWidget.checked = optionValue;
|
||||
setOptionValue(Boolean.valueOf(string));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,6 +45,12 @@ public class BooleanCheckboxOption extends Option<Boolean> {
|
|||
return Boolean.toString(optionValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionValue(Boolean optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
this.checkboxWidget.checked = optionValue;
|
||||
}
|
||||
|
||||
public interface RunnableWithParameter<T> {
|
||||
void run(T value);
|
||||
}
|
||||
|
|
|
@ -56,11 +56,17 @@ public class DoubleSliderOption extends Option<Double> {
|
|||
}
|
||||
|
||||
public void setValueFromString(String string) {
|
||||
optionValue = Double.valueOf(string);
|
||||
sliderWidget.value = (optionValue - minValue) / (maxValue - minValue);
|
||||
sliderWidget.updateMessage();
|
||||
setOptionValue(Double.valueOf(string));
|
||||
}
|
||||
|
||||
public String getValueAsString() {
|
||||
return Double.toString(optionValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionValue(Double optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
sliderWidget.value = (optionValue - minValue) / (maxValue - minValue);
|
||||
sliderWidget.updateMessage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,12 @@ public class IntSliderOption extends Option<Integer> {
|
|||
|
||||
@Override
|
||||
public void setValueFromString(String string) {
|
||||
optionValue = Integer.valueOf(string);
|
||||
this.setOptionValue(Integer.valueOf(string));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionValue(Integer optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
sliderWidget.value = (double) (optionValue - minValue) / (maxValue - minValue);
|
||||
sliderWidget.updateMessage();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package land.chipmunk.chipmunkmod.testclient.gui.components.options;
|
||||
|
||||
import land.chipmunk.chipmunkmod.testclient.gui.components.Option;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class IntTextFieldOption extends Option<Integer> {
|
||||
TextFieldWidget textFieldWidget = new TextFieldWidget(MinecraftClient.getInstance().textRenderer, 200, 20, Text.empty());
|
||||
|
||||
public IntTextFieldOption(String name, Integer defaultValue) {
|
||||
super(name, defaultValue);
|
||||
textFieldWidget.setText(defaultValue.toString());
|
||||
textFieldWidget.setChangedListener(text -> {
|
||||
try {
|
||||
IntTextFieldOption.this.optionValue = Integer.valueOf(text);
|
||||
} catch(NumberFormatException ignored) {
|
||||
}
|
||||
});
|
||||
this.widget = textFieldWidget;
|
||||
}
|
||||
|
||||
public IntTextFieldOption(String name, Integer defaultValue, Consumer<Integer> onChanged) {
|
||||
super(name, defaultValue);
|
||||
textFieldWidget.setText(defaultValue.toString());
|
||||
textFieldWidget.setChangedListener(text -> {
|
||||
try {
|
||||
int i = Integer.parseInt(text);
|
||||
IntTextFieldOption.this.optionValue = i;
|
||||
onChanged.accept(i);
|
||||
} catch(NumberFormatException ignored) {
|
||||
}
|
||||
});
|
||||
this.widget = textFieldWidget;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueFromString(String string) {
|
||||
setOptionValue(Integer.valueOf(string));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueAsString() {
|
||||
return optionValue.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionValue(Integer optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
textFieldWidget.setText(optionValue.toString());
|
||||
}
|
||||
}
|
|
@ -30,7 +30,12 @@ public class StringOption extends Option<String> {
|
|||
|
||||
@Override
|
||||
public void setValueFromString(String string) {
|
||||
optionValue = string; // pro conversion
|
||||
setOptionValue(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionValue(String optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
textFieldWidget.setText(optionValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ import org.apache.commons.text.similarity.LevenshteinDistance;
|
|||
import java.util.ArrayList;
|
||||
|
||||
public class AntiChatSpamModule extends Module {
|
||||
public static Text latestPassedThroughMessage = Text.empty();
|
||||
public static AntiChatSpamModule instance = new AntiChatSpamModule();
|
||||
public ArrayList<ChatMessage> messages = new ArrayList<>();
|
||||
public static final AntiChatSpamModule INSTANCE = new AntiChatSpamModule();
|
||||
private static final String debugCallerPrefix = "AntiChatSpam.";
|
||||
private static final String debugTickedCaller = debugCallerPrefix + "tick";
|
||||
private static final String debugLevenshteinDistanceCaller = debugCallerPrefix + "levenshtein_distance";
|
||||
private static final String debugLevenshteinDistanceCallerSpamless = debugCallerPrefix + "levenshtein_distance_spamless";
|
||||
private static final String debugLevenshteinDistanceCallerSpamful = debugCallerPrefix + "levenshtein_distance_spamful";
|
||||
public static Text latestPassedThroughMessage = Text.empty();
|
||||
public ArrayList<ChatMessage> messages = new ArrayList<>();
|
||||
|
||||
public AntiChatSpamModule() {
|
||||
super("Anti chat spam");
|
||||
|
@ -44,7 +44,7 @@ public class AntiChatSpamModule extends Module {
|
|||
this.content = content;
|
||||
|
||||
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
|
||||
ArrayList<ChatMessage> chatMessages = instance.messages;
|
||||
ArrayList<ChatMessage> chatMessages = INSTANCE.messages;
|
||||
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
|
||||
int similarMessages = 0;
|
||||
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
|
||||
|
@ -80,7 +80,7 @@ public class AntiChatSpamModule extends Module {
|
|||
Debug.debug("CCCC", debugLevenshteinDistanceCallerSpamful);
|
||||
Debug.debug("Hidden: " + hidden, debugLevenshteinDistanceCaller);
|
||||
Debug.debug("Hidden: " + hidden, debugLevenshteinDistanceCallerSpamless);
|
||||
instance.messages.add(this);
|
||||
INSTANCE.messages.add(this);
|
||||
Debug.debug("CCCC", debugLevenshteinDistanceCallerSpamful);
|
||||
// threadQueue.add(() -> {
|
||||
// // code above used to be here but i cant decide if i should show it or not depending on the thread cuz i cant make it wait
|
||||
|
@ -90,7 +90,7 @@ public class AntiChatSpamModule extends Module {
|
|||
|
||||
public void tick() {
|
||||
timer--;
|
||||
if (timer <= 0) instance.messages.remove(this);
|
||||
if (timer <= 0) INSTANCE.messages.remove(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,46 +7,56 @@ import land.chipmunk.chipmunkmod.testclient.gui.components.options.BooleanCheckb
|
|||
import land.chipmunk.chipmunkmod.testclient.gui.components.options.StringOption;
|
||||
|
||||
public class SelfCareModule extends Module {
|
||||
public static SelfCareModule instance = new SelfCareModule();
|
||||
BooleanCheckboxOption opOption = new BooleanCheckboxOption(
|
||||
public static final SelfCareModule INSTANCE = new SelfCareModule();
|
||||
public BooleanCheckboxOption opOption = new BooleanCheckboxOption(
|
||||
"OP",
|
||||
SelfCare.INSTANCE.opEnabled,
|
||||
value -> SelfCare.INSTANCE.opEnabled = value
|
||||
);
|
||||
BooleanCheckboxOption gmcOption = new BooleanCheckboxOption(
|
||||
public BooleanCheckboxOption gmcOption = new BooleanCheckboxOption(
|
||||
"Creative mode",
|
||||
SelfCare.INSTANCE.gamemodeEnabled,
|
||||
value -> SelfCare.INSTANCE.gamemodeEnabled = value
|
||||
);
|
||||
BooleanCheckboxOption cspyOption = new BooleanCheckboxOption(
|
||||
public BooleanCheckboxOption cspyOption = new BooleanCheckboxOption(
|
||||
"Command spy",
|
||||
SelfCare.INSTANCE.cspyEnabled,
|
||||
value -> SelfCare.INSTANCE.cspyEnabled = value
|
||||
);
|
||||
StringOption skinUsernameOption = new StringOption(
|
||||
"Skin's username",
|
||||
ChipmunkMod.CONFIG.defaultUsername,
|
||||
s -> {
|
||||
SelfCare.INSTANCE.hasSkin = false;
|
||||
public BooleanCheckboxOption icuOption = new BooleanCheckboxOption(
|
||||
"ICU",
|
||||
SelfCare.INSTANCE.icuEnabled,
|
||||
value -> SelfCare.INSTANCE.icuEnabled = value
|
||||
);
|
||||
// split because skinUsernameOption and skinOption need to reference each other in their onChanged
|
||||
public StringOption skinUsernameOption;
|
||||
public BooleanCheckboxOption skinOption = new BooleanCheckboxOption(
|
||||
"Skin",
|
||||
SelfCare.INSTANCE.skin.equals("off"),
|
||||
value -> {
|
||||
SelfCare.INSTANCE.skin = value ? skinUsernameOption.optionValue : "off";
|
||||
}
|
||||
);
|
||||
BooleanCheckboxOption skinOption = new BooleanCheckboxOption(
|
||||
"Skin",
|
||||
SelfCare.INSTANCE.skin.equals("off")
|
||||
// value -> {
|
||||
// SelfCare.INSTANCE.skin = value ? skinUsernameOption.optionValue : "off";
|
||||
// }
|
||||
);
|
||||
|
||||
public SelfCareModule() {
|
||||
super("Self care");
|
||||
skinUsernameOption = new StringOption(
|
||||
"Skin's username",
|
||||
ChipmunkMod.CONFIG.defaultUsername,
|
||||
s -> {
|
||||
SelfCare.INSTANCE.hasSkin = false;
|
||||
SelfCare.INSTANCE.skin = skinOption.optionValue ? s : "off";
|
||||
}
|
||||
);
|
||||
withOption(opOption);
|
||||
withOption(gmcOption);
|
||||
withOption(cspyOption);
|
||||
withOption(icuOption);
|
||||
withOption(skinOption);
|
||||
withOption(skinUsernameOption);
|
||||
endTickRunnable = () -> {
|
||||
/*endTickRunnable = () -> {
|
||||
// make it update the skin self acre username
|
||||
SelfCare.INSTANCE.skin = skinOption.optionValue ? skinUsernameOption.optionValue : "off";
|
||||
};
|
||||
};*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package land.chipmunk.chipmunkmod.testclient.modules.fun;
|
||||
|
||||
import land.chipmunk.chipmunkmod.modules.CustomChat;
|
||||
import land.chipmunk.chipmunkmod.testclient.gui.components.Module;
|
||||
|
||||
public class CustomChatModule extends Module {
|
||||
public static final CustomChatModule INSTANCE = new CustomChatModule();
|
||||
|
||||
// no format option cause horrors
|
||||
|
||||
public CustomChatModule() {
|
||||
super("Custom chat");
|
||||
onActivate(() -> {
|
||||
CustomChat.INSTANCE.enabled = true;
|
||||
});
|
||||
onDeactivate(() -> {
|
||||
CustomChat.INSTANCE.enabled = false;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -8,11 +8,10 @@ import land.chipmunk.chipmunkmod.testclient.gui.components.options.IntSliderOpti
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.widget.TextWidget;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class RainbowNameModule extends Module {
|
||||
public static RainbowNameModule instance = new RainbowNameModule();
|
||||
public static final RainbowNameModule INSTANCE = new RainbowNameModule();
|
||||
public static DoubleSliderOption speedOption;
|
||||
public static IntSliderOption saturationOption;
|
||||
public static IntSliderOption valueOption;
|
||||
|
@ -53,6 +52,9 @@ public class RainbowNameModule extends Module {
|
|||
public String getValueAsString() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionValue(Void optionValue) { }
|
||||
}
|
||||
|
||||
public static class MutableTextWidget extends TextWidget {
|
||||
|
|
|
@ -3,7 +3,7 @@ package land.chipmunk.chipmunkmod.testclient.modules.lag_prevention;
|
|||
import land.chipmunk.chipmunkmod.testclient.gui.components.Module;
|
||||
|
||||
public class AntiParticleKickModule extends Module {
|
||||
public static AntiParticleKickModule instance = new AntiParticleKickModule();
|
||||
public static final AntiParticleKickModule INSTANCE = new AntiParticleKickModule();
|
||||
|
||||
public AntiParticleKickModule() {
|
||||
super("Anti particle crash");
|
||||
|
|
|
@ -5,7 +5,7 @@ import land.chipmunk.chipmunkmod.testclient.gui.components.Module;
|
|||
import java.time.Instant;
|
||||
|
||||
public class AntiTextObfuscationLagModule extends Module {
|
||||
public static AntiTextObfuscationLagModule instance = new AntiTextObfuscationLagModule();
|
||||
public static final AntiTextObfuscationLagModule INSTANCE = new AntiTextObfuscationLagModule();
|
||||
public Instant renderTimeStart = Instant.now();
|
||||
public boolean exceededLimitThisTick = false;
|
||||
public AntiTextObfuscationLagModule() {
|
||||
|
|
|
@ -5,7 +5,7 @@ import land.chipmunk.chipmunkmod.testclient.gui.components.options.StringOption;
|
|||
import land.chipmunk.chipmunkmod.util.Chat;
|
||||
|
||||
public class BlockGuardianParticlesModule extends Module {
|
||||
public static BlockGuardianParticlesModule instance = new BlockGuardianParticlesModule();
|
||||
public static final BlockGuardianParticlesModule INSTANCE = new BlockGuardianParticlesModule();
|
||||
|
||||
public BlockGuardianParticlesModule() {
|
||||
super("No guardian particles");
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package land.chipmunk.chipmunkmod.testclient.modules.other;
|
||||
|
||||
import land.chipmunk.chipmunkmod.modules.CommandCore;
|
||||
import land.chipmunk.chipmunkmod.testclient.gui.components.Module;
|
||||
import land.chipmunk.chipmunkmod.testclient.gui.components.options.IntTextFieldOption;
|
||||
|
||||
public class CommandCoreModule extends Module {
|
||||
public static final CommandCoreModule INSTANCE = new CommandCoreModule();
|
||||
public IntTextFieldOption coreSizeX = new IntTextFieldOption("Core size X", 16, ignored -> {
|
||||
CommandCore.INSTANCE.reloadRelativeArea();
|
||||
});
|
||||
public IntTextFieldOption coreSizeY = new IntTextFieldOption("Core size X", 1, ignored -> {
|
||||
CommandCore.INSTANCE.reloadRelativeArea();
|
||||
});
|
||||
public IntTextFieldOption coreSizeZ = new IntTextFieldOption("Core size X", 16, ignored -> {
|
||||
CommandCore.INSTANCE.reloadRelativeArea();
|
||||
});
|
||||
|
||||
public CommandCoreModule() {
|
||||
super("Core");
|
||||
withOption(coreSizeX);
|
||||
withOption(coreSizeY);
|
||||
withOption(coreSizeZ);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue