This commit is contained in:
retuci0 committed 2026-01-17 00:33:24 +01:00
1 parent 9afaa4e0c8
commit 436b79fd2b
98 files changed
+1153 -725

No files matched your search

+12 -21
View File
@@ -11,20 +11,21 @@ base {
} }
repositories { repositories {
// Add repositories to retrieve artifacts from in here. maven {
// You should only use this when depending on other mods because name = "FDD Maven"
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. url = "https://maven.firstdark.dev/releases"
// See https://docs.gradle.org/current/userguide/declaring_repositories.html }
// for more information about repositories.
} }
dependencies { dependencies {
// To change the versions see the gradle.properties file // mc
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
// otros
include(modImplementation "dev.firstdark.discordrpc:discord-rpc:1.0.3")
} }
loom { loom {
@@ -44,11 +45,6 @@ tasks.withType(JavaCompile).configureEach {
} }
java { java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21 sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21
} }
@@ -57,11 +53,12 @@ jar {
inputs.property "archivesName", project.base.archivesName inputs.property "archivesName", project.base.archivesName
from("LICENSE") { from("LICENSE") {
rename { "${it}_${inputs.properties.archivesName}"} rename {
"${it}_${inputs.properties.archivesName}"
}
} }
} }
// configure the maven publication
publishing { publishing {
publications { publications {
create("mavenJava", MavenPublication) { create("mavenJava", MavenPublication) {
@@ -70,11 +67,5 @@ publishing {
} }
} }
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories {}
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
} }
+9 -13
View File
@@ -1,27 +1,23 @@
# v2.6 # v2.7
## novedades ## novedades
### adiciones ### adiciones
- layouts de teclado (en_us y es_es) (fuck azerty) - filtro por categoría de módulos en la barra de búsqueda
- comando `$config` para abrir el marco de ajustes de un módulo
- elemento del hud que muestra la rotación de la cámara del jugador
#### módulos nuevos: #### módulos nuevos:
- fuentes: cambia la tipografía que usa todo el juego a una custom - avioneta: vuela infinitamente usando el glitch de las elytras descubierto por Heppe, o al menos hasta que se te rompan las elytras
- escalones: actúa con la altura deseada como si se estuviesen subiendo escalones - triangulador de strongholds: usa geometría simple para calcular la intersección de las líneas creadas por los ojos de ender lanzados para obtener la posición aproximada de la stronghold más cercana
- escalones inversos: escalones, pabajo - discordrpc: personaliza la actividad de tu perfil de discord
- partículas: genera particulas artificiales
### arreglos / mejoras ### arreglos / mejoras
- ahora puedes cambiar el grosor de las líneas del contorno de los bloques - ahora se puede hacer ctrl + v para pegar en los ajustes de texto
- arreglada la compatibilidad con meteor client - el color por defecto de la superposición de daño ya es el color principal del mod
- optimizado y mejorado superposición de luz y resaltado de bloques - arreglado el elemento del HUD de rotación
- ahora, en los marcos de seleccion única, en el tooltip de cada opción dice "seleccionar" en lugar de "incluir" - arreglado los marcos de ajustes de selección
- ahora precoz también tiene una opción de reducir el cooldown al minar bloques
## problemas reconocidos ## problemas reconocidos
+1 -1
View File
@@ -8,6 +8,6 @@ loom_version=1.13-SNAPSHOT
fabric_api_version=0.140.2+1.21.11 fabric_api_version=0.140.2+1.21.11
mod_version=2.6 mod_version=2.7
maven_group=me.retucio maven_group=me.retucio
archives_base_name=sputnik archives_base_name=sputnik
@@ -33,6 +33,7 @@ import me.retucio.sputnik.util.KeyUtil;
import me.retucio.sputnik.util.render.DrawUtil; import me.retucio.sputnik.util.render.DrawUtil;
import me.retucio.sputnik.util.render.RenderUtil; import me.retucio.sputnik.util.render.RenderUtil;
import me.retucio.sputnik.util.render.Textures;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
@@ -92,6 +93,8 @@ public class Sputnik implements ClientModInitializer {
Lists.init(); Lists.init();
Textures.registerAll();
CapeManager.INSTANCE = new CapeManager(); CapeManager.INSTANCE = new CapeManager();
EVENT_BUS.post(new LoadCapeManagerEvent()); EVENT_BUS.post(new LoadCapeManagerEvent());
@@ -195,7 +198,7 @@ public class Sputnik implements ClientModInitializer {
// manejar la lógica de apertura del editor de elementos del hud, con la misma lógica que handleClickGUIKey() // manejar la lógica de apertura del editor de elementos del hud, con la misma lógica que handleClickGUIKey()
private void handleHudEditorKey(int key, boolean anyFocused) { private void handleHudEditorKey(int key, boolean anyFocused) {
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class); HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
if (key != hud.editorKey.getKey() || anyFocused || isOnTypingScreen()) return; if (key != hud.editorKey.getValue() || anyFocused || isOnTypingScreen()) return;
if (mc.currentScreen != HudEditorScreen.INSTANCE) { if (mc.currentScreen != HudEditorScreen.INSTANCE) {
if (!hud.isEnabled()) { if (!hud.isEnabled()) {
@@ -42,7 +42,7 @@ public class BindCommand extends Command {
public static boolean onKeyPress(int key) { public static boolean onKeyPress(int key) {
if (listeningModule == null) return false; if (listeningModule == null) return false;
KeySetting bind = listeningModule.getBind(); KeySetting bind = listeningModule.getBind();
if (bind != null) bind.setKey(key); if (bind != null) bind.setValue(key);
ChatUtil.info( ChatUtil.info(
Text.of("la tecla " + Formatting.AQUA + KeyUtil.getKeyName(key) + Formatting.RESET + Text.of("la tecla " + Formatting.AQUA + KeyUtil.getKeyName(key) + Formatting.RESET +
@@ -5,7 +5,6 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import me.retucio.sputnik.command.Command; import me.retucio.sputnik.command.Command;
import me.retucio.sputnik.command.args.ModuleArgumentType; import me.retucio.sputnik.command.args.ModuleArgumentType;
import me.retucio.sputnik.module.setting.Setting;
import me.retucio.sputnik.ui.screen.ClickGUI; import me.retucio.sputnik.ui.screen.ClickGUI;
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame; import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
import net.minecraft.command.CommandSource; import net.minecraft.command.CommandSource;
@@ -57,9 +57,9 @@ public class ClientConfig {
// guardar ajustes con su respectivo tipo de valor, en formato "nombreMódulo:nombreAjuste" // guardar ajustes con su respectivo tipo de valor, en formato "nombreMódulo:nombreAjuste"
Object value = null; Object value = null;
switch (event.getSetting()) { switch (event.getSetting()) {
case BooleanSetting b: value = b.isEnabled(); break; case BooleanSetting b: value = b.getValue(); break;
case EnumSetting e: value = e.getIndex(); break; case EnumSetting e: value = e.getIndex(); break;
case KeySetting k: value = k.getKey(); break; case KeySetting k: value = k.getValue(); break;
case NumberSetting n: value = n.getValue(); break; case NumberSetting n: value = n.getValue(); break;
case StringSetting s: value = s.getValue(); break; case StringSetting s: value = s.getValue(); break;
case ListSetting l: value = l.getConfigValues(); break; case ListSetting l: value = l.getConfigValues(); break;
@@ -107,7 +107,7 @@ public class ConfigManager {
save(); save();
} }
public static void setSetting(Setting setting, Object value) { public static void setSetting(Setting<?> setting, Object value) {
ensureConfig(); ensureConfig();
config.settings.put(getSettingKey(setting), value); config.settings.put(getSettingKey(setting), value);
save(); save();
@@ -150,7 +150,7 @@ public class ConfigManager {
// ------------------ APLICAR AJUSTES ------------------ // ------------------ APLICAR AJUSTES ------------------
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
public static void applySetting(Module parent, Setting setting) { public static void applySetting(Module parent, Setting<?> setting) {
String key = getSettingKey(setting); String key = getSettingKey(setting);
if (!config.settings.containsKey(key)) return; if (!config.settings.containsKey(key)) return;
@@ -249,7 +249,7 @@ public class ConfigManager {
private static void applyBooleanSetting(BooleanSetting setting, Object value) { private static void applyBooleanSetting(BooleanSetting setting, Object value) {
if (value instanceof Boolean) { if (value instanceof Boolean) {
setting.setEnabled((Boolean) value); setting.setValue((Boolean) value);
} }
} }
@@ -275,9 +275,9 @@ public class ConfigManager {
private static void applyKeySetting(KeySetting setting, Object value) { private static void applyKeySetting(KeySetting setting, Object value) {
if (value instanceof Double) { if (value instanceof Double) {
setting.setKey(((Double) value).intValue()); setting.setValue(((Double) value).intValue());
} else if (value instanceof Integer) { } else if (value instanceof Integer) {
setting.setKey((Integer) value); setting.setValue((Integer) value);
} }
} }
@@ -291,7 +291,7 @@ public class ConfigManager {
convertedValues.put(option, booleanValue instanceof Boolean && (Boolean) booleanValue); convertedValues.put(option, booleanValue instanceof Boolean && (Boolean) booleanValue);
} }
setting.setValues(convertedValues); setting.setValue(convertedValues);
} }
} }
@@ -342,7 +342,7 @@ public class ConfigManager {
if (config == null) config = new ClientConfig(); if (config == null) config = new ClientConfig();
} }
private static String getSettingKey(Setting setting) { private static String getSettingKey(Setting<?> setting) {
return setting.getSg().getModule().getName() + ":" + setting.getName(); return setting.getSg().getModule().getName() + ":" + setting.getName();
} }
@@ -6,15 +6,15 @@ import me.retucio.sputnik.module.setting.Setting;
// se genera cada que se cambia el valor de un ajuste // se genera cada que se cambia el valor de un ajuste
public class UpdateSettingEvent extends Event { public class UpdateSettingEvent extends Event {
private final Setting setting; private final Setting<?> setting;
private boolean shouldSave; private boolean shouldSave;
public UpdateSettingEvent(Setting setting, boolean shouldSave) { public UpdateSettingEvent(Setting<?> setting, boolean shouldSave) {
this.setting = setting; this.setting = setting;
this.shouldSave = shouldSave; this.shouldSave = shouldSave;
} }
public Setting getSetting() { public Setting<?> getSetting() {
return setting; return setting;
} }
@@ -59,7 +59,7 @@ public abstract class CameraMixin {
@Inject(method = "clipToSpace", at = @At("HEAD"), cancellable = true) @Inject(method = "clipToSpace", at = @At("HEAD"), cancellable = true)
private void onClipToSpace(float distance, CallbackInfoReturnable<Float> cir) { private void onClipToSpace(float distance, CallbackInfoReturnable<Float> cir) {
if (perspectivePlus.isEnabled() && perspectivePlus.clip.isEnabled()) if (perspectivePlus.isEnabled() && perspectivePlus.clip.getValue())
cir.setReturnValue(distance); cir.setReturnValue(distance);
} }
@@ -143,7 +143,7 @@ public abstract class ChatHudMixin implements IChatHud {
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/gui/hud/ChatHud$Backend;IIZ)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;ceil(F)I")) @ModifyExpressionValue(method = "render(Lnet/minecraft/client/gui/hud/ChatHud$Backend;IIZ)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;ceil(F)I"))
private int onRender_modifyWidth(int width) { private int onRender_modifyWidth(int width) {
return (chatPlus.isEnabled() && chatPlus.showHeads.isEnabled()) ? width + 10 : width; return (chatPlus.isEnabled() && chatPlus.showHeads.getValue()) ? width + 10 : width;
} }
@@ -19,6 +19,6 @@ public abstract class ChatScreenMixin {
@Inject(method = "init", at = @At(value = "RETURN")) @Inject(method = "init", at = @At(value = "RETURN"))
private void onInit(CallbackInfo info) { private void onInit(CallbackInfo info) {
ChatPlus chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class); ChatPlus chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class);
if (chatPlus.isEnabled() && chatPlus.noCharLimit.isEnabled()) chatField.setMaxLength(Integer.MAX_VALUE); if (chatPlus.isEnabled() && chatPlus.noCharLimit.getValue()) chatField.setMaxLength(Integer.MAX_VALUE);
} }
} }
@@ -55,7 +55,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
@Redirect(method = "onEntityStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;showFloatingItem(Lnet/minecraft/item/ItemStack;)V")) @Redirect(method = "onEntityStatus", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;showFloatingItem(Lnet/minecraft/item/ItemStack;)V"))
private void noRenderTotemPop(GameRenderer instance, ItemStack floatingItem) { private void noRenderTotemPop(GameRenderer instance, ItemStack floatingItem) {
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class); NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
if (!noRender.isEnabled() || noRender.totemPop.isEnabled()) if (!noRender.isEnabled() || noRender.totemPop.getValue())
mc.gameRenderer.showFloatingItem(floatingItem); mc.gameRenderer.showFloatingItem(floatingItem);
} }
} }
@@ -18,8 +18,6 @@ import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.Unique;
@@ -78,7 +76,7 @@ public abstract class ClientPlayerInteractionManagerMixin {
@Inject(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I")) @Inject(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I"))
private void modifyBlockBreakingCooldown(BlockPos pos, Direction direction, CallbackInfoReturnable<Boolean> cir) { private void modifyBlockBreakingCooldown(BlockPos pos, Direction direction, CallbackInfoReturnable<Boolean> cir) {
FastUse fastUse = ModuleManager.INSTANCE.getModuleByClass(FastUse.class); FastUse fastUse = ModuleManager.INSTANCE.getModuleByClass(FastUse.class);
if (!fastUse.isEnabled() || !fastUse.mining.isEnabled()) return; if (!fastUse.isEnabled() || !fastUse.mining.getValue()) return;
blockBreakingCooldown = fastUse.miningCooldown.getIntValue(); blockBreakingCooldown = fastUse.miningCooldown.getIntValue();
} }
} }
@@ -41,7 +41,7 @@ abstract class DamageParticleFactoryMixin {
original.velocityMultiplier *= crits.velocityMultipler.getFloatValue(); original.velocityMultiplier *= crits.velocityMultipler.getFloatValue();
original.gravityStrength *= crits.gravity.getFloatValue(); original.gravityStrength *= crits.gravity.getFloatValue();
original.setMaxAge(crits.maxAge.getIntValue()); original.setMaxAge(crits.maxAge.getIntValue());
original.collidesWithWorld = crits.collide.isEnabled(); original.collidesWithWorld = crits.collide.getValue();
return original; return original;
} }
@@ -88,7 +88,7 @@ public abstract class EntityMixin {
@ModifyReturnValue(method = "getName", at = @At("RETURN")) @ModifyReturnValue(method = "getName", at = @At("RETURN"))
private Text showProjectileDamage(Text original) { private Text showProjectileDamage(Text original) {
if (!nametags.isEnabled() || !nametags.showProjectileDamage.isEnabled()) return original; if (!nametags.isEnabled() || !nametags.showProjectileDamage.getValue()) return original;
if ((Object) this instanceof PersistentProjectileEntity arrow) { // aunque lo llame "arrow", también cubre flechas espectrales y tridentes if ((Object) this instanceof PersistentProjectileEntity arrow) { // aunque lo llame "arrow", también cubre flechas espectrales y tridentes
String damage = nametags.getArrowDamage(arrow); String damage = nametags.getArrowDamage(arrow);
@@ -101,7 +101,7 @@ public abstract class EntityMixin {
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
@ModifyReturnValue(method = "getCustomName", at = @At("RETURN")) @ModifyReturnValue(method = "getCustomName", at = @At("RETURN"))
private Text displayEntityOwner(Text original) { private Text displayEntityOwner(Text original) {
if (!nametags.isEnabled() || !nametags.petOwner.isEnabled()) return original; if (!nametags.isEnabled() || !nametags.petOwner.getValue()) return original;
if ((Object) this instanceof TameableEntity entity && entity.getOwnerReference() != null) { if ((Object) this instanceof TameableEntity entity && entity.getOwnerReference() != null) {
if (original != null) return original.copy().append(" (de " + nametags.getOwnerName(entity.getOwnerReference()) + ")"); if (original != null) return original.copy().append(" (de " + nametags.getOwnerName(entity.getOwnerReference()) + ")");
else return Text.of(nametags.getOwnerName(entity.getOwnerReference())); else return Text.of(nametags.getOwnerName(entity.getOwnerReference()));
@@ -113,7 +113,7 @@ public abstract class EntityMixin {
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
@ModifyReturnValue(method = "getName", at = @At("RETURN")) @ModifyReturnValue(method = "getName", at = @At("RETURN"))
private Text showBabies(Text original) { private Text showBabies(Text original) {
if (!nametags.isEnabled() || !nametags.distinguishBabies.isEnabled()) return original; if (!nametags.isEnabled() || !nametags.distinguishBabies.getValue()) return original;
if ((Object) this instanceof LivingEntity entity && entity.isBaby()) return original.copy().append(" (baby)"); if ((Object) this instanceof LivingEntity entity && entity.isBaby()) return original.copy().append(" (baby)");
return original; return original;
} }
@@ -33,10 +33,10 @@ public abstract class FogRendererMixin {
if (!noRender.isEnabled()) return instance.shouldApply(cameraSubmersionType, entity); if (!noRender.isEnabled()) return instance.shouldApply(cameraSubmersionType, entity);
String className = instance.getClass().getSimpleName(); String className = instance.getClass().getSimpleName();
if ((className.equals("BlindnessEffectFogModifier") && !noRender.blindnessEffect.isEnabled()) if ((className.equals("BlindnessEffectFogModifier") && !noRender.blindnessEffect.getValue())
|| (className.equals("DarknessEffectFogModifier") && !noRender.darknessEffect.isEnabled()) || (className.equals("DarknessEffectFogModifier") && !noRender.darknessEffect.getValue())
|| ((className.equals("LavaFogModifier") || className.equals("WaterFogModifier") || ((className.equals("LavaFogModifier") || className.equals("WaterFogModifier")
|| className.equals("PowederSnowFogModifier")) && !noRender.fluidOverlay.isEnabled())) || className.equals("PowederSnowFogModifier")) && !noRender.fluidOverlay.getValue()))
return false; return false;
return instance.shouldApply(cameraSubmersionType, entity); return instance.shouldApply(cameraSubmersionType, entity);
@@ -44,7 +44,7 @@ public abstract class FogRendererMixin {
@ModifyReturnValue(method = "getFogColor", at = @At("RETURN")) @ModifyReturnValue(method = "getFogColor", at = @At("RETURN"))
private Vector4f modifyLavaFog(Vector4f original, Camera camera) { private Vector4f modifyLavaFog(Vector4f original, Camera camera) {
if (noRender.isEnabled() && !noRender.fluidOverlay.isEnabled() && if (noRender.isEnabled() && !noRender.fluidOverlay.getValue() &&
(camera.getSubmersionType() == CameraSubmersionType.LAVA (camera.getSubmersionType() == CameraSubmersionType.LAVA
|| camera.getSubmersionType() == CameraSubmersionType.WATER)) || camera.getSubmersionType() == CameraSubmersionType.WATER))
return new Vector4f(original.x, original.y, original.z, 0f); return new Vector4f(original.x, original.y, original.z, 0f);
@@ -54,6 +54,6 @@ public abstract class FogRendererMixin {
@ModifyExpressionValue(method = "getFogColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getUnderwaterVisibility()F")) @ModifyExpressionValue(method = "getFogColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getUnderwaterVisibility()F"))
private float noRenderUnderwaterFog(float original) { private float noRenderUnderwaterFog(float original) {
return (noRender.isEnabled() && !noRender.fluidOverlay.isEnabled()) ? 0 : original; return (noRender.isEnabled() && !noRender.fluidOverlay.getValue()) ? 0 : original;
} }
} }
@@ -110,13 +110,13 @@ public abstract class GameRendererMixin {
@Inject(method = "renderHand", at = @At("HEAD"), cancellable = true) @Inject(method = "renderHand", at = @At("HEAD"), cancellable = true)
private void renderHand(float tickProgress, boolean sleeping, Matrix4f positionMatrix, CallbackInfo ci) { private void renderHand(float tickProgress, boolean sleeping, Matrix4f positionMatrix, CallbackInfo ci) {
if ((zoom.isEnabled() && !zoom.showHands.isEnabled()) if ((zoom.isEnabled() && !zoom.showHands.getValue())
|| (freecam.isEnabled() && !freecam.renderHands.isEnabled())) || (freecam.isEnabled() && !freecam.renderHands.getValue()))
ci.cancel(); ci.cancel();
} }
@ModifyVariable(method = "renderWorld", ordinal = 6, at = @At(value = "STORE")) @ModifyVariable(method = "renderWorld", ordinal = 6, at = @At(value = "STORE"))
private float noRenderNauseaDistortion(float scaledNauseaEffectFactor) { private float noRenderNauseaDistortion(float scaledNauseaEffectFactor) {
return (noRender.isEnabled() && !noRender.nauseaEffect.isEnabled()) ? 0 : scaledNauseaEffectFactor; return (noRender.isEnabled() && !noRender.nauseaEffect.getValue()) ? 0 : scaledNauseaEffectFactor;
} }
} }
@@ -65,19 +65,19 @@ public abstract class HeldItemRendererMixin {
@ModifyReturnValue(method = "shouldSkipHandAnimationOnSwap", at = @At("RETURN")) @ModifyReturnValue(method = "shouldSkipHandAnimationOnSwap", at = @At("RETURN"))
private boolean modifySkipSwapAnimation(boolean original) { private boolean modifySkipSwapAnimation(boolean original) {
return original || (handView.isEnabled() && handView.skipSwapping.isEnabled()); return original || (handView.isEnabled() && handView.skipSwapping.getValue());
} }
@Inject(method = "applyEatOrDrinkTransformation", at = @At(value = "INVOKE", target = "Ljava/lang/Math;pow(DD)D", shift = At.Shift.BEFORE), cancellable = true) @Inject(method = "applyEatOrDrinkTransformation", at = @At(value = "INVOKE", target = "Ljava/lang/Math;pow(DD)D", shift = At.Shift.BEFORE), cancellable = true)
private void cancelTransformations(MatrixStack matrices, float tickDelta, Arm arm, ItemStack stack, PlayerEntity player, CallbackInfo ci) { private void cancelTransformations(MatrixStack matrices, float tickDelta, Arm arm, ItemStack stack, PlayerEntity player, CallbackInfo ci) {
if (handView.isEnabled() && handView.noFood.isEnabled()) ci.cancel(); if (handView.isEnabled() && handView.noFood.getValue()) ci.cancel();
} }
@ModifyArg(method = "updateHeldItems", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F", ordinal = 2), index = 0) @ModifyArg(method = "updateHeldItems", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F", ordinal = 2), index = 0)
private float modifyEquipProgressMainhand(float value) { private float modifyEquipProgressMainhand(float value) {
if (mc.player == null) return value; if (mc.player == null) return value;
float progress = mc.player.getAttackCooldownProgress(1); float progress = mc.player.getAttackCooldownProgress(1);
float modified = handView.isEnabled() && handView.oldAnimations.isEnabled() ? 1 : (float) Math.pow(progress, 3); float modified = handView.isEnabled() && handView.oldAnimations.getValue() ? 1 : (float) Math.pow(progress, 3);
return (shouldSkipHandAnimationOnSwap(mainHand, mc.player.getMainHandStack()) ? modified : 0) - equipProgressMainHand; return (shouldSkipHandAnimationOnSwap(mainHand, mc.player.getMainHandStack()) ? modified : 0) - equipProgressMainHand;
} }
@@ -40,32 +40,32 @@ public abstract class InGameHudMixin {
@Inject(method = "renderScoreboardSidebar*", at = @At("HEAD"), cancellable = true) @Inject(method = "renderScoreboardSidebar*", at = @At("HEAD"), cancellable = true)
private void noRenderScoreboard(CallbackInfo ci) { private void noRenderScoreboard(CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.scoreboard.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.scoreboard.getValue()) ci.cancel();
} }
@Inject(method = "renderTitleAndSubtitle", at = @At("HEAD"), cancellable = true) @Inject(method = "renderTitleAndSubtitle", at = @At("HEAD"), cancellable = true)
private void noRenderTitles(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { private void noRenderTitles(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.titles.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.titles.getValue()) ci.cancel();
} }
@Inject(method = "renderNauseaOverlay", at = @At("HEAD"), cancellable = true) @Inject(method = "renderNauseaOverlay", at = @At("HEAD"), cancellable = true)
private void noRenderNausea(DrawContext context, float nauseaStrength, CallbackInfo ci) { private void noRenderNausea(DrawContext context, float nauseaStrength, CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.nauseaEffect.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.nauseaEffect.getValue()) ci.cancel();
} }
@Inject(method = "renderSpyglassOverlay", at = @At("HEAD"), cancellable = true) @Inject(method = "renderSpyglassOverlay", at = @At("HEAD"), cancellable = true)
private void noRenderSpyglass(DrawContext context, float scale, CallbackInfo ci) { private void noRenderSpyglass(DrawContext context, float scale, CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.spyglassOverlay.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.spyglassOverlay.getValue()) ci.cancel();
} }
@Inject(method = "renderPortalOverlay", at = @At("HEAD"), cancellable = true) @Inject(method = "renderPortalOverlay", at = @At("HEAD"), cancellable = true)
private void noRenderPortal(DrawContext context, float nauseaStrength, CallbackInfo ci) { private void noRenderPortal(DrawContext context, float nauseaStrength, CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.portalOverlay.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.portalOverlay.getValue()) ci.cancel();
} }
@Inject(method = "renderOverlay", at = @At("HEAD"), cancellable = true) @Inject(method = "renderOverlay", at = @At("HEAD"), cancellable = true)
private void noRenderPumpkinBlur(DrawContext context, Identifier texture, float opacity, CallbackInfo ci) { private void noRenderPumpkinBlur(DrawContext context, Identifier texture, float opacity, CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.pumpkinOverlay.isEnabled() && texture.getPath().equals("textures/misc/pumpkinblur.png")) ci.cancel(); if (noRender.isEnabled() && !noRender.pumpkinOverlay.getValue() && texture.getPath().equals("textures/misc/pumpkinblur.png")) ci.cancel();
} }
@@ -84,6 +84,6 @@ public abstract class InGameHudMixin {
@Inject(method = "clear", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;clear(Z)V"), cancellable = true) @Inject(method = "clear", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;clear(Z)V"), cancellable = true)
private void onClear(CallbackInfo ci) { private void onClear(CallbackInfo ci) {
ChatPlus chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class); ChatPlus chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class);
if (chatPlus.isEnabled() && chatPlus.keepHistory.isEnabled()) ci.cancel(); if (chatPlus.isEnabled() && chatPlus.keepHistory.getValue()) ci.cancel();
} }
} }
@@ -27,11 +27,11 @@ public abstract class InGameOverlayRendererMixin {
@Inject(method = "renderFireOverlay", at = @At("HEAD"), cancellable = true) @Inject(method = "renderFireOverlay", at = @At("HEAD"), cancellable = true)
private static void noRenderFireOverlay(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Sprite sprite, CallbackInfo ci) { private static void noRenderFireOverlay(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Sprite sprite, CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.fireOverlay.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.fireOverlay.getValue()) ci.cancel();
} }
@Inject(method = "renderUnderwaterOverlay", at = @At("HEAD"), cancellable = true) @Inject(method = "renderUnderwaterOverlay", at = @At("HEAD"), cancellable = true)
private static void noRenderUnderwaterOverlay(MinecraftClient client, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo ci) { private static void noRenderUnderwaterOverlay(MinecraftClient client, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.fluidOverlay.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.fluidOverlay.getValue()) ci.cancel();
} }
} }
@@ -28,7 +28,7 @@ public abstract class ItemEntityMixin {
if (!name.equals(original)) name = name.formatted(Formatting.ITALIC); if (!name.equals(original)) name = name.formatted(Formatting.ITALIC);
if (nametags.countItems.isEnabled()) { if (nametags.countItems.getValue()) {
if (count > 1) return name.copy().append(" x" + count); if (count > 1) return name.copy().append(" x" + count);
return name; return name;
} }
@@ -23,7 +23,7 @@ public abstract class ItemMixin {
@Inject(method = "appendTooltip", at = @At("HEAD")) @Inject(method = "appendTooltip", at = @At("HEAD"))
private void onAppendTooltip(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer<Text> textConsumer, TooltipType type, CallbackInfo ci) { private void onAppendTooltip(ItemStack stack, Item.TooltipContext context, TooltipDisplayComponent displayComponent, Consumer<Text> textConsumer, TooltipType type, CallbackInfo ci) {
ShulkerPeek shulkerPeek = ModuleManager.INSTANCE.getModuleByClass(ShulkerPeek.class); ShulkerPeek shulkerPeek = ModuleManager.INSTANCE.getModuleByClass(ShulkerPeek.class);
if (!shulkerPeek.isEnabled() || !shulkerPeek.showTooltips.isEnabled()) return; if (!shulkerPeek.isEnabled() || !shulkerPeek.showTooltips.getValue()) return;
if (stack.getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof ShulkerBoxBlock) { if (stack.getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof ShulkerBoxBlock) {
if (ShulkerPeek.isShulkerEmpty(stack)) { if (ShulkerPeek.isShulkerEmpty(stack)) {
@@ -16,7 +16,7 @@ public abstract class KeyInputMixin extends Input {
@Inject(method = "tick", at = @At("TAIL")) @Inject(method = "tick", at = @At("TAIL"))
private void isPressed(CallbackInfo ci) { private void isPressed(CallbackInfo ci) {
Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class); Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
if (freecam.isEnabled() && freecam.stayCrouching.isEnabled() && freecam.isCrouching()) if (freecam.isEnabled() && freecam.stayCrouching.getValue() && freecam.isCrouching())
playerInput = new PlayerInput( playerInput = new PlayerInput(
false, false, false, false,
false, false, false, false,
@@ -55,6 +55,6 @@ public abstract class LightmapTextureManagerMixin {
@Inject(method = "getDarkness", at = @At("HEAD"), cancellable = true) @Inject(method = "getDarkness", at = @At("HEAD"), cancellable = true)
private void noRenderDarkness(LivingEntity entity, float factor, float tickProgress, CallbackInfoReturnable<Float> cir) { private void noRenderDarkness(LivingEntity entity, float factor, float tickProgress, CallbackInfoReturnable<Float> cir) {
if (noRender.isEnabled() && !noRender.darknessEffect.isEnabled()) cir.setReturnValue(0f); if (noRender.isEnabled() && !noRender.darknessEffect.getValue()) cir.setReturnValue(0f);
} }
} }
@@ -40,12 +40,12 @@ public abstract class LivingEntityRendererMixin<T extends LivingEntity> {
@ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSneaky()Z")) @ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isSneaky()Z"))
private boolean renderSneakingPlayerNametags(boolean original) { private boolean renderSneakingPlayerNametags(boolean original) {
return (nametags.isEnabled() && nametags.alwaysVisible.isEnabled()) || original; return (nametags.isEnabled() && nametags.alwaysVisible.getValue()) || original;
} }
@ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isInvisibleTo(Lnet/minecraft/entity/player/PlayerEntity;)Z")) @ModifyExpressionValue(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;isInvisibleTo(Lnet/minecraft/entity/player/PlayerEntity;)Z"))
private boolean renderInvisPlayerNametags(boolean original) { private boolean renderInvisPlayerNametags(boolean original) {
if (nametags.isEnabled() && nametags.alwaysVisible.isEnabled()) return false; if (nametags.isEnabled() && nametags.alwaysVisible.getValue()) return false;
else return original; else return original;
} }
@@ -58,7 +58,7 @@ public abstract class LivingEntityRendererMixin<T extends LivingEntity> {
@Inject(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At("RETURN"), cancellable = true) @Inject(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At("RETURN"), cancellable = true)
private void renderSelfNametag(T livingEntity, double d, CallbackInfoReturnable<Boolean> cir) { private void renderSelfNametag(T livingEntity, double d, CallbackInfoReturnable<Boolean> cir) {
if (livingEntity instanceof PlayerEntity player) { if (livingEntity instanceof PlayerEntity player) {
if (player == mc.player && nametags.showSelf.isEnabled()) { if (player == mc.player && nametags.showSelf.getValue()) {
cir.setReturnValue(true); cir.setReturnValue(true);
cir.cancel(); cir.cancel();
} }
@@ -26,7 +26,7 @@ public abstract class PlayerEntityMixin extends LivingEntity {
@ModifyReturnValue(method = "getDisplayName", at = @At("RETURN")) @ModifyReturnValue(method = "getDisplayName", at = @At("RETURN"))
private Text addHealthIndicator(Text original) { private Text addHealthIndicator(Text original) {
Nametags nametags = ModuleManager.INSTANCE.getModuleByClass(Nametags.class); Nametags nametags = ModuleManager.INSTANCE.getModuleByClass(Nametags.class);
if (!nametags.isEnabled() || !nametags.health.isEnabled()) return original; if (!nametags.isEnabled() || !nametags.health.getValue()) return original;
float health = getHealth(); float health = getHealth();
float absorption = getAbsorptionAmount(); float absorption = getAbsorptionAmount();
@@ -26,13 +26,13 @@ public abstract class SkyRendererMixin {
@Inject(method = "renderSun", at = @At("HEAD"), cancellable = true) @Inject(method = "renderSun", at = @At("HEAD"), cancellable = true)
private void onRenderSun(float alpha, MatrixStack matrices, CallbackInfo ci) { private void onRenderSun(float alpha, MatrixStack matrices, CallbackInfo ci) {
if (timeChanger.isEnabled() && !timeChanger.renderSun.isEnabled()) ci.cancel(); if (timeChanger.isEnabled() && !timeChanger.renderSun.getValue()) ci.cancel();
} }
@Inject(method = "renderMoon", at = @At("HEAD"), cancellable = true) @Inject(method = "renderMoon", at = @At("HEAD"), cancellable = true)
private void onRenderMoon(MoonPhase moonPhase, float alpha, MatrixStack matrices, CallbackInfo ci) { private void onRenderMoon(MoonPhase moonPhase, float alpha, MatrixStack matrices, CallbackInfo ci) {
if (!timeChanger.isEnabled()) return; if (!timeChanger.isEnabled()) return;
if (!timeChanger.renderMoon.isEnabled()) ci.cancel(); if (!timeChanger.renderMoon.getValue()) ci.cancel();
} }
@ModifyArg(method = "renderCelestialBodies", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/SkyRendering;renderMoon(Lnet/minecraft/world/MoonPhase;FLnet/minecraft/client/util/math/MatrixStack;)V")) @ModifyArg(method = "renderCelestialBodies", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/SkyRendering;renderMoon(Lnet/minecraft/world/MoonPhase;FLnet/minecraft/client/util/math/MatrixStack;)V"))
@@ -45,12 +45,12 @@ public abstract class SkyRendererMixin {
@Inject(method = "renderStars", at = @At("HEAD"), cancellable = true) @Inject(method = "renderStars", at = @At("HEAD"), cancellable = true)
private void onRenderStars(float brightness, MatrixStack matrices, CallbackInfo ci) { private void onRenderStars(float brightness, MatrixStack matrices, CallbackInfo ci) {
if (timeChanger.isEnabled() && !timeChanger.renderStars.isEnabled()) ci.cancel(); if (timeChanger.isEnabled() && !timeChanger.renderStars.getValue()) ci.cancel();
} }
@Inject(method = "drawEndLightFlash", at = @At("HEAD"), cancellable = true) @Inject(method = "drawEndLightFlash", at = @At("HEAD"), cancellable = true)
private void onEndFlash(MatrixStack matrixStack, float f, float skyFactor, float pitch, CallbackInfo ci) { private void onEndFlash(MatrixStack matrixStack, float f, float skyFactor, float pitch, CallbackInfo ci) {
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class); NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
if (noRender.isEnabled() && !noRender.endFlashes.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.endFlashes.getValue()) ci.cancel();
} }
} }
@@ -21,8 +21,8 @@ public abstract class StatusEffectFogModifierMixin {
public boolean noRenderBadEffects(boolean original) { public boolean noRenderBadEffects(boolean original) {
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class); NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
if (!noRender.isEnabled()) return original; if (!noRender.isEnabled()) return original;
if (getStatusEffect() == StatusEffects.BLINDNESS && !noRender.blindnessEffect.isEnabled()) return false; if (getStatusEffect() == StatusEffects.BLINDNESS && !noRender.blindnessEffect.getValue()) return false;
if (getStatusEffect() == StatusEffects.DARKNESS && !noRender.darknessEffect.isEnabled()) return false; if (getStatusEffect() == StatusEffects.DARKNESS && !noRender.darknessEffect.getValue()) return false;
return original; return original;
} }
} }
@@ -13,6 +13,6 @@ public abstract class StringHelperMixin {
@ModifyArg(method = "truncateChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/StringHelper;truncate(Ljava/lang/String;IZ)Ljava/lang/String;"), index = 1) @ModifyArg(method = "truncateChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/StringHelper;truncate(Ljava/lang/String;IZ)Ljava/lang/String;"), index = 1)
private static int onTruncate(int maxLength) { private static int onTruncate(int maxLength) {
ChatPlus chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class); ChatPlus chatPlus = ModuleManager.INSTANCE.getModuleByClass(ChatPlus.class);
return ((chatPlus.isEnabled() && chatPlus.noCharLimit.isEnabled()) ? Integer.MAX_VALUE : maxLength); return ((chatPlus.isEnabled() && chatPlus.noCharLimit.getValue()) ? Integer.MAX_VALUE : maxLength);
} }
} }
@@ -13,7 +13,7 @@ public abstract class StuckArrowsFeatureRendererMixin {
@ModifyReturnValue(method = "getObjectCount", at = @At("RETURN")) @ModifyReturnValue(method = "getObjectCount", at = @At("RETURN"))
private int noRenderStuckArrows(int original) { private int noRenderStuckArrows(int original) {
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class); NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
if (noRender.isEnabled() && !noRender.stuckArrows.isEnabled()) return 0; if (noRender.isEnabled() && !noRender.stuckArrows.getValue()) return 0;
return original; return original;
} }
} }
@@ -24,17 +24,17 @@ public abstract class TextRendererDrawerMixin {
@Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isBold()Z")) @Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isBold()Z"))
private boolean noRenderBold(Style style) { private boolean noRenderBold(Style style) {
return !(noRender.isEnabled() && !noRender.bold.isEnabled()) && style.isBold(); return !(noRender.isEnabled() && !noRender.bold.getValue()) && style.isBold();
} }
@Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isUnderlined()Z")) @Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isUnderlined()Z"))
private boolean noRenderUnderlined(Style style) { private boolean noRenderUnderlined(Style style) {
return !(noRender.isEnabled() && !noRender.underlined.isEnabled()) && style.isUnderlined(); return !(noRender.isEnabled() && !noRender.underlined.getValue()) && style.isUnderlined();
} }
@Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isStrikethrough()Z")) @Redirect(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isStrikethrough()Z"))
private boolean noRenderStrikethrough(Style style) { private boolean noRenderStrikethrough(Style style) {
return !(noRender.isEnabled() && !noRender.strikethrough.isEnabled()) && style.isStrikethrough(); return !(noRender.isEnabled() && !noRender.strikethrough.getValue()) && style.isStrikethrough();
} }
@ModifyArg(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer$Drawer;getRenderColor(Lnet/minecraft/text/TextColor;)I")) @ModifyArg(method = "accept(ILnet/minecraft/text/Style;Lnet/minecraft/client/font/BakedGlyph;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer$Drawer;getRenderColor(Lnet/minecraft/text/TextColor;)I"))
@@ -13,6 +13,6 @@ public abstract class TextRendererMixin {
@ModifyExpressionValue(method = "getGlyph", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isObfuscated()Z")) @ModifyExpressionValue(method = "getGlyph", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isObfuscated()Z"))
private boolean noRenderMTS(boolean original) { private boolean noRenderMTS(boolean original) {
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class); NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
return (!noRender.isEnabled() || noRender.scrambledText.isEnabled()) && original; return (!noRender.isEnabled() || noRender.scrambledText.getValue()) && original;
} }
} }
@@ -29,14 +29,14 @@ public abstract class WeatherRenderingMixin {
@Inject(method = "addParticlesAndSound", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;addParticleClient(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V"), cancellable = true) @Inject(method = "addParticlesAndSound", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;addParticleClient(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V"), cancellable = true)
private void noRainParticles(ClientWorld world, Camera camera, int ticks, ParticlesMode particlesMode, int weatherRadius, CallbackInfo ci) { private void noRainParticles(ClientWorld world, Camera camera, int ticks, ParticlesMode particlesMode, int weatherRadius, CallbackInfo ci) {
if (noRender.isEnabled() && !noRender.rain.isEnabled()) ci.cancel(); if (noRender.isEnabled() && !noRender.rain.getValue()) ci.cancel();
} }
@Inject(method = "renderPrecipitation", at = @At("HEAD")) @Inject(method = "renderPrecipitation", at = @At("HEAD"))
private void noRenderRainAndSnow(VertexConsumerProvider vertexConsumers, Vec3d pos, WeatherRenderState weatherRenderState, CallbackInfo ci) { private void noRenderRainAndSnow(VertexConsumerProvider vertexConsumers, Vec3d pos, WeatherRenderState weatherRenderState, CallbackInfo ci) {
if (noRender.isEnabled()) { if (noRender.isEnabled()) {
if (!noRender.rain.isEnabled()) weatherRenderState.rainPieces.clear(); if (!noRender.rain.getValue()) weatherRenderState.rainPieces.clear();
if (!noRender.snow.isEnabled()) weatherRenderState.snowPieces.clear(); if (!noRender.snow.getValue()) weatherRenderState.snowPieces.clear();
} }
} }
} }
@@ -1,6 +1,5 @@
package me.retucio.sputnik.mixin; package me.retucio.sputnik.mixin;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local; import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.blaze3d.buffers.GpuBufferSlice; import com.mojang.blaze3d.buffers.GpuBufferSlice;
import me.retucio.sputnik.Sputnik; import me.retucio.sputnik.Sputnik;
@@ -13,7 +12,6 @@ import net.minecraft.client.render.*;
import net.minecraft.client.render.state.WorldRenderState; import net.minecraft.client.render.state.WorldRenderState;
import net.minecraft.client.util.ObjectAllocator; import net.minecraft.client.util.ObjectAllocator;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.ColorHelper;
import net.minecraft.util.math.RotationAxis; import net.minecraft.util.math.RotationAxis;
import net.minecraft.util.profiler.Profiler; import net.minecraft.util.profiler.Profiler;
import org.joml.Matrix4f; import org.joml.Matrix4f;
@@ -23,8 +21,6 @@ import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.lang.annotation.Target;
import static me.retucio.sputnik.Sputnik.EVENT_BUS; import static me.retucio.sputnik.Sputnik.EVENT_BUS;
import static me.retucio.sputnik.Sputnik.mc; import static me.retucio.sputnik.Sputnik.mc;
@@ -56,14 +52,14 @@ public abstract class WorldRendererMixin {
@Inject(method = "renderTargetBlockOutline", at = @At("HEAD"), cancellable = true) @Inject(method = "renderTargetBlockOutline", at = @At("HEAD"), cancellable = true)
private void noRenderBlockOutlinesFreecam(VertexConsumerProvider.Immediate immediate, MatrixStack matrices, boolean renderBlockOutline, WorldRenderState renderStates, CallbackInfo ci) { private void noRenderBlockOutlinesFreecam(VertexConsumerProvider.Immediate immediate, MatrixStack matrices, boolean renderBlockOutline, WorldRenderState renderStates, CallbackInfo ci) {
Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class); Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
if (freecam.isEnabled() && !freecam.blockOutlines.isEnabled()) ci.cancel(); if (freecam.isEnabled() && !freecam.blockOutlines.getValue()) ci.cancel();
} }
@Inject(method = "hasBlindnessOrDarkness(Lnet/minecraft/client/render/Camera;)Z", at = @At("HEAD"), cancellable = true) @Inject(method = "hasBlindnessOrDarkness(Lnet/minecraft/client/render/Camera;)Z", at = @At("HEAD"), cancellable = true)
private void hasBlindnessOrDarkness(Camera camera, CallbackInfoReturnable<Boolean> cir) { private void hasBlindnessOrDarkness(Camera camera, CallbackInfoReturnable<Boolean> cir) {
NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class); NoRender noRender = ModuleManager.INSTANCE.getModuleByClass(NoRender.class);
if (!noRender.isEnabled()) return; if (!noRender.isEnabled()) return;
if (!noRender.blindnessEffect.isEnabled() || !noRender.darknessEffect.isEnabled()) cir.setReturnValue(null); if (!noRender.blindnessEffect.getValue() || !noRender.darknessEffect.getValue()) cir.setReturnValue(null);
} }
@@ -11,7 +11,9 @@ public enum Category {
NETWORK("red"), NETWORK("red"),
CLIENT("cliente"), CLIENT("cliente"),
MISC("misc."); MISC("misc."),
ALL("todos");
private final String name; private final String name;
Category(String name) { this.name = name; } Category(String name) { this.name = name; }
@@ -16,7 +16,6 @@ import org.lwjgl.glfw.GLFW;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
// clase base para los módulos // clase base para los módulos
public class Module { public class Module {
@@ -53,12 +52,12 @@ public class Module {
this.description = description; this.description = description;
this.category = category; this.category = category;
sgGeneral.addAll(bind, keyMode, notify); sgGeneral.addAll(bind, keyMode, notify);
this.bind.setDefaultKey(key); this.bind.setDefaultValue(key);
// puto marcos // puto marcos
if (ConfigManager.getConfig().settings if (ConfigManager.getConfig().settings
.get(this.getName() + ":" + bind.getName()) == null) .get(this.getName() + ":" + bind.getName()) == null)
this.bind.setKey(key); this.bind.setValue(key);
} }
@@ -83,8 +82,12 @@ public class Module {
return null; return null;
} }
public List<Setting> getSettings() { public SettingGroup getSgGeneral() {
List<Setting> settings = new ArrayList<>(); return sgGeneral;
}
public List<Setting<?>> getSettings() {
List<Setting<?>> settings = new ArrayList<>();
sgs.forEach(sg -> sg.forEach(settings::add)); sgs.forEach(sg -> sg.forEach(settings::add));
return settings; return settings;
} }
@@ -99,7 +102,7 @@ public class Module {
} }
public void onEnable() { public void onEnable() {
if (notify.isEnabled()) ChatUtil.info(getName() + " fue activado"); if (notify.getValue()) ChatUtil.info(getName() + " fue activado");
for (Method method : getClass().getDeclaredMethods()) for (Method method : getClass().getDeclaredMethods())
if (method.isAnnotationPresent(SubscribeEvent.class)) { if (method.isAnnotationPresent(SubscribeEvent.class)) {
Sputnik.EVENT_BUS.register(this); Sputnik.EVENT_BUS.register(this);
@@ -109,7 +112,7 @@ public class Module {
} }
public void onDisable() { public void onDisable() {
if (notify.isEnabled()) ChatUtil.info(getName() + " fue desactivado"); if (notify.getValue()) ChatUtil.info(getName() + " fue desactivado");
if (Sputnik.EVENT_BUS.isRegistered(this)) if (Sputnik.EVENT_BUS.isRegistered(this))
Sputnik.EVENT_BUS.unregister(this); Sputnik.EVENT_BUS.unregister(this);
Sputnik.EVENT_BUS.post(new ToggleModuleEvent(this)); Sputnik.EVENT_BUS.post(new ToggleModuleEvent(this));
@@ -165,16 +168,16 @@ public class Module {
} }
public int getKey() { public int getKey() {
return bind.getKey(); return bind.getValue();
} }
public void setKey(int key) { public void setKey(int key) {
bind.setKey(key); bind.setValue(key);
} }
public void assignKey(int key) { public void assignKey(int key) {
bind.setDefaultKey(key); bind.setDefaultValue(key);
bind.setKey(key); bind.setValue(key);
} }
public KeySetting getBind() { public KeySetting getBind() {
@@ -2,6 +2,7 @@ package me.retucio.sputnik.module;
import me.retucio.sputnik.Sputnik; import me.retucio.sputnik.Sputnik;
import me.retucio.sputnik.event.SubscribeEvent; import me.retucio.sputnik.event.SubscribeEvent;
import me.retucio.sputnik.module.modules.client.DiscordRPC;
import me.retucio.sputnik.module.modules.client.HUD; import me.retucio.sputnik.module.modules.client.HUD;
import me.retucio.sputnik.module.modules.camera.*; import me.retucio.sputnik.module.modules.camera.*;
import me.retucio.sputnik.module.modules.misc.*; import me.retucio.sputnik.module.modules.misc.*;
@@ -45,6 +46,7 @@ public class ModuleManager {
modules.add(new ColoredSigns()); modules.add(new ColoredSigns());
modules.add(new CritsPlus()); modules.add(new CritsPlus());
modules.add(new DamageOverlay()); modules.add(new DamageOverlay());
modules.add(new DiscordRPC());
modules.add(new ElytraBounce()); modules.add(new ElytraBounce());
modules.add(new FakePlayer()); modules.add(new FakePlayer());
modules.add(new FastUse()); modules.add(new FastUse());
@@ -56,6 +58,7 @@ public class ModuleManager {
modules.add(new HandView()); modules.add(new HandView());
modules.add(new Headhitters()); modules.add(new Headhitters());
modules.add(new HUD()); modules.add(new HUD());
modules.add(new InfiniteElytra());
modules.add(new InventoryPlus()); modules.add(new InventoryPlus());
modules.add(new LightOverlay()); modules.add(new LightOverlay());
modules.add(new LogoutSpots()); modules.add(new LogoutSpots());
@@ -76,12 +79,13 @@ public class ModuleManager {
modules.add(new ScreenshotPlus()); modules.add(new ScreenshotPlus());
modules.add(new ShulkerPeek()); modules.add(new ShulkerPeek());
modules.add(new Step()); modules.add(new Step());
modules.add(new StrongholdTriangulator());
modules.add(new TimeChanger()); modules.add(new TimeChanger());
modules.add(new UIMove()); modules.add(new UIMove());
modules.add(new WarnLowDurability()); modules.add(new WarnLowDurability());
modules.add(new Zoom()); modules.add(new Zoom());
modules.sort(Comparator.comparing(module -> module.getName().toLowerCase())); modules.sort(Comparator.comparing(module -> MiscUtil.removeAccentMarks(module.getName().toLowerCase())));
// registrar los "listeners" necesarios // registrar los "listeners" necesarios
for (Module module : getEnabledModules()) { for (Module module : getEnabledModules()) {
@@ -87,7 +87,7 @@ public class Freecam extends Module {
fovScale = mc.options.getFovEffectScale().getValue(); fovScale = mc.options.getFovEffectScale().getValue();
viewBobbing = mc.options.getBobView().getValue(); viewBobbing = mc.options.getBobView().getValue();
if (staticView.isEnabled()) { if (staticView.getValue()) {
mc.options.getFovEffectScale().setValue(0D); mc.options.getFovEffectScale().setValue(0D);
mc.options.getBobView().setValue(false); mc.options.getBobView().setValue(false);
} }
@@ -119,25 +119,25 @@ public class Freecam extends Module {
down = KeyUtil.isKeyDown(mc.options.sneakKey); down = KeyUtil.isKeyDown(mc.options.sneakKey);
unpress(); unpress();
if (reloadChunks.isEnabled()) mc.worldRenderer.reload(); if (reloadChunks.getValue()) mc.worldRenderer.reload();
super.onEnable(); super.onEnable();
} }
@Override @Override
public void onDisable() { public void onDisable() {
if (reloadChunks.isEnabled()) mc.execute(mc.worldRenderer::reload); if (reloadChunks.getValue()) mc.execute(mc.worldRenderer::reload);
mc.options.setPerspective(perspective); mc.options.setPerspective(perspective);
crouching = false; crouching = false;
if (staticView.isEnabled()) { if (staticView.getValue()) {
mc.options.getFovEffectScale().setValue(fovScale); mc.options.getFovEffectScale().setValue(fovScale);
mc.options.getBobView().setValue(viewBobbing); mc.options.getBobView().setValue(viewBobbing);
} }
// para no flaggear el anticheat, cancelar cualquier acción dejada a medias estando en modo libre // para no flaggear el anticheat, cancelar cualquier acción dejada a medias estando en modo libre
if (cancelActionPackets.isEnabled()) { if (cancelActionPackets.getValue()) {
if (mc.interactionManager != null) if (mc.interactionManager != null)
mc.interactionManager.cancelBlockBreaking(); mc.interactionManager.cancelBlockBreaking();
@@ -199,7 +199,7 @@ public class Freecam extends Module {
@SubscribeEvent @SubscribeEvent
public void onSendPacket(PacketEvent.Send event) { public void onSendPacket(PacketEvent.Send event) {
if (!isEnabled() || !cancelActionPackets.isEnabled()) return; if (!isEnabled() || !cancelActionPackets.getValue()) return;
if (event.getStage() != Stage.PRE) return; if (event.getStage() != Stage.PRE) return;
Packet<?> packet = event.getPacket(); Packet<?> packet = event.getPacket();
@@ -279,7 +279,7 @@ public class Freecam extends Module {
@SubscribeEvent @SubscribeEvent
private void onMouseScroll(MouseScrollEvent event) { private void onMouseScroll(MouseScrollEvent event) {
if (scrollSens.getValue() > 0 && mc.currentScreen == null && KeyUtil.isKeyDown(scrollKey.getKey())) { if (scrollSens.getValue() > 0 && mc.currentScreen == null && KeyUtil.isKeyDown(scrollKey.getValue())) {
speed += event.getVertical() / 4 * (scrollSens.getValue() * speed); speed += event.getVertical() / 4 * (scrollSens.getValue() * speed);
if (speed < 0.1) speed = 0.1; if (speed < 0.1) speed = 0.1;
event.cancel(); event.cancel();
@@ -304,7 +304,7 @@ public class Freecam extends Module {
if (mc.player.getId() == packet.playerId()) if (mc.player.getId() == packet.playerId())
toggle(); toggle();
} else if (event.getPacket() instanceof HealthUpdateS2CPacket packet) { } else if (event.getPacket() instanceof HealthUpdateS2CPacket packet) {
if (mc.player.getHealth() - packet.getHealth() > 0 && toggleOnDamage.isEnabled()) { if (mc.player.getHealth() - packet.getHealth() > 0 && toggleOnDamage.getValue()) {
ChatUtil.info("cámara libre se ha desactivado porque has recibido daño"); ChatUtil.info("cámara libre se ha desactivado porque has recibido daño");
toggle(); toggle();
} }
@@ -324,22 +324,22 @@ public class Freecam extends Module {
@SubscribeEvent @SubscribeEvent
public void onBreakBlock(BreakBlockEvent event) { public void onBreakBlock(BreakBlockEvent event) {
if (cancelActionPackets.isEnabled()) event.cancel(); if (cancelActionPackets.getValue()) event.cancel();
} }
@SubscribeEvent @SubscribeEvent
public void onPlaceBlock(PlaceBlockEvent event) { public void onPlaceBlock(PlaceBlockEvent event) {
if (cancelActionPackets.isEnabled()) event.cancel(); if (cancelActionPackets.getValue()) event.cancel();
} }
@SubscribeEvent @SubscribeEvent
public void onInteractEntity(InteractEntityEvent event) { public void onInteractEntity(InteractEntityEvent event) {
if (cancelActionPackets.isEnabled()) event.cancel(); if (cancelActionPackets.getValue()) event.cancel();
} }
@SubscribeEvent @SubscribeEvent
public void onAttack(AttackEntityEvent event) { public void onAttack(AttackEntityEvent event) {
if (cancelActionPackets.isEnabled()) event.cancel(); if (cancelActionPackets.getValue()) event.cancel();
} }
public void changeLookDirection(double deltaX, double deltaY) { public void changeLookDirection(double deltaX, double deltaY) {
@@ -39,7 +39,7 @@ public class Freelook extends Module {
keyMode.setValue(KeyModes.HOLD); keyMode.setValue(KeyModes.HOLD);
notify.setDefaultValue(false); notify.setDefaultValue(false);
notify.setEnabled(false); notify.setValue(false);
} }
@Override @Override
@@ -57,7 +57,7 @@ public class PerspectivePlus extends Module {
if (mc.options.getPerspective() == net.minecraft.client.option.Perspective.FIRST_PERSON if (mc.options.getPerspective() == net.minecraft.client.option.Perspective.FIRST_PERSON
|| mc.currentScreen != null || scrollSens.getValue() <= 0) return; || mc.currentScreen != null || scrollSens.getValue() <= 0) return;
if (KeyUtil.isKeyDown(scrollKey.getKey())) { if (KeyUtil.isKeyDown(scrollKey.getValue())) {
distance -= event.getVertical() / 4 * (scrollSens.getValue() * distance); distance -= event.getVertical() / 4 * (scrollSens.getValue() * distance);
event.cancel(); event.cancel();
} }
@@ -29,14 +29,14 @@ public class Rotations extends Module {
mc.player.setYaw(yaw.getFloatValue()); mc.player.setYaw(yaw.getFloatValue());
mc.player.setPitch(pitch.getFloatValue()); mc.player.setPitch(pitch.getFloatValue());
if (serverSide.isEnabled()) if (serverSide.getValue())
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround( mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(
yaw.getFloatValue(), pitch.getFloatValue(), mc.player.isOnGround(), mc.player.horizontalCollision)); yaw.getFloatValue(), pitch.getFloatValue(), mc.player.isOnGround(), mc.player.horizontalCollision));
} }
@SubscribeEvent @SubscribeEvent
public void onChangeRotation(ChangeRotationEvent event) { public void onChangeRotation(ChangeRotationEvent event) {
if (smooth.isEnabled() if (smooth.getValue()
&& (event.getYaw() != yaw.getFloatValue() || event.getPitch() != pitch.getFloatValue())){ && (event.getYaw() != yaw.getFloatValue() || event.getPitch() != pitch.getFloatValue())){
event.cancel(); event.cancel();
}} }}
@@ -50,7 +50,7 @@ public class Zoom extends Module {
keyMode.setValue(KeyModes.HOLD); keyMode.setValue(KeyModes.HOLD);
notify.setDefaultValue(false); notify.setDefaultValue(false);
notify.setEnabled(false); notify.setValue(false);
} }
@Override @Override
@@ -61,7 +61,7 @@ public class Zoom extends Module {
prevMouseSens = mc.options.getMouseSensitivity().getValue(); prevMouseSens = mc.options.getMouseSensitivity().getValue();
prevFov = mc.options.getFov().getValue(); prevFov = mc.options.getFov().getValue();
prevHUD = mc.options.hudHidden; prevHUD = mc.options.hudHidden;
mc.options.hudHidden = !showHUD.isEnabled(); mc.options.hudHidden = !showHUD.getValue();
value = defaultZoom.getValue(); value = defaultZoom.getValue();
@@ -83,14 +83,14 @@ public class Zoom extends Module {
@Override @Override
public void onTick() { public void onTick() {
mc.options.smoothCameraEnabled = smoothCam.isEnabled(); mc.options.smoothCameraEnabled = smoothCam.getValue();
if (!smoothCam.isEnabled()) if (!smoothCam.getValue())
mc.options.getMouseSensitivity().setValue(prevMouseSens * mouseSensMultiplier.getValue()); mc.options.getMouseSensitivity().setValue(prevMouseSens * mouseSensMultiplier.getValue());
} }
@SubscribeEvent @SubscribeEvent
private void onMouseScroll(MouseScrollEvent event) { private void onMouseScroll(MouseScrollEvent event) {
boolean key = scrollKey.getKey() == GLFW.GLFW_KEY_UNKNOWN || KeyUtil.isKeyDown(scrollKey.getKey()); boolean key = scrollKey.getValue() == GLFW.GLFW_KEY_UNKNOWN || KeyUtil.isKeyDown(scrollKey.getValue());
if (isEnabled() && scrollSens.getValue() > 0 && key) { if (isEnabled() && scrollSens.getValue() > 0 && key) {
value += event.getVertical() * 0.25 * (scrollSens.getValue() * value); value += event.getVertical() * 0.25 * (scrollSens.getValue() * value);
if (value < 1) value = 1; if (value < 1) value = 1;
@@ -0,0 +1,231 @@
package me.retucio.sputnik.module.modules.client;
import dev.firstdark.rpc.DiscordRpc;
import dev.firstdark.rpc.enums.ActivityType;
import dev.firstdark.rpc.enums.ErrorCode;
import dev.firstdark.rpc.exceptions.UnsupportedOsType;
import dev.firstdark.rpc.handlers.RPCEventHandler;
import dev.firstdark.rpc.models.DiscordRichPresence;
import dev.firstdark.rpc.models.User;
import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.Setting;
import me.retucio.sputnik.module.setting.SettingGroup;
import me.retucio.sputnik.module.setting.settings.EnumSetting;
import me.retucio.sputnik.module.setting.settings.StringSetting;
import me.retucio.sputnik.util.ChatUtil;
public class DiscordRPC extends Module {
SettingGroup sgImage = addSg(new SettingGroup("imágenes", false));
SettingGroup sgButton = addSg(new SettingGroup("botón", false));
// general
public StringSetting details = sgGeneral.add(new StringSetting(
"detalles", "título",
"usando el mod de putas de retucio",
40
));
public StringSetting state = sgGeneral.add(new StringSetting(
"estado", "subtítulo",
"(se lo está pasando en grande)",
40
));
public StringSetting startTimestamp = sgGeneral.add(new StringSetting(
"sello de tiempo", "sello de tiempo del comienzo de la actividad, siguiendo el unix epoch (. para ahora)",
".",
20
));
public EnumSetting<ActivityTypes> activityType = sgGeneral.add(new EnumSetting<>(
"tipo de actividad", "qué tipo de actividad se está llevando a cabo",
ActivityTypes.class, ActivityTypes.PLAYING
));
public StringSetting appId = sgGeneral.add(new StringSetting(
"id del bot", "id del bot a usar (obtener de discord.dev)",
"1314254766150258729", 20
));
// imágenes
public StringSetting largeImageKey = sgImage.add(new StringSetting(
"imagen grande", "clave de la imagen grande",
"pengiun",
40
));
public StringSetting largeImageText = sgImage.add(new StringSetting(
"texto de la imagen grande", "texto mostrado junto a la imagen grande",
"pengüino",
40
));
public StringSetting smallImageKey = sgImage.add(new StringSetting(
"imagen pequeña", "clave de la imagen pequeña",
"pengiun",
40
));
public StringSetting smallImageText = sgImage.add(new StringSetting(
"texto de la imagen pequeña", "texto mostrado junto a la imagen pequeña",
"pengüino",
40
));
// botón
public StringSetting buttonText = sgButton.add(new StringSetting(
"texto del botón", "texto a mostrar en el botón",
"hola",
20
));
public StringSetting buttonUrl = sgButton.add(new StringSetting(
"url del botón", "rickroll en gran 26 :wilted_rose:",
"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
20
));
// crear el rpc
private boolean initialized;
DiscordRpc rpc = new DiscordRpc();
RPCEventHandler handler = new RPCEventHandler() {
@Override
public void ready(User user) {
rpc.updatePresence(getPresence());
}
@Override
public void disconnected(ErrorCode errorCode, String message) {
ChatUtil.warn("desconectado: " + errorCode + " - " + message);
toggle();
}
@Override
public void errored(ErrorCode errorCode, String message) {
ChatUtil.error("error: " + errorCode + " - " + message);
toggle();
}
};
public DiscordRPC() {
super("discordRPC",
"personaliza la actividad de tu perfil en dishkor",
Category.CLIENT);
for (Setting<?> s : getSettings()) {
s.onUpdate(v -> update());
}
appId.onUpdate(v -> reload());
}
@Override
public void onEnable() {
String token = appId.getValue();
if (token == null || token.trim().isEmpty()) {
ChatUtil.error("configura el token del bot primero");
toggle();
return;
}
try {
rpc.init(token, handler, false);
initialized = true;
} catch (UnsupportedOsType e) {
ChatUtil.error("sistema operativo no soportado");
toggle();
} catch (Exception e) {
ChatUtil.error("error al inicializar rpc: " + e.getMessage());
toggle();
}
super.onEnable();
}
@Override
public void onDisable() {
if (initialized) {
rpc.shutdown();
initialized = false;
}
super.onDisable();
}
private DiscordRichPresence getPresence() {
return DiscordRichPresence.builder()
.details(details.getValue())
.state(state.getValue())
.largeImageKey(largeImageKey.getValue())
.largeImageText(largeImageText.getValue())
.smallImageKey(smallImageKey.getValue())
.smallImageText(smallImageText.getValue())
.startTimestamp(getTimestamp())
.activityType(activityType.getValue().getActivityType())
.button(DiscordRichPresence.RPCButton.of(
buttonText.getValue(),
buttonUrl.getValue())
).build();
}
private void update() {
if (initialized && isEnabled()) {
try {
rpc.updatePresence(getPresence());
} catch (Exception e) {
ChatUtil.error("error al actualizar rpc: " + e.getMessage());
}
}
}
public void reload() {
if (initialized && isEnabled()) {
rpc.shutdown();
try {
rpc.init(appId.getValue(), handler, false);
} catch (UnsupportedOsType e) {
ChatUtil.error(e.getMessage());
}
}
}
private long getTimestamp() {
long timestamp = System.currentTimeMillis();
if (!startTimestamp.getValue().equals(".")) {
try {
timestamp = Long.parseLong(startTimestamp.getValue());
} catch (NumberFormatException e) {
ChatUtil.error("introduce un NÚMERO (o .)");
}
}
return timestamp / 1000;
}
public enum ActivityTypes {
PLAYING("jugando"),
STREAMING("streameando"),
LISTENING("escuchando"),
WATCHING("viendo"),
CUSTOM("custom"),
COMPETING("compitiendo");
private final String name;
ActivityTypes(String name) { this.name = name; }
@Override public String toString() { return name; }
private ActivityType getActivityType() { return ActivityType.values()[ordinal()]; }
}
}
@@ -4,16 +4,11 @@ import me.retucio.sputnik.event.events.RenderBossbarEvent;
import me.retucio.sputnik.event.SubscribeEvent; import me.retucio.sputnik.event.SubscribeEvent;
import me.retucio.sputnik.module.Category; import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.SettingGroup;
import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.BooleanSetting;
import me.retucio.sputnik.module.setting.settings.ColorSetting;
import me.retucio.sputnik.module.setting.settings.EnumSetting;
import me.retucio.sputnik.module.setting.settings.NumberSetting; import me.retucio.sputnik.module.setting.settings.NumberSetting;
import net.minecraft.client.gui.hud.ClientBossBar; import net.minecraft.client.gui.hud.ClientBossBar;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import java.awt.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
@@ -50,16 +45,16 @@ public class BossbarStack extends Module {
@SubscribeEvent @SubscribeEvent
private void onRenderBossText(RenderBossbarEvent.BossText event) { private void onRenderBossText(RenderBossbarEvent.BossText event) {
if (hideNames.isEnabled()) { if (hideNames.getValue()) {
event.setName(Text.empty()); event.setName(Text.empty());
return; return;
} else if (bossBarMap.isEmpty() || !stackBars.isEnabled()) return; } else if (bossBarMap.isEmpty() || !stackBars.getValue()) return;
ClientBossBar bar = event.getBossBar(); ClientBossBar bar = event.getBossBar();
Integer amount = bossBarMap.get(bar); Integer amount = bossBarMap.get(bar);
bossBarMap.remove(bar); bossBarMap.remove(bar);
if (amount != null && !hideNames.isEnabled()) if (amount != null && !hideNames.getValue())
event.setName(event.getName().copy().append(" x" + amount)); event.setName(event.getName().copy().append(" x" + amount));
} }
@@ -70,7 +65,7 @@ public class BossbarStack extends Module {
@SubscribeEvent @SubscribeEvent
private void onRenderBossBars(RenderBossbarEvent.BossIterator event) { private void onRenderBossBars(RenderBossbarEvent.BossIterator event) {
if (stackBars.isEnabled()) { if (stackBars.getValue()) {
HashMap<String, ClientBossBar> chosenBarMap = new HashMap<>(); HashMap<String, ClientBossBar> chosenBarMap = new HashMap<>();
event.getIterator().forEachRemaining(bar -> { event.getIterator().forEachRemaining(bar -> {
String name = bar.getName().getString(); String name = bar.getName().getString();
@@ -82,7 +82,7 @@ public class ChatPlus extends Module {
Text message = event.getMessage(); Text message = event.getMessage();
// registrar mensajes para evitar su eliminación // registrar mensajes para evitar su eliminación
if (logger.isEnabled()) { if (logger.getValue()) {
String messageString = message.getString(); String messageString = message.getString();
if (loggerRegex.matcher(messageString).find()) { if (loggerRegex.matcher(messageString).find()) {
MutableText newMessage = Text.empty(); MutableText newMessage = Text.empty();
@@ -100,7 +100,7 @@ public class ChatPlus extends Module {
} }
// agregar sellos de tiempo a los mensajes // agregar sellos de tiempo a los mensajes
if (timestamps.isEnabled()) { if (timestamps.getValue()) {
Text timestamp = Text.literal("[" + dateFormat.format(new Date()) + "] ").formatted(Formatting.GRAY); Text timestamp = Text.literal("[" + dateFormat.format(new Date()) + "] ").formatted(Formatting.GRAY);
message = Text.empty().append(timestamp).append(message); message = Text.empty().append(timestamp).append(message);
} }
@@ -112,7 +112,7 @@ public class ChatPlus extends Module {
@SubscribeEvent @SubscribeEvent
private void onSendMessage(SendMessageEvent event) { private void onSendMessage(SendMessageEvent event) {
// evitar mandar coordenadas por el chat // evitar mandar coordenadas por el chat
if (coordsProtection.isEnabled() && containsCoordinates(event.getMessage())) { if (coordsProtection.getValue() && containsCoordinates(event.getMessage())) {
ChatUtil.warn(Text.literal("cuidadito con las coordenadas chavalín").append( ChatUtil.warn(Text.literal("cuidadito con las coordenadas chavalín").append(
getSendButton(event.getMessage()))); getSendButton(event.getMessage())));
@@ -127,7 +127,7 @@ public class ChatPlus extends Module {
@SuppressWarnings("DataFlowIssue") @SuppressWarnings("DataFlowIssue")
public void beforeDrawMessage(DrawContext context, ChatHudLine.Visible line, int y, int color) { public void beforeDrawMessage(DrawContext context, ChatHudLine.Visible line, int y, int color) {
if (!isEnabled() || !showHeads.isEnabled()) return; if (!isEnabled() || !showHeads.getValue()) return;
// dibujar la cabeza al principio del mensaje // dibujar la cabeza al principio del mensaje
if (((IChatHudLineVisible) (Object) line).sputnik$isStartOfEntry()) if (((IChatHudLineVisible) (Object) line).sputnik$isStartOfEntry())
@@ -139,7 +139,7 @@ public class ChatPlus extends Module {
public void afterDrawMessage(DrawContext context) { public void afterDrawMessage(DrawContext context) {
// finalizar renderizado de la cabeza // finalizar renderizado de la cabeza
if (!isEnabled() || !showHeads.isEnabled()) return; if (!isEnabled() || !showHeads.getValue()) return;
context.getMatrices().popMatrix(); context.getMatrices().popMatrix();
} }
@@ -218,7 +218,7 @@ public class ChatPlus extends Module {
} }
private void updateDateFormat() { private void updateDateFormat() {
dateFormat = new SimpleDateFormat(timestampSecs.isEnabled() ? "HH:mm:ss" : "HH:mm"); dateFormat = new SimpleDateFormat(timestampSecs.getValue() ? "HH:mm:ss" : "HH:mm");
} }
private boolean containsCoordinates(String message) { private boolean containsCoordinates(String message) {
@@ -52,10 +52,10 @@ public class ScreenshotPlus extends Module {
public void sendScreenshotMessage() { public void sendScreenshotMessage() {
MutableText baseText = Text.literal("captura de pantalla tomada\n"); MutableText baseText = Text.literal("captura de pantalla tomada\n");
if (saveButton.isEnabled() && !defaultAction.is(ScreenshotActions.SAVE)) baseText.append(getSaveButton().append(" ")); if (saveButton.getValue() && !defaultAction.is(ScreenshotActions.SAVE)) baseText.append(getSaveButton().append(" "));
if (copyButton.isEnabled()) baseText.append(getCopyButton().append(" ")); if (copyButton.getValue()) baseText.append(getCopyButton().append(" "));
if (openButton.isEnabled() && defaultAction.is(ScreenshotActions.SAVE)) baseText.append(getOpenButton().append(" ")); if (openButton.getValue() && defaultAction.is(ScreenshotActions.SAVE)) baseText.append(getOpenButton().append(" "));
if (discardButton.isEnabled() && !defaultAction.is(ScreenshotActions.NONE)) baseText.append(getDiscardButton().append(" ")); if (discardButton.getValue() && !defaultAction.is(ScreenshotActions.NONE)) baseText.append(getDiscardButton().append(" "));
ChatUtil.info(baseText); ChatUtil.info(baseText);
} }
@@ -62,7 +62,7 @@ public class ShulkerPeek extends Module {
@SubscribeEvent @SubscribeEvent
public void onKey(KeyEvent event) { public void onKey(KeyEvent event) {
if (mc.player == null) return; if (mc.player == null) return;
if (event.getKey() != previewKey.getKey()) return; if (event.getKey() != previewKey.getValue()) return;
if (event.getAction() == GLFW.GLFW_PRESS) { if (event.getAction() == GLFW.GLFW_PRESS) {
openPreviewScreen(); openPreviewScreen();
@@ -61,12 +61,12 @@ public class LogoutSpots extends Module {
outlines.onUpdate(v -> { outlines.onUpdate(v -> {
outlineColor.setVisible(v); outlineColor.setVisible(v);
fullHeight.setVisible(v || filling.isEnabled()); fullHeight.setVisible(v || filling.getValue());
}); });
filling.onUpdate(v -> { filling.onUpdate(v -> {
fillingColor.setVisible(v); fillingColor.setVisible(v);
fullHeight.setVisible(v || outlines.isEnabled()); fullHeight.setVisible(v || outlines.getValue());
}); });
dummy.onUpdate(v -> { dummy.onUpdate(v -> {
@@ -116,7 +116,7 @@ public class LogoutSpots extends Module {
if (player.getUuid().equals(entry.getProfile().id())) { if (player.getUuid().equals(entry.getProfile().id())) {
LogoutEntry logoutEntry = new LogoutEntry(player); LogoutEntry logoutEntry = new LogoutEntry(player);
if (mc.world != null && !mc.world.hasEntity(logoutEntry.dummy) && dummy.isEnabled()) if (mc.world != null && !mc.world.hasEntity(logoutEntry.dummy) && dummy.getValue())
mc.world.addEntity(logoutEntry.dummy); mc.world.addEntity(logoutEntry.dummy);
addLogoutSpot(logoutEntry); addLogoutSpot(logoutEntry);
@@ -248,21 +248,21 @@ public class LogoutSpots extends Module {
} }
public void renderBox(MatrixStack matrices) { public void renderBox(MatrixStack matrices) {
if (fullHeight.isEnabled()) { if (fullHeight.getValue()) {
if (outlines.isEnabled()) if (outlines.getValue())
RenderUtil.drawOutlineBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), outlineColor.getColor(), lineWidth.getFloatValue(), true); RenderUtil.drawOutlineBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), outlineColor.getValue(), lineWidth.getFloatValue(), true);
if (filling.isEnabled()) if (filling.getValue())
RenderUtil.drawFilledBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), fillingColor.getColor(), true); RenderUtil.drawFilledBox(matrices, new Box(x, y, z, x + xWidth, y + height, z + zWidth), fillingColor.getValue(), true);
} else { } else {
if (outlines.isEnabled()) { if (outlines.getValue()) {
RenderUtil.drawBlockFaceOutlines(matrices, RenderUtil.drawBlockFaceOutlines(matrices,
BlockPos.ofFloored(x + halfWidth, y, z + halfWidth), BlockPos.ofFloored(x + halfWidth, y, z + halfWidth),
Direction.UP, outlineColor.getColor(), lineWidth.getFloatValue(), true); Direction.UP, outlineColor.getValue(), lineWidth.getFloatValue(), true);
} }
if (filling.isEnabled()) { if (filling.getValue()) {
RenderUtil.drawBlockFaceFilled(matrices, RenderUtil.drawBlockFaceFilled(matrices,
BlockPos.ofFloored(x + halfWidth, y, z + halfWidth), BlockPos.ofFloored(x + halfWidth, y, z + halfWidth),
Direction.UP, fillingColor.getColor(), 0.001f, true); Direction.UP, fillingColor.getValue(), 0.001f, true);
} }
} }
} }
@@ -24,7 +24,7 @@ public class AttributeSwapper extends Module {
@Override @Override
public void onTick() { public void onTick() {
if (mc.player == null || !swap.isEnabled()) return; if (mc.player == null || !swap.getValue()) return;
if (delay < swapDelay.getIntValue()) delay++; if (delay < swapDelay.getIntValue()) delay++;
if (delay >= swapDelay.getIntValue() && prevSlot != -1) { if (delay >= swapDelay.getIntValue() && prevSlot != -1) {
mc.player.getInventory().setSelectedSlot(prevSlot); mc.player.getInventory().setSelectedSlot(prevSlot);
@@ -66,8 +66,8 @@ public class FastUse extends Module {
} }
public int getCooldown(ItemStack stack) { public int getCooldown(ItemStack stack) {
if (stack.getItem() instanceof BlockItem && blocks.isEnabled()) return blockCooldown.getIntValue(); if (stack.getItem() instanceof BlockItem && blocks.getValue()) return blockCooldown.getIntValue();
if (items.isEnabled() && !(stack.getItem() instanceof BlockItem)) return itemCooldown.getIntValue(); if (items.getValue() && !(stack.getItem() instanceof BlockItem)) return itemCooldown.getIntValue();
else return 4; // cooldown por defecto, 4 ticks else return 4; // cooldown por defecto, 4 ticks
} }
} }
@@ -0,0 +1,133 @@
package me.retucio.sputnik.module.modules.player;
import me.retucio.sputnik.event.SubscribeEvent;
import me.retucio.sputnik.event.events.UseItemEvent;
import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.settings.NumberSetting;
import net.minecraft.item.Items;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
// "pedido prestado" de: https://github.com/meanwhile131/elytra-infinite
public class InfiniteElytra extends Module {
private FlyState state;
private float pitch;
private double lowestY;
public NumberSetting pitchDown = sgGeneral.add(new NumberSetting(
"cabeceo (abajo)",
"cabeceo al ir hacia abajo",
30,
-90,
90,
1
));
public NumberSetting pitchUp = sgGeneral.add(new NumberSetting(
"cabeceo (arriba)",
"cabeceo al ir hacia arriba",
-48,
-90,
90,
1
));
public NumberSetting pitchDownSpeed = sgGeneral.add(new NumberSetting(
"velocidad de cabeceo (abajo)",
"velocidad del cabeceo al ir hacia abajo",
0.5,
0.01,
5,
0.1
));
public NumberSetting pitchUpVelocity = sgGeneral.add(new NumberSetting(
"velocidad de cabeceo (arriba)",
"velocidad del cabeceo al ir hacia arriba",
2,
0.01,
5,
0.1
));
public NumberSetting ticksCollisionLookAhead = sgGeneral.add(new NumberSetting(
"precaución de colisión",
"precaución de colisión en ticks",
10,
0,
20,
1
));
public InfiniteElytra() {
super("avioneta",
"vuela infinitamente, aprovechándose el sistema defectuoso que hizo mojang (hace falta tirarse de unos 50 bloques de altura)",
Category.PLAYER);
}
@Override
public void onTick() {
if (mc.player == null || mc.world == null || !mc.player.isGliding()) {
state = FlyState.NOT_FLYING;
return;
}
if (state == FlyState.NOT_FLYING) {
state = FlyState.GLIDING_DOWN;
pitch = pitchDown.getFloatValue();
} else if (state == FlyState.PITCHING_DOWN) {
pitch += Math.min(pitchDown.getFloatValue() - pitch, pitchDownSpeed.getFloatValue());
boolean movingDownwards = mc.player.getVelocity().y <= 0 && mc.player.getY() > lowestY;
if (pitch >= pitchDown.getFloatValue() || movingDownwards) {
pitch = pitchDown.getFloatValue();
state = FlyState.GLIDING_DOWN;
}
} else if (state == FlyState.GLIDING_DOWN) {
boolean willCollide = willCollideWhileGliding(ticksCollisionLookAhead.getIntValue());
if (willCollide || mc.player.getVelocity().horizontalLengthSquared() > Math.pow(pitchUpVelocity.getFloatValue(), 2)) {
pitch = pitchUp.getFloatValue();
state = FlyState.PITCHING_DOWN;
lowestY = mc.player.getY();
}
}
mc.player.setPitch(pitch);
}
@SubscribeEvent
public void onUseItem(UseItemEvent event) {
if (mc.player == null) return;
if (mc.player.getStackInHand(event.getHand()).getItem() == Items.FIREWORK_ROCKET && !mc.player.isSpectator() && mc.player.isGliding()) {
pitch = pitchUp.getFloatValue();
mc.player.setPitch(pitch);
state = FlyState.PITCHING_DOWN;
lowestY = mc.player.getY();
}
}
private boolean willCollideWhileGliding(int ticks) {
Vec3d velocity = mc.player.getVelocity();
Box boundingBox = mc.player.getBoundingBox();
for (int i = 0; i < ticks; i++) {
velocity = mc.player.calcGlidingVelocity(velocity);
boundingBox = boundingBox.offset(velocity);
if (!mc.world.isSpaceEmpty(null, boundingBox, true)) {
return true;
}
}
return false;
}
public enum FlyState {
NOT_FLYING,
GLIDING_DOWN,
PITCHING_DOWN;
}
}
@@ -50,15 +50,15 @@ public class InventoryPlus extends Module {
int rowOffset = InventoryUtil.getRowOffset(screen); int rowOffset = InventoryUtil.getRowOffset(screen);
if (KeyUtil.isKeyDown(row1key.getKey())) { if (KeyUtil.isKeyDown(row1key.getValue())) {
event.cancel(); event.cancel();
swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset); swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset);
} }
else if (KeyUtil.isKeyDown(row2key.getKey())) { else if (KeyUtil.isKeyDown(row2key.getValue())) {
event.cancel(); event.cancel();
swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset + 9); swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset + 9);
} }
else if (KeyUtil.isKeyDown(row3key.getKey())) { else if (KeyUtil.isKeyDown(row3key.getValue())) {
event.cancel(); event.cancel();
swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset + 18); swapWithRow(screen, containerSlot, hotbarKeyIndex, rowOffset + 18);
} }
@@ -46,7 +46,7 @@ public class Offhand extends Module {
} }
if (holdingItem || (!mc.player.getOffHandStack().isEmpty() if (holdingItem || (!mc.player.getOffHandStack().isEmpty()
&& !override.isEnabled())) && !override.getValue()))
return; return;
if (mc.player.playerScreenHandler == mc.player.currentScreenHandler) { if (mc.player.playerScreenHandler == mc.player.currentScreenHandler) {
@@ -4,7 +4,6 @@ import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.BooleanSetting;
import me.retucio.sputnik.module.setting.settings.NumberSetting; import me.retucio.sputnik.module.setting.settings.NumberSetting;
import me.retucio.sputnik.util.ChatUtil;
import net.minecraft.util.hit.HitResult; import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@@ -44,11 +43,11 @@ public class ReverseStep extends Module {
if (mc.player == null || mc.world == null) return; if (mc.player == null || mc.world == null) return;
if (!mc.player.isOnGround()) { if (!mc.player.isOnGround()) {
if (jumping.isEnabled()) return; if (jumping.getValue()) return;
} }
if ((mc.player.isTouchingWater() || mc.player.isInLava())) { if ((mc.player.isTouchingWater() || mc.player.isInLava())) {
if (disableInWater.isEnabled()) return; if (disableInWater.getValue()) return;
} }
double dropHeight = getHeight(); double dropHeight = getHeight();
@@ -60,7 +60,7 @@ public class WarnLowDurability extends Module {
float percentage = (1 - (float) stack.getDamage() / stack.getMaxDamage()) * 100; float percentage = (1 - (float) stack.getDamage() / stack.getMaxDamage()) * 100;
if (percentage <= limitPercentage.getValue() && percentage < prevPercentage) { if (percentage <= limitPercentage.getValue() && percentage < prevPercentage) {
if (playSound.isEnabled()) if (playSound.getValue())
mc.world.playSound(mc.player, mc.player.getBlockPos(), mc.world.playSound(mc.player, mc.player.getBlockPos(),
sound.getValue(), sound.getValue(),
SoundCategory.AMBIENT, SoundCategory.AMBIENT,
@@ -68,7 +68,7 @@ public class WarnLowDurability extends Module {
toExponential(pitch) toExponential(pitch)
); );
if (message.isEnabled()) { if (message.getValue()) {
String customName = stack.getCustomName() == null ? "" : " \"" + stack.getCustomName().getString() + "\""; String customName = stack.getCustomName() == null ? "" : " \"" + stack.getCustomName().getString() + "\"";
Text text = Text.literal(Formatting.AQUA + stack.getItemName().getString() Text text = Text.literal(Formatting.AQUA + stack.getItemName().getString()
+ Formatting.GREEN + customName + Formatting.RESET + Formatting.GREEN + customName + Formatting.RESET
@@ -176,8 +176,8 @@ public class BlockESP extends Module {
} }
// renderizado // renderizado
if (outlines.isEnabled()) { if (outlines.getValue()) {
Color color = outlineColor.getColor(); Color color = outlineColor.getValue();
RenderUtil.drawVoxelShapeOutline( RenderUtil.drawVoxelShapeOutline(
event.getMatrices(), event.getMatrices(),
shape, shape,
@@ -187,8 +187,8 @@ public class BlockESP extends Module {
false); false);
} }
if (fillings.isEnabled()) { if (fillings.getValue()) {
Color color = fillingColor.getColor(); Color color = fillingColor.getValue();
RenderUtil.drawVoxelShapeFilled( RenderUtil.drawVoxelShapeFilled(
event.getMatrices(), event.getMatrices(),
shape, shape,
@@ -222,7 +222,7 @@ public class BlockESP extends Module {
lastRadius = currentRadius; lastRadius = currentRadius;
// multithreading // multithreading
if (asyncSearch.isEnabled()) { if (asyncSearch.getValue()) {
if (isSearching) return; if (isSearching) return;
isSearching = true; isSearching = true;
@@ -73,8 +73,8 @@ public class BreakingProgress extends Module {
centerX + shrunkX, centerY + shrunkZ, centerZ + shrunkZ centerX + shrunkX, centerY + shrunkZ, centerZ + shrunkZ
); );
if (outlines.isEnabled()) RenderUtil.drawOutlineBox(event.getMatrices(), scaledBox, outlineColor.getColor(), lineWidth.getFloatValue(), false); if (outlines.getValue()) RenderUtil.drawOutlineBox(event.getMatrices(), scaledBox, outlineColor.getValue(), lineWidth.getFloatValue(), false);
if (fillings.isEnabled()) RenderUtil.drawFilledBox(event.getMatrices(), scaledBox, fillingColor.getColor(), false); if (fillings.getValue()) RenderUtil.drawFilledBox(event.getMatrices(), scaledBox, fillingColor.getValue(), false);
} }
public enum BreakMode { public enum BreakMode {
@@ -5,6 +5,7 @@ import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.settings.ColorSetting; import me.retucio.sputnik.module.setting.settings.ColorSetting;
import me.retucio.sputnik.util.Colors;
import net.minecraft.client.texture.NativeImage; import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture; import net.minecraft.client.texture.NativeImageBackedTexture;
@@ -16,7 +17,12 @@ import java.awt.*;
public class DamageOverlay extends Module { public class DamageOverlay extends Module {
public ColorSetting colorSetting = sgGeneral.add(new ColorSetting("color", "color", new Color(255, 0, 0, 77), false)); public ColorSetting colorSetting = sgGeneral.add(new ColorSetting(
"color",
"color",
Colors.mainColor,
false
));
private NativeImageBackedTexture texture = null; private NativeImageBackedTexture texture = null;
@@ -38,7 +38,7 @@ public class Fonts extends Module {
} }
private void reload() { private void reload() {
if (mc.getResourceManager() != null && reload.isEnabled()) { if (mc.getResourceManager() != null && reload.getValue()) {
mc.reloadResources(); mc.reloadResources();
} }
} }
@@ -4,7 +4,6 @@ import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.settings.BooleanSetting; import me.retucio.sputnik.module.setting.settings.BooleanSetting;
import me.retucio.sputnik.module.setting.settings.EnumSetting; import me.retucio.sputnik.module.setting.settings.EnumSetting;
import me.retucio.sputnik.module.setting.settings.NumberSetting;
import me.retucio.sputnik.util.render.GlintRenderLayer; import me.retucio.sputnik.util.render.GlintRenderLayer;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderLayers; import net.minecraft.client.render.RenderLayers;
@@ -45,19 +44,19 @@ public class GlintPlus extends Module {
public RenderLayer getGlint() { public RenderLayer getGlint() {
int color = getColor(); int color = getColor();
if (!isEnabled() || !items.isEnabled()) return RenderLayers.glint(); if (!isEnabled() || !items.getValue()) return RenderLayers.glint();
return GlintRenderLayer.glintColor.get(color); return GlintRenderLayer.glintColor.get(color);
} }
public RenderLayer getEntityGlint() { public RenderLayer getEntityGlint() {
int color = getColor(); int color = getColor();
if (!isEnabled() || !items.isEnabled()) return RenderLayers.entityGlint(); if (!isEnabled() || !items.getValue()) return RenderLayers.entityGlint();
return GlintRenderLayer.entityGlintColor.get(color); return GlintRenderLayer.entityGlintColor.get(color);
} }
public RenderLayer getArmorEntityGlint() { public RenderLayer getArmorEntityGlint() {
int color = getColor(); int color = getColor();
if (!isEnabled() || !armor.isEnabled()) return RenderLayers.armorEntityGlint(); if (!isEnabled() || !armor.getValue()) return RenderLayers.armorEntityGlint();
return GlintRenderLayer.armorEntityGlintColor.get(color); return GlintRenderLayer.armorEntityGlintColor.get(color);
} }
@@ -73,7 +73,7 @@ public class Nametags extends Module {
defaultEntities.replace(EntityType.ARROW, true); defaultEntities.replace(EntityType.ARROW, true);
defaultEntities.replace(EntityType.SPECTRAL_ARROW, true); defaultEntities.replace(EntityType.SPECTRAL_ARROW, true);
defaultEntities.replace(EntityType.TRIDENT, true); defaultEntities.replace(EntityType.TRIDENT, true);
entities.setDefaultValues(defaultEntities); entities.setDefaultValue(defaultEntities);
health.onUpdate(v -> healthMode.setVisible(v)); health.onUpdate(v -> healthMode.setVisible(v));
@@ -162,7 +162,7 @@ public class LightOverlay extends Module {
// color // color
Color color; Color color;
if (light == 0) { if (light == 0) {
color = darknessColor.getColor(); color = darknessColor.getValue();
} else { } else {
float ratio = light / 15.0f; float ratio = light / 15.0f;
color = new Color( color = new Color(
@@ -174,7 +174,7 @@ public class LightOverlay extends Module {
} }
// renderizar // renderizar
boolean shouldCull = !(onWater.isEnabled() && aboveState.isOf(Blocks.WATER) && dontCullWater.isEnabled()); boolean shouldCull = !(onWater.getValue() && aboveState.isOf(Blocks.WATER) && dontCullWater.getValue());
RenderUtil.drawBlockFaceFilled(event.getMatrices(), block, Direction.UP, color, 0.001f, shouldCull); RenderUtil.drawBlockFaceFilled(event.getMatrices(), block, Direction.UP, color, 0.001f, shouldCull);
} }
} }
@@ -193,7 +193,7 @@ public class LightOverlay extends Module {
(lastPlayerPos != null && (lastPlayerPos != null &&
playerPos.getSquaredDistance(lastPlayerPos) > (movementThreshold.getValue() * movementThreshold.getValue())); playerPos.getSquaredDistance(lastPlayerPos) > (movementThreshold.getValue() * movementThreshold.getValue()));
if (!needsUpdate && incrementalUpdates.isEnabled() && incrementalLayer >= 0) { if (!needsUpdate && incrementalUpdates.getValue() && incrementalLayer >= 0) {
// actualización incremental de una sola capa // actualización incremental de una sola capa
performIncrementalUpdate(playerPos, currentRadius, currentYRadius); performIncrementalUpdate(playerPos, currentRadius, currentYRadius);
return; return;
@@ -210,7 +210,7 @@ public class LightOverlay extends Module {
incrementalLayer = 0; incrementalLayer = 0;
// búsqueda // búsqueda
if (asyncSearch.isEnabled()) { if (asyncSearch.getValue()) {
if (isSearching) return; if (isSearching) return;
isSearching = true; isSearching = true;
@@ -324,7 +324,7 @@ public class LightOverlay extends Module {
Block aboveBlock = aboveState.getBlock(); Block aboveBlock = aboveState.getBlock();
if (aboveState.isAir()) return true; if (aboveState.isAir()) return true;
if (aboveBlock == Blocks.WATER && onWater.isEnabled()) return true; if (aboveBlock == Blocks.WATER && onWater.getValue()) return true;
if (aboveBlock instanceof PlantBlock) return true; if (aboveBlock instanceof PlantBlock) return true;
if (aboveBlock instanceof SlabBlock || if (aboveBlock instanceof SlabBlock ||
@@ -25,7 +25,7 @@ public class NoMiningInterruptions extends Module {
if (entity == null || !isEnabled() || mc.player == null) return false; if (entity == null || !isEnabled() || mc.player == null) return false;
boolean pickaxe = true; boolean pickaxe = true;
if (withPickaxeOnly.isEnabled()) if (withPickaxeOnly.getValue())
pickaxe = (mc.player.getMainHandStack().isIn(ItemTags.PICKAXES) pickaxe = (mc.player.getMainHandStack().isIn(ItemTags.PICKAXES)
|| mc.player.getOffHandStack().isIn(ItemTags.PICKAXES)); || mc.player.getOffHandStack().isIn(ItemTags.PICKAXES));
@@ -0,0 +1,167 @@
package me.retucio.sputnik.module.modules.world;
import me.retucio.sputnik.event.SubscribeEvent;
import me.retucio.sputnik.event.events.AddEntityEvent;
import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.util.ChatUtil;
import me.retucio.sputnik.util.EntityUtil;
import net.minecraft.entity.EyeOfEnderEntity;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
import net.minecraft.util.math.Vec3d;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
// https://benwoodworth.com/minecraft/stronghold-calculator/index.js
public class StrongholdTriangulator extends Module {
public StrongholdTriangulator() {
super("triangulador de strongholds",
"usa josecadas para calcular la posición de la stronghold más cercana",
Category.WORLD);
}
private boolean firstEyeThrown;
private boolean secondEyeThrown;
private Vec3d a;
private Vec3d b;
private float alpha;
private float beta;
// usar un ejecutor retrasado para esperar a que el ojo de ender adquiera su ángulo
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
@Override
public void onEnable() {
super.onEnable();
ChatUtil.info("para empezar, lanza un ojo de ender");
ChatUtil.info("al lanzar los ojos, quédate quieto, o puede que la posición calculada salga errónea");
}
@Override
public void onDisable() {
reset();
scheduler.shutdown();
super.onDisable();
}
@Override
public void onTick() {
if (mc.player == null || mc.world == null) return;
if (firstEyeThrown && secondEyeThrown) {
StrongholdResult result = getIntersection();
if (result != null) {
if (result.errorMessage == null) {
ChatUtil.info(Text.literal("stronghold aproximadamente en: "
+ Formatting.GREEN
+ String.format("%.2f, %.2f", result.x, result.z)
+ Formatting.RESET
));
} else {
ChatUtil.error(result.errorMessage);
}
} else {
ChatUtil.error("upsi");
}
reset();
}
}
@SubscribeEvent
public void onAddEntity(AddEntityEvent event) {
if (mc.player == null || mc.world == null) return;
if (mc.player.getStackInHand(Hand.MAIN_HAND).getItem() != Items.ENDER_EYE) return;
if (event.getEntity() instanceof EyeOfEnderEntity eye) {
Vec3d throwPos = mc.player.getEntityPos();
int entityId = eye.getId();
scheduler.schedule(() -> {
// ejecutar en el hilo principal
mc.execute(() -> {
EyeOfEnderEntity currentEye = findEyeEntity(entityId);
if (currentEye != null) {
Vec3d eyeTargetPos = eye.getEntityPos();
if (eyeTargetPos != null) {
float yaw = (float) EntityUtil.getYaw(eyeTargetPos);
if (!firstEyeThrown) {
a = throwPos;
alpha = yaw;
firstEyeThrown = true;
ChatUtil.info("primer ojo registrado: "
+ String.format("%.1f, %.1f (%.1f°)", a.x, a.z, alpha));
ChatUtil.info("ahora muévete unos 200 bloques en una dirección distinta a la del ojo para lanzar el segundo");
ChatUtil.info("cuanta más distancia te separes, más preciso será el resultado");
} else if (!secondEyeThrown) {
b = throwPos;
beta = yaw;
secondEyeThrown = true;
ChatUtil.info("segundo ojo registrado: " +
String.format("%.1f, %.1f (%.1f°)", b.x, b.z, beta));
}
} else {
ChatUtil.error("upsi dupsi");
}
}
});
}, 1000, TimeUnit.MILLISECONDS); // esperar un segundo, a que el ojo adquiera velocidad
}
}
private EyeOfEnderEntity findEyeEntity(int entityId) {
if (mc.world == null) return null;
return (EyeOfEnderEntity) mc.world.getEntityById(entityId);
}
private StrongholdResult getIntersection() {
if (a == null || b == null) return null;
// obtener coordenadas y ángulos
double x0 = a.x;
double x1 = b.x;
double z0 = a.z;
double z1 = b.z;
double yaw0 = alpha / 180 * Math.PI;
double yaw1 = beta / 180 * Math.PI;
// distancia
double d0 = ((x1 - x0) + (z1 - z0) * Math.tan(yaw1)) / (Math.cos(yaw0) * Math.tan(yaw1) - Math.sin(yaw0));
double d1 = (d0 * Math.cos(yaw0) - (z1 - z0)) / Math.cos(yaw1);
// posición de la stronghold
double x = x0 - d0 * Math.sin(yaw0);
double z = z0 + d0 * Math.cos(yaw0);
// posibles casos
if (x0 == x1 && z0 == z1) { // ambos ojos lanzados desde la misma pos.
return new StrongholdResult(null, null, "pero muévete");
} else if (Double.isNaN(d0)) {
return new StrongholdResult(null, null, "los ojos forman líneas paralelas o coincidentes");
} else if (d0 < 0 || d1 < 0) {
return new StrongholdResult(null, null, "los ojos apuntan a strongholds distintas");
} else {
return new StrongholdResult(x, z, null);
}
}
private void reset() {
firstEyeThrown = false;
secondEyeThrown = false;
a = null;
b = null;
}
public record StrongholdResult(Double x, Double z, String errorMessage) {}
}
@@ -4,20 +4,29 @@ import me.retucio.sputnik.Sputnik;
import me.retucio.sputnik.event.events.sputnik.UpdateSettingEvent; import me.retucio.sputnik.event.events.sputnik.UpdateSettingEvent;
import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.Module;
import java.util.function.Consumer;
// base para los tipos de ajustes // base para los tipos de ajustes
public abstract class Setting { public abstract class Setting<T> {
private final String name; protected final String name;
private final String description; protected final String description;
private boolean visible = true; protected T value;
private boolean searchMatch = true; protected T defaultValue;
private SettingGroup sg; protected Consumer<T> updateListener;
protected Setting(String name, String description) { protected boolean visible = true;
protected boolean searchMatch = true;
protected SettingGroup sg;
protected Setting(String name, String description, T defaultValue) {
this.name = name; this.name = name;
this.description = description; this.description = description;
this.value = defaultValue;
this.defaultValue = defaultValue;
} }
public boolean isVisible() { public boolean isVisible() {
@@ -44,6 +53,35 @@ public abstract class Setting {
return description; return description;
} }
public T getValue() {
return value;
}
public void setValue(T value) {
if (this.value != value) {
this.value = value;
fireUpdateEvent();
if (updateListener != null) {
updateListener.accept(value);
}
}
}
public T getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(T value) {
if (this.defaultValue != value) {
this.defaultValue = value;
}
}
public void reset() {
setValue(defaultValue);
}
public SettingGroup getSg() { public SettingGroup getSg() {
return sg; return sg;
} }
@@ -52,13 +90,17 @@ public abstract class Setting {
this.sg = sg; this.sg = sg;
} }
public Module getModule() {
return this.sg.getModule();
}
public void fireUpdateEvent() { public void fireUpdateEvent() {
Sputnik.EVENT_BUS.post( Sputnik.EVENT_BUS.post(
new UpdateSettingEvent( new UpdateSettingEvent(this, getModule().shouldSaveSettings()));
this, }
sg.getModule()
.shouldSaveSettings() public void onUpdate(Consumer<T> listener) {
) this.updateListener = listener;
); if (updateListener != null) updateListener.accept(value); // actualizar por primera vez
} }
} }
@@ -5,18 +5,17 @@ import me.retucio.sputnik.module.Module;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
public class SettingGroup implements Iterable<Setting> { public class SettingGroup implements Iterable<Setting<?>> {
private Module module; private Module module;
private final String name; private final String name;
private boolean extended; private boolean extended;
final List<Setting> settings = new ArrayList<>(1); final List<Setting<?>> settings = new ArrayList<>(1);
public SettingGroup(String name, boolean extended) { public SettingGroup(String name, boolean extended) {
this.name = name; this.name = name;
@@ -24,31 +23,35 @@ public class SettingGroup implements Iterable<Setting> {
} }
@Override @Override
public @NotNull Iterator<Setting> iterator() { public @NotNull Iterator<Setting<?>> iterator() {
return settings.iterator(); return settings.iterator();
} }
public <S extends Setting> S add(S setting) { public <S extends Setting<?>> S add(S setting) {
setting.setSg(this); setting.setSg(this);
settings.add(setting); settings.add(setting);
return setting; return setting;
} }
@SafeVarargs @SafeVarargs
public final <S extends Setting> void addAll(S... ss) { public final <S extends Setting<?>> void addAll(S... ss) {
for (S s : ss) { for (S s : ss) {
add(s); add(s);
} }
} }
public Setting getSetting(String name) { public Setting<?> getSetting(String name) {
for (Setting setting : this) for (Setting<?> setting : this)
if (setting.getName().equals(name)) if (setting.getName().equals(name))
return setting; return setting;
return null; return null;
} }
public List<Setting<?>> getSettings() {
return settings;
}
public String getName() { public String getName() {
return name; return name;
} }
@@ -2,53 +2,15 @@ package me.retucio.sputnik.module.setting.settings;
import me.retucio.sputnik.module.setting.Setting; import me.retucio.sputnik.module.setting.Setting;
import java.util.function.Consumer;
// ajuste booleano, es decir, o se encuentra encencido o apagado (similar a un interruptor) // ajuste booleano, es decir, o se encuentra encencido o apagado (similar a un interruptor)
public class BooleanSetting extends Setting { public class BooleanSetting extends Setting<Boolean> {
private boolean defaultValue;
private boolean enabled;
private Consumer<Boolean> updateListener;
public BooleanSetting(String name, String description, boolean defaultValue) { public BooleanSetting(String name, String description, boolean defaultValue) {
super(name, description); super(name, description, defaultValue);
this.enabled = defaultValue;
this.defaultValue = defaultValue;
} }
public void toggle() { public void toggle() {
setEnabled(!enabled); setValue(!value);
if (updateListener != null) updateListener.accept(enabled); if (updateListener != null) updateListener.accept(value);
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
if (this.enabled != enabled) {
this.enabled = enabled;
fireUpdateEvent();
if (updateListener != null) updateListener.accept(enabled);
}
}
public boolean getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(boolean value) {
defaultValue = value;
}
public void reset() {
setEnabled(defaultValue);
}
public void onUpdate(Consumer<Boolean> listener) {
this.updateListener = listener;
if (updateListener != null) updateListener.accept(enabled); // actualizar por primera vez
} }
} }
@@ -7,16 +7,12 @@ import net.minecraft.text.Text;
import java.awt.*; import java.awt.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer;
public class ColorSetting extends Setting { public class ColorSetting extends Setting<Color> {
private Color color;
private Consumer<Color> updateListener;
private Color defaultColor; private Color defaultColor;
private boolean defaultRainbow; private final boolean defaultRainbow;
private int defaultRainbowSpeed; private final int defaultRainbowSpeed;
private int r, g, b, a; private int r, g, b, a;
@@ -26,8 +22,7 @@ public class ColorSetting extends Setting {
private float brightness; private float brightness;
public ColorSetting(String name, String description, Color defaultColor, boolean rainbow) { public ColorSetting(String name, String description, Color defaultColor, boolean rainbow) {
super(name, description); super(name, description, defaultColor);
this.color = this.defaultColor = defaultColor;
this.r = defaultColor.getRed(); this.r = defaultColor.getRed();
this.g = defaultColor.getGreen(); this.g = defaultColor.getGreen();
@@ -43,13 +38,8 @@ public class ColorSetting extends Setting {
this.brightness = 1f; this.brightness = 1f;
} }
public Color getColor() {
if (rainbow) return Colors.rainbowColor(rainbowSpeed, a, saturation, brightness);
return color;
}
public int getR() { public int getR() {
return getColor().getRed(); return getValue().getRed();
} }
public void setR(int r) { public void setR(int r) {
@@ -57,12 +47,12 @@ public class ColorSetting extends Setting {
this.r = Math.clamp(r, 0, 255); this.r = Math.clamp(r, 0, 255);
updateColorFromRGB(); updateColorFromRGB();
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null) updateListener.accept(color); if (updateListener != null) updateListener.accept(value);
} }
} }
public int getG() { public int getG() {
return getColor().getGreen(); return getValue().getGreen();
} }
public void setG(int g) { public void setG(int g) {
@@ -70,12 +60,12 @@ public class ColorSetting extends Setting {
this.g = Math.clamp(g, 0, 255); this.g = Math.clamp(g, 0, 255);
updateColorFromRGB(); updateColorFromRGB();
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null) updateListener.accept(color); if (updateListener != null) updateListener.accept(value);
} }
} }
public int getB() { public int getB() {
return getColor().getBlue(); return getValue().getBlue();
} }
public void setB(int b) { public void setB(int b) {
@@ -83,7 +73,7 @@ public class ColorSetting extends Setting {
this.b = Math.clamp(b, 0, 255); this.b = Math.clamp(b, 0, 255);
updateColorFromRGB(); updateColorFromRGB();
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null) updateListener.accept(color); if (updateListener != null) updateListener.accept(value);
} }
} }
@@ -96,24 +86,31 @@ public class ColorSetting extends Setting {
this.a = Math.clamp(a, 0, 255); this.a = Math.clamp(a, 0, 255);
updateColorFromRGB(); updateColorFromRGB();
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null) updateListener.accept(color); if (updateListener != null) updateListener.accept(value);
} }
} }
private void updateColorFromRGB() { private void updateColorFromRGB() {
this.color = new Color(r, g, b, a); this.value = new Color(r, g, b, a);
} }
public void setColor(Color color) { @Override
if (!this.color.equals(color)) { public Color getValue() {
this.color = color; if (rainbow) return Colors.rainbowColor(rainbowSpeed, a, saturation, brightness);
this.r = color.getRed(); return super.getValue();
this.g = color.getGreen(); }
this.b = color.getBlue();
this.a = color.getAlpha(); @Override
fireUpdateEvent(); public void setValue(Color value) {
if (updateListener != null) updateListener.accept(color); if (!this.value.equals(value)) {
this.value = value;
this.r = value.getRed();
this.g = value.getGreen();
this.b = value.getBlue();
this.a = value.getAlpha();
} }
super.setValue(value);
} }
public void setRGB(int r, int g, int b) { public void setRGB(int r, int g, int b) {
@@ -143,7 +140,7 @@ public class ColorSetting extends Setting {
if (changed) { if (changed) {
updateColorFromRGB(); updateColorFromRGB();
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null) updateListener.accept(color); if (updateListener != null) updateListener.accept(value);
} }
} }
@@ -155,7 +152,7 @@ public class ColorSetting extends Setting {
if (this.rainbow != rainbow) { if (this.rainbow != rainbow) {
this.rainbow = rainbow; this.rainbow = rainbow;
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null) updateListener.accept(getColor()); if (updateListener != null) updateListener.accept(getValue());
} }
} }
@@ -167,7 +164,7 @@ public class ColorSetting extends Setting {
if (this.rainbowSpeed != rainbowSpeed) { if (this.rainbowSpeed != rainbowSpeed) {
this.rainbowSpeed = rainbowSpeed; this.rainbowSpeed = rainbowSpeed;
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null && rainbow) updateListener.accept(getColor()); if (updateListener != null && rainbow) updateListener.accept(getValue());
} }
} }
@@ -179,7 +176,7 @@ public class ColorSetting extends Setting {
if (this.saturation != saturation) { if (this.saturation != saturation) {
this.saturation = Math.clamp(saturation, 0f, 1f); this.saturation = Math.clamp(saturation, 0f, 1f);
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null && rainbow) updateListener.accept(getColor()); if (updateListener != null && rainbow) updateListener.accept(getValue());
} }
} }
@@ -191,7 +188,7 @@ public class ColorSetting extends Setting {
if (this.brightness != brightness) { if (this.brightness != brightness) {
this.brightness = Math.clamp(brightness, 0f, 1f); this.brightness = Math.clamp(brightness, 0f, 1f);
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null && rainbow) updateListener.accept(getColor()); if (updateListener != null && rainbow) updateListener.accept(getValue());
} }
} }
@@ -236,16 +233,15 @@ public class ColorSetting extends Setting {
} }
public int getRGB() { public int getRGB() {
return getColor().getRGB(); return getValue().getRGB();
} }
public Text getTooltipText() { public Text getTooltipText() {
if (rainbow) return Text.literal("arcoíris"); if (rainbow) return Text.literal("arcoíris");
return Text.literal(Colors.getFormatting(color) + Colors.ARGBtoHex(a, r, g, b)); return Text.literal(Colors.getFormatting(value) + Colors.ARGBtoHex(a, r, g, b));
} }
public void reset() { public void reset() {
this.color = defaultColor;
this.r = defaultColor.getRed(); this.r = defaultColor.getRed();
this.g = defaultColor.getGreen(); this.g = defaultColor.getGreen();
this.b = defaultColor.getBlue(); this.b = defaultColor.getBlue();
@@ -254,13 +250,7 @@ public class ColorSetting extends Setting {
this.rainbowSpeed = 2; this.rainbowSpeed = 2;
this.saturation = 1f; this.saturation = 1f;
this.brightness = 1f; this.brightness = 1f;
fireUpdateEvent(); super.reset();
if (updateListener != null) updateListener.accept(color);
}
public void onUpdate(Consumer<Color> listener) {
this.updateListener = listener;
if (updateListener != null) updateListener.accept(getColor());
} }
public Map<String, ?> getConfigValue() { public Map<String, ?> getConfigValue() {
@@ -7,35 +7,23 @@ import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
// ajuste que te deja elegir entre distintas opciones definidas, dentro de un Enum // ajuste que te deja elegir entre distintas opciones definidas, dentro de un Enum
public class EnumSetting<E extends Enum<E>> extends Setting { public class EnumSetting<E extends Enum<E>> extends Setting<E> {
private final List<E> values; private final List<E> values;
private E defaultValue;
private E value;
private int index; private int index;
private Consumer<E> updateListener;
public EnumSetting(String name, String description, Class<E> enumClass, E defaultValue) { public EnumSetting(String name, String description, Class<E> enumClass, E defaultValue) {
super(name, description); super(name, description, defaultValue);
this.values = Arrays.asList(enumClass.getEnumConstants()); this.values = Arrays.asList(enumClass.getEnumConstants());
this.defaultValue = defaultValue;
this.value = defaultValue;
this.index = values.indexOf(defaultValue); this.index = values.indexOf(defaultValue);
} }
public E getValue() {
return value;
}
public void setValue(E value) { public void setValue(E value) {
if (this.value != value) { if (this.value != value) {
this.value = value;
this.index = values.indexOf(value); this.index = values.indexOf(value);
fireUpdateEvent();
if (updateListener != null) updateListener.accept(value);
} }
super.setValue(value);
} }
public List<E> getValues() { public List<E> getValues() {
@@ -69,21 +57,4 @@ public class EnumSetting<E extends Enum<E>> extends Setting {
else else
setIndex(values.size() - 1); setIndex(values.size() - 1);
} }
public void setDefaultValue(E value) {
defaultValue = value;
}
public E getDefaultValue() {
return defaultValue;
}
public void reset() {
setValue(defaultValue);
}
public void onUpdate(Consumer<E> listener) {
this.updateListener = listener;
if (updateListener != null) updateListener.accept(value);
}
} }
@@ -8,66 +8,40 @@ import me.retucio.sputnik.util.ChatUtil;
import me.retucio.sputnik.util.KeyUtil; import me.retucio.sputnik.util.KeyUtil;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import java.util.Objects;
import java.util.function.Consumer; import java.util.function.Consumer;
public class KeySetting extends Setting { public class KeySetting extends Setting<Integer> {
private int key;
private int defaultKey;
private Consumer<Integer> updateListener;
public KeySetting(String name, String description, int defaultKey) { public KeySetting(String name, String description, int defaultKey) {
super(name, description); super(name, description, defaultKey);
this.key = defaultKey; this.value = defaultKey;
this.defaultKey = defaultKey; this.defaultValue = defaultKey;
} }
public int getKey() { @Override
return key; public void setValue(Integer value) {
} if (this.value.equals(value)) return;
public void setKey(int key) { if (value == GLFW.GLFW_KEY_ESCAPE) {
if (this.key == key) return; this.value = GLFW.GLFW_KEY_UNKNOWN; // asignar la tecla ESC a deshabilitar la tecla
if (key == GLFW.GLFW_KEY_ESCAPE) {
this.key = GLFW.GLFW_KEY_UNKNOWN; // asignar la tecla ESC a deshabilitar la tecla
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null) updateListener.accept(key); if (updateListener != null) updateListener.accept(value);
return; return;
} }
if (ModuleManager.INSTANCE != null) { if (ModuleManager.INSTANCE != null) {
for (Module module : ModuleManager.INSTANCE.getModules()) for (Module module : ModuleManager.INSTANCE.getModules())
if (module.getKey() == key && !ClientSettingsFrame.guiSettings.multipleKeybinds.isEnabled() && key != -1) { if (module.getKey() == value && !ClientSettingsFrame.guiSettings.multipleKeybinds.getValue() && value != -1) {
module.setKey(-1); module.setKey(-1);
ChatUtil.info("tecla del módulo " + module.getName() + " restablecida"); ChatUtil.info("tecla del módulo " + module.getName() + " restablecida");
} }
} }
this.key = key;
fireUpdateEvent(); super.setValue(value);
if (updateListener != null) updateListener.accept(key);
}
public int getDefaultKey() {
return defaultKey;
}
public void setDefaultKey(int key) {
this.defaultKey = key;
} }
public String getKeyName() { public String getKeyName() {
return KeyUtil.getKeyName(key); return KeyUtil.getKeyName(value);
}
public void reset() {
setKey(defaultKey);
}
public void onUpdate(Consumer<Integer> listener) {
this.updateListener = listener;
if (updateListener != null) updateListener.accept(key);
} }
} }
@@ -2,31 +2,24 @@ package me.retucio.sputnik.module.setting.settings;
import me.retucio.sputnik.module.setting.Setting; import me.retucio.sputnik.module.setting.Setting;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
public class ListSetting<T> extends Setting { public class ListSetting<T> extends Setting<Map<T, Boolean>> {
private List<T> options; private final List<T> options;
private Map<T, Boolean> values;
private Map<T, Boolean> defaultValues;
private Map<T, String> displayNames = null; private Map<T, String> displayNames = null;
private Consumer<Map<T, Boolean>> updateListener;
public ListSetting(String name, String description, List<T> options, Map<T, Boolean> initialValues) { public ListSetting(String name, String description, List<T> options, Map<T, Boolean> initialValues) {
super(name, description); super(name, description, initialValues);
this.options = new ArrayList<>(options); this.options = new ArrayList<>(options);
this.defaultValues = new HashMap<>(); this.defaultValue = new HashMap<>();
for (T option : options) { for (T option : options) {
boolean enabled = initialValues != null && initialValues.getOrDefault(option, false); boolean enabled = initialValues != null && initialValues.getOrDefault(option, false);
defaultValues.put(option, enabled); defaultValue.put(option, enabled);
} }
this.values = new HashMap<>(defaultValues);
this.value = new HashMap<>(defaultValue);
} }
public ListSetting(String name, String description, List<T> options, Map<T, Boolean> initialValues, Map<T, String> displayNames) { public ListSetting(String name, String description, List<T> options, Map<T, Boolean> initialValues, Map<T, String> displayNames) {
@@ -35,14 +28,14 @@ public class ListSetting<T> extends Setting {
} }
public boolean isEnabled(T option) { public boolean isEnabled(T option) {
return values.getOrDefault(option, false); return value.getOrDefault(option, false);
} }
public void setEnabled(T option, boolean enabled) { public void setEnabled(T option, boolean enabled) {
if (values.containsKey(option) && values.get(option) != enabled) { if (value.containsKey(option) && value.get(option) != enabled) {
values.put(option, enabled); value.put(option, enabled);
fireUpdateEvent(); fireUpdateEvent();
if (updateListener != null) updateListener.accept(new HashMap<>(values)); if (updateListener != null) updateListener.accept(new HashMap<>(value));
} }
} }
@@ -51,58 +44,49 @@ public class ListSetting<T> extends Setting {
} }
public Map<T, Boolean> getValues() { public Map<T, Boolean> getValues() {
return new HashMap<>(values); return new HashMap<>(value);
} }
public void setValues(Map<T, Boolean> values) { @Override
this.values = new HashMap<>(values); public void setValue(Map<T, Boolean> values) {
if (!this.value.equals(values)) {
super.setValue(values);
}
} }
public Map<T, Boolean> getDefaultValues() { public void setDefaultValue(Map<T, Boolean> values) {
return new HashMap<>(defaultValues); defaultValue.clear();
} defaultValue.putAll(values);
public void setDefaultValues(Map<T, Boolean> values) {
defaultValues = values;
} }
public Map<String, Boolean> getConfigValues() { public Map<String, Boolean> getConfigValues() {
Map<String, Boolean> configValues = new HashMap<>(); Map<String, Boolean> configValues = new HashMap<>();
for (int i = 0; i < values.size(); i++) for (T option : options) {
configValues.put(getDisplayName(options.get(i)), values.get(options.get(i))); configValues.put(getDisplayName(option), value.getOrDefault(option, false));
}
return configValues; return configValues;
} }
public void addOption(T option, boolean value, String displayName) { public void addOption(T option, boolean isDefault, String displayName) {
if (!(this.options instanceof ArrayList)) options.add(option);
this.options = new ArrayList<>(this.options); defaultValue.put(option, isDefault);
value.put(option, isDefault);
this.options.add(option); if (this.displayNames != null) {
this.values.put(option, value);
this.defaultValues.put(option, value);
if (this.displayNames != null)
this.displayNames.put(option, displayName); this.displayNames.put(option, displayName);
} }
public void reset() {
values.clear();
values.putAll(defaultValues);
fireUpdateEvent();
if (updateListener != null) updateListener.accept(new HashMap<>(values));
} }
public void setAll(boolean enabled) { public void setAll(boolean enabled) {
for (T option : options) values.put(option, enabled); for (T option : options) {
} value.put(option, enabled);
}
public void onUpdate(Consumer<Map<T, Boolean>> listener) { fireUpdateEvent();
this.updateListener = listener; if (updateListener != null) updateListener.accept(new HashMap<>(value));
if (updateListener != null) updateListener.accept(new HashMap<>(values));
} }
public List<T> getOptions() { public List<T> getOptions() {
return options; return Collections.unmodifiableList(options);
} }
public List<T> getEnabledOptions() { public List<T> getEnabledOptions() {
@@ -116,11 +100,13 @@ public class ListSetting<T> extends Setting {
} }
public Map<T, String> getDisplayNames() { public Map<T, String> getDisplayNames() {
return displayNames; return displayNames != null ? new HashMap<>(displayNames) : null;
} }
public String getDisplayName(T key) { public String getDisplayName(T key) {
if (displayNames != null) return displayNames.get(key); if (displayNames != null && displayNames.containsKey(key)) {
return key.toString(); return displayNames.get(key);
}
return key != null ? key.toString() : "?";
} }
} }
@@ -5,20 +5,16 @@ import me.retucio.sputnik.module.setting.Setting;
import java.util.function.Consumer; import java.util.function.Consumer;
// ajuste numérico, es decir, que eliges un valor númerico entre el mínimo y el máximo disponibles // ajuste numérico, es decir, que eliges un valor númerico entre el mínimo y el máximo disponibles
public class NumberSetting extends Setting { public class NumberSetting extends Setting<Double> {
private double value;
private double defaultValue;
private boolean locked;
private final double min; private final double min;
private final double max; private final double max;
private final double increment; // el "increment" es el salto que hay entre valores disponibles private final double increment; // el "increment" es el salto que hay entre valores disponibles
private Consumer<Double> updateListener; private boolean locked;
public NumberSetting(String name, String description, double defaultValue, double min, double max, double increment) { public NumberSetting(String name, String description, double defaultValue, double min, double max, double increment) {
super(name, description); super(name, description, defaultValue);
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
this.value = defaultValue; this.value = defaultValue;
this.min = min; this.min = min;
@@ -41,40 +37,31 @@ public class NumberSetting extends Setting {
} }
public double getValue() {
return value;
}
public float getFloatValue() { public float getFloatValue() {
return (float) value; // en "float" por conveniencia return value.floatValue(); // en "float" por conveniencia
} }
public int getIntValue() { public int getIntValue() {
return (int) value; // en "int" (número entero) por conveniencia return value.intValue(); // en "int" (número entero) por conveniencia
} }
public long getLongValue() { public long getLongValue() {
return (long) value; // lo mismo para "longs" return value.longValue(); // lo mismo para "longs"
}
public long getShortValue() {
return value.shortValue();
}
public long getByteValue() {
return value.byteValue();
} }
public void setValue(double value) { public void setValue(double value) {
if (this.value == value || this.locked) return; if (this.value == value || this.locked) return;
double clamped = clamp(value, min, max); double clamped = clamp(value, min, max);
this.value = Math.round(clamped / increment) * increment; value = Math.round(clamped / increment) * increment;
fireUpdateEvent(); super.setValue(value);
if (updateListener != null) updateListener.accept(this.value);
}
public double getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(double value) {
defaultValue = value;
}
public void reset() {
setValue(defaultValue);
} }
public double getMin() { public double getMin() {
@@ -96,9 +83,4 @@ public class NumberSetting extends Setting {
public void setLocked(boolean locked) { public void setLocked(boolean locked) {
this.locked = locked; this.locked = locked;
} }
public void onUpdate(Consumer<Double> listener) {
this.updateListener = listener;
if (updateListener != null) updateListener.accept(value);
}
} }
@@ -6,38 +6,24 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
public class OptionSetting<T> extends Setting { public class OptionSetting<T> extends Setting<T> {
private final List<T> options; private final List<T> options;
private Map<T, String> displayNames; private Map<T, String> displayNames;
private T option;
private final T defaultOption;
private Consumer<T> updateListener;
public OptionSetting(String name, String description, List<T> options, T defaultOption) { public OptionSetting(String name, String description, List<T> options, T defaultOption) {
super(name, description); super(name, description, defaultOption);
this.options = options; this.options = options;
this.option = defaultOption;
this.defaultOption = defaultOption;
} }
public OptionSetting(String name, String description, List<T> options, T defaultOption, Map<T, String> displayNames) { public OptionSetting(String name, String description, List<T> options, T defaultOption, Map<T, String> displayNames) {
super(name, description); super(name, description, defaultOption);
this.options = options; this.options = options;
this.option = defaultOption;
this.defaultOption = defaultOption;
this.displayNames = displayNames; this.displayNames = displayNames;
} }
public T getValue() {
return option;
}
public void setValue(T option) { public void setValue(T option) {
if (options.contains(option)) this.option = option; if (options.contains(option)) super.setValue(option);
fireUpdateEvent();
if (updateListener != null) updateListener.accept(option);
} }
public void setValueByName(String name) { public void setValueByName(String name) {
@@ -62,10 +48,6 @@ public class OptionSetting<T> extends Setting {
return options.get(index); return options.get(index);
} }
public T getDefaultValue() {
return defaultOption;
}
public int getSize() { public int getSize() {
return options.size(); return options.size();
} }
@@ -73,7 +55,7 @@ public class OptionSetting<T> extends Setting {
public int getIndex() { public int getIndex() {
int index = 0; int index = 0;
for (T option : options) { for (T option : options) {
if (this.option == option) break; if (this.value == option) break;
index += 1; index += 1;
} }
return index; return index;
@@ -96,15 +78,6 @@ public class OptionSetting<T> extends Setting {
return index; return index;
} }
public void reset() {
setValue(defaultOption);
}
public void onUpdate(Consumer<T> listener) {
this.updateListener = listener;
if (updateListener != null) updateListener.accept(option);
}
public Map<T, String> getDisplayNames() { public Map<T, String> getDisplayNames() {
return displayNames; return displayNames;
} }
@@ -115,6 +88,6 @@ public class OptionSetting<T> extends Setting {
} }
public String getDisplayName() { public String getDisplayName() {
return getDisplayName(option); return getDisplayName(value);
} }
} }
@@ -4,50 +4,24 @@ import me.retucio.sputnik.module.setting.Setting;
import java.util.function.Consumer; import java.util.function.Consumer;
public class StringSetting extends Setting { public class StringSetting extends Setting<String> {
private String value;
private String defaultValue;
private final int maxLength; private final int maxLength;
private Consumer<String> updateListener;
public StringSetting(String name, String description, String defaultValue, int maxLength) { public StringSetting(String name, String description, String defaultValue, int maxLength) {
super(name, description); super(name, description, defaultValue);
this.value = defaultValue; this.value = defaultValue;
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
this.maxLength = maxLength; this.maxLength = maxLength;
} }
public String getValue() {
return value;
}
public void setValue(String value) { public void setValue(String value) {
if (this.value.equals(value)) return; if (this.value.equals(value)) return;
this.value = value.length() > maxLength ? value.substring(0, maxLength) : value; value = value.length() > maxLength ? value.substring(0, maxLength) : value;
fireUpdateEvent(); super.setValue(value);
if (updateListener != null) updateListener.accept(this.value);
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public void reset() {
setValue(defaultValue);
} }
public int getMaxLength() { public int getMaxLength() {
return maxLength; return maxLength;
} }
public void onUpdate(Consumer<String> listener) {
this.updateListener = listener;
if (updateListener != null) updateListener.accept(value);
}
} }
@@ -157,7 +157,7 @@ public class HudEditorScreen extends Screen {
@Override @Override
protected void applyBlur(DrawContext ctx) { protected void applyBlur(DrawContext ctx) {
if (ClientSettingsFrame.guiSettings.blur.isEnabled()) { if (ClientSettingsFrame.guiSettings.blur.getValue()) {
super.applyBlur(ctx); super.applyBlur(ctx);
} }
} }
@@ -75,7 +75,7 @@ public class HudRenderer {
public static Color getColor(HUD hud) { public static Color getColor(HUD hud) {
return hud.color.getColor(); return hud.color.getValue();
} }
public static void drawSnappedText(DrawContext ctx, String text, int x, int y, int color, boolean shadow) { public static void drawSnappedText(DrawContext ctx, String text, int x, int y, int color, boolean shadow) {
@@ -97,8 +97,8 @@ public class HudRenderer {
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class); HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
if (!hud.isEnabled()) return; if (!hud.isEnabled()) return;
if (mc.debugHudEntryList.isF3Enabled() && !hud.showOnF3.isEnabled()) return; if (mc.debugHudEntryList.isF3Enabled() && !hud.showOnF3.getValue()) return;
if (mc.currentScreen instanceof ChatScreen && !hud.showOnChat.isEnabled()) return; if (mc.currentScreen instanceof ChatScreen && !hud.showOnChat.getValue()) return;
init(); init();
@@ -17,8 +17,8 @@ public abstract class TextHudElement extends HudElement {
@Override @Override
public void renderInGame(DrawContext ctx, float delta, HUD hud) { public void renderInGame(DrawContext ctx, float delta, HUD hud) {
String text = getText(delta, hud); String text = getText(delta, hud);
int color = hud != null ? hud.color.getColor().getRGB() : -1; int color = hud != null ? hud.color.getValue().getRGB() : -1;
boolean shadow = hud != null && hud.shadow.isEnabled(); boolean shadow = hud != null && hud.shadow.getValue();
HudRenderer.drawSnappedText(ctx, text, x, y, color, shadow); HudRenderer.drawSnappedText(ctx, text, x, y, color, shadow);
} }
@@ -30,8 +30,8 @@ public abstract class TextHudElement extends HudElement {
drawEditorBackground(ctx); drawEditorBackground(ctx);
int color = hud != null ? hud.color.getColor().getRGB() : -1; int color = hud != null ? hud.color.getValue().getRGB() : -1;
boolean shadow = hud != null && hud.shadow.isEnabled(); boolean shadow = hud != null && hud.shadow.getValue();
HudRenderer.drawSnappedText(ctx, previewText, x, y, color, shadow); HudRenderer.drawSnappedText(ctx, previewText, x, y, color, shadow);
} }
@@ -16,7 +16,7 @@ public class RotationElement extends TextHudElement {
@Override @Override
public String getText(float delta, HUD hud) { public String getText(float delta, HUD hud) {
if (mc.player == null) return getPreviewText(); if (mc.player == null) return getPreviewText();
return String.format("%.2f", mc.player.getYaw()) + "º " + String.format("%.2f", mc.player.getPitch()) + "º (" + getDirection() + ")"; return String.format("%.2f", mc.player.getYaw() % 360) + "º " + String.format("%.2f", mc.player.getPitch()) + "º (" + getDirection() + ")";
} }
@Override @Override
@@ -6,6 +6,7 @@ import me.retucio.sputnik.event.events.KeyEvent;
import me.retucio.sputnik.event.events.MouseClickEvent; import me.retucio.sputnik.event.events.MouseClickEvent;
import me.retucio.sputnik.event.events.MouseScrollEvent; import me.retucio.sputnik.event.events.MouseScrollEvent;
import me.retucio.sputnik.event.events.sputnik.SettingsFrameEvent; import me.retucio.sputnik.event.events.sputnik.SettingsFrameEvent;
import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module; import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.Setting; import me.retucio.sputnik.module.setting.Setting;
import me.retucio.sputnik.module.setting.settings.ColorSetting; import me.retucio.sputnik.module.setting.settings.ColorSetting;
@@ -48,12 +49,14 @@ public class ClickGUI extends Screen {
private boolean anyFocused; private boolean anyFocused;
private Widget selected = null; private Widget selected = null;
private Category categoryFilter = Category.ALL;
private final ModuleFrame modulesFrame = new ModuleFrame(20, 30, 100, 20); private final ModuleFrame modulesFrame = new ModuleFrame(20, 30, 100, 20);
private final List<SettingsFrame> settingsFrames = new ArrayList<>(); private final List<SettingsFrame> settingsFrames = new ArrayList<>();
private final ClientSettingsFrame guiSettingsFrame = new ClientSettingsFrame(200, 30, 100, 20); private final ClientSettingsFrame guiSettingsFrame = new ClientSettingsFrame(200, 30, 100, 20);
private final ScrollBarWidget scrollBar = new ScrollBarWidget(); private final ScrollBarWidget scrollBar = new ScrollBarWidget();
private final SearchBarWidget searchBar = new SearchBarWidget(340, 16, 300, 20); private final SearchBarWidget searchBar = new SearchBarWidget(340, 16, 320, 20);
private final List<Widget> miscWidgets = Arrays.asList(scrollBar, searchBar); private final List<Widget> miscWidgets = Arrays.asList(scrollBar, searchBar);
public ClickGUI() { public ClickGUI() {
@@ -125,12 +128,13 @@ public class ClickGUI extends Screen {
return bottom + 20; // padding return bottom + 20; // padding
} }
@Override
public boolean mouseClicked(Click click, boolean doubled) { public boolean mouseClicked(Click click, boolean doubled) {
miscWidgets.forEach(w -> w.mouseClicked( miscWidgets.forEach(w -> w.mouseClicked(
(int) click.x(), (int) click.x(),
(int) click.y(), (int) click.y(),
click.button())); click.button()
));
// detectar clics sobre los marcos // detectar clics sobre los marcos
modulesFrame.mouseClicked((int) click.x(), (int) click.y(), click.button()); modulesFrame.mouseClicked((int) click.x(), (int) click.y(), click.button());
@@ -195,16 +199,21 @@ public class ClickGUI extends Screen {
} }
public void filterSearchResults() { public void filterSearchResults() {
if (!guiSettings.searchBar.isEnabled()) return; if (!guiSettings.searchBar.getValue()) return;
String searchInput = searchBar.getSearchInput().trim(); String searchInput = searchBar.getSearchInput().trim();
if (!guiSettings.matchCase.isEnabled()) searchInput = searchInput.toLowerCase(); if (!guiSettings.matchCase.getValue()) searchInput = searchInput.toLowerCase();
for (Button b : modulesFrame.getButtons()) { for (Button b : modulesFrame.getButtons()) {
if (!(b instanceof ModuleButton mb)) return; if (!(b instanceof ModuleButton mb)) return;
Module module = mb.getModule(); Module module = mb.getModule();
if (searchInput.isEmpty()) { if (getCategoryFilter() != Category.ALL) {
module.setSearchMatch(getCategoryFilter() == module.getCategory());
} else {
module.setSearchMatch(true); module.setSearchMatch(true);
}
if (searchInput.isEmpty()) {
continue; continue;
} }
@@ -212,7 +221,7 @@ public class ClickGUI extends Screen {
String description = MiscUtil.removeAccentMarks(module.getDescription()); String description = MiscUtil.removeAccentMarks(module.getDescription());
String category = MiscUtil.removeAccentMarks(module.getCategory().toString()); String category = MiscUtil.removeAccentMarks(module.getCategory().toString());
if (!guiSettings.matchCase.isEnabled()) { if (!guiSettings.matchCase.getValue()) {
name = name.toLowerCase(); name = name.toLowerCase();
description = description.toLowerCase(); description = description.toLowerCase();
category = category.toLowerCase(); category = category.toLowerCase();
@@ -227,7 +236,7 @@ public class ClickGUI extends Screen {
for (SettingsFrame sf : settingsFrames) { for (SettingsFrame sf : settingsFrames) {
for (Button b : sf.getButtons()) { for (Button b : sf.getButtons()) {
if (!(b instanceof SettingButton<?> sb)) return; if (!(b instanceof SettingButton<?> sb)) return;
Setting setting = sb.getSetting(); Setting<?> setting = sb.getSetting();
if (searchInput.isEmpty()) { if (searchInput.isEmpty()) {
setting.setSearchMatch(true); setting.setSearchMatch(true);
@@ -238,7 +247,7 @@ public class ClickGUI extends Screen {
String description = MiscUtil.removeAccentMarks(setting.getDescription()); String description = MiscUtil.removeAccentMarks(setting.getDescription());
String sgName = MiscUtil.removeAccentMarks(setting.getSg().getName()); String sgName = MiscUtil.removeAccentMarks(setting.getSg().getName());
if (!guiSettings.matchCase.isEnabled()) { if (!guiSettings.matchCase.getValue()) {
name = name.toLowerCase(); name = name.toLowerCase();
description = description.toLowerCase(); description = description.toLowerCase();
sgName = sgName.toLowerCase(); sgName = sgName.toLowerCase();
@@ -333,6 +342,13 @@ public class ClickGUI extends Screen {
lb.refreshDummy(); lb.refreshDummy();
} }
public void setCategoryFilter(Category category) {
this.categoryFilter = category;
}
public Category getCategoryFilter() {
return categoryFilter;
}
// métodos del súper // métodos del súper
@@ -360,7 +376,7 @@ public class ClickGUI extends Screen {
@Override @Override
protected void applyBlur(DrawContext ctx) { protected void applyBlur(DrawContext ctx) {
if (guiSettings.blur.isEnabled()) super.applyBlur(ctx); if (guiSettings.blur.getValue()) super.applyBlur(ctx);
} }
@@ -120,7 +120,7 @@ public class PreviewScreen extends Screen {
@Override @Override
public void applyBlur(DrawContext ctx) { public void applyBlur(DrawContext ctx) {
if (ClientSettingsFrame.guiSettings.blur.isEnabled()) super.applyBlur(ctx); if (ClientSettingsFrame.guiSettings.blur.getValue()) super.applyBlur(ctx);
} }
@Override @Override
@@ -23,4 +23,8 @@ public abstract class Button extends Widget {
public void setOffset(int offset) { public void setOffset(int offset) {
this.offset = offset; this.offset = offset;
} }
public Frame<?> getParent() {
return parent;
}
} }
@@ -1,13 +1,14 @@
package me.retucio.sputnik.ui.widgets.buttons; package me.retucio.sputnik.ui.widgets.buttons;
import me.retucio.sputnik.module.setting.Setting; import me.retucio.sputnik.module.setting.Setting;
import me.retucio.sputnik.ui.widgets.Frame;
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame; import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
import me.retucio.sputnik.ui.widgets.Button; import me.retucio.sputnik.ui.widgets.Button;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text; import net.minecraft.text.Text;
// clase base para los botones de los ajustes // clase base para los botones de los ajustes
public abstract class SettingButton<S extends Setting> extends Button { public abstract class SettingButton<S extends Setting<?>> extends Button {
protected S setting; protected S setting;
@@ -57,12 +57,12 @@ public class BindButton extends SettingButton<KeySetting> {
if (!listening || action != GLFW.GLFW_PRESS) return; if (!listening || action != GLFW.GLFW_PRESS) return;
if (key == GLFW.GLFW_KEY_ESCAPE) { if (key == GLFW.GLFW_KEY_ESCAPE) {
setting.setKey(GLFW.GLFW_KEY_UNKNOWN); setting.setValue(GLFW.GLFW_KEY_UNKNOWN);
} else { } else {
for (KeyBinding bind : mc.options.allKeys) { for (KeyBinding bind : mc.options.allKeys) {
// no permitir usar la misma tecla para varias acciones, si el ajuste para esto está activado // no permitir usar la misma tecla para varias acciones, si el ajuste para esto está activado
boolean keyAlreadyBound = bind.matchesKey(new KeyInput(key, 0, 0)); boolean keyAlreadyBound = bind.matchesKey(new KeyInput(key, 0, 0));
boolean allowMultiple = ClientSettingsFrame.guiSettings.multipleKeybinds.isEnabled(); boolean allowMultiple = ClientSettingsFrame.guiSettings.multipleKeybinds.getValue();
if (keyAlreadyBound && !allowMultiple) { if (keyAlreadyBound && !allowMultiple) {
ChatUtil.warn("esa tecla ya está cogida por " ChatUtil.warn("esa tecla ya está cogida por "
@@ -71,7 +71,7 @@ public class BindButton extends SettingButton<KeySetting> {
return; return;
} }
} }
setting.setKey(key); setting.setValue(key);
} }
listening = false; listening = false;
@@ -56,13 +56,7 @@ public class ChooseButton<T> extends SettingButton<OptionSetting<T>> {
if (isHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) { if (isHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
// click izquierdo / derecho: abrir marco // click izquierdo / derecho: abrir marco
if (button <= 1 && !mc.isShiftPressed()) { if (button <= 1 && !mc.isShiftPressed()) {
if (ClickGUI.INSTANCE.isSettingsFrameOpen(dummy)) { openFrame();
ClickGUI.INSTANCE.closeSettingsFrame(dummy);
return;
}
rebuildDummy();
ClickGUI.INSTANCE.openListSettingsFrame(dummy, parent.getX() + 40, parent.getY() + 40);
// shift + clic derecho: restablecer valores // shift + clic derecho: restablecer valores
} else if (button == 1 && KeyUtil.isShiftDown()) { } else if (button == 1 && KeyUtil.isShiftDown()) {
setting.reset(); setting.reset();
@@ -72,7 +66,7 @@ public class ChooseButton<T> extends SettingButton<OptionSetting<T>> {
} }
private void rebuildDummy() { private void rebuildDummy() {
dummy.getSettings().clear(); dummy.getSgGeneral().getSettings().clear();
optionButtons.clear(); optionButtons.clear();
setting.getOptions().stream() setting.getOptions().stream()
@@ -90,16 +84,16 @@ public class ChooseButton<T> extends SettingButton<OptionSetting<T>> {
// deseleccionar el resto de opciones // deseleccionar el resto de opciones
for (Map.Entry<T, BooleanSetting> entry : optionButtons.entrySet()) { for (Map.Entry<T, BooleanSetting> entry : optionButtons.entrySet()) {
if (!entry.getKey().equals(option)) if (!entry.getKey().equals(option))
entry.getValue().setEnabled(false); entry.getValue().setValue(false);
} }
setting.setValue(option); setting.setValue(option);
} else { } else {
if (setting.is(option)) if (setting.is(option))
b.setEnabled(true); b.setValue(true);
} }
}); });
dummy.getSg("general").add(b); dummy.getSgGeneral().add(b);
optionButtons.put(option, b); optionButtons.put(option, b);
}); });
} }
@@ -108,9 +102,24 @@ public class ChooseButton<T> extends SettingButton<OptionSetting<T>> {
T currentValue = setting.getValue(); T currentValue = setting.getValue();
for (Map.Entry<T, BooleanSetting> entry : optionButtons.entrySet()) { for (Map.Entry<T, BooleanSetting> entry : optionButtons.entrySet()) {
boolean shouldBeEnabled = entry.getKey().equals(currentValue); boolean shouldBeEnabled = entry.getKey().equals(currentValue);
if (entry.getValue().isEnabled() != shouldBeEnabled) { if (entry.getValue().getValue() != shouldBeEnabled) {
entry.getValue().setEnabled(shouldBeEnabled); entry.getValue().setValue(shouldBeEnabled);
} }
} }
} }
public void openFrame() {
if (ClickGUI.INSTANCE.isSettingsFrameOpen(dummy)) {
ClickGUI.INSTANCE.closeSettingsFrame(dummy);
return;
}
rebuildDummy();
ClickGUI.INSTANCE.openListSettingsFrame(
dummy,
parent.getX() + 40,
parent.getY() + 40
);
}
} }
@@ -37,7 +37,7 @@ public class ColorButton extends SettingButton<ColorSetting> {
int previewY = y + 3; int previewY = y + 3;
DrawUtil.drawBorder(ctx, previewX - 1, previewY - 1, previewSize + 2, previewSize + 2, setting.isRainbow() ? Colors.mainColor.getRGB() : -1); DrawUtil.drawBorder(ctx, previewX - 1, previewY - 1, previewSize + 2, previewSize + 2, setting.isRainbow() ? Colors.mainColor.getRGB() : -1);
ctx.fill(previewX, previewY, previewX + previewSize, previewY + previewSize, setting.getColor().getRGB()); ctx.fill(previewX, previewY, previewX + previewSize, previewY + previewSize, setting.getValue().getRGB());
// texto // texto
String label = setting.getName(); String label = setting.getName();
@@ -7,7 +7,6 @@ import me.retucio.sputnik.module.setting.settings.ListSetting;
import me.retucio.sputnik.ui.widgets.buttons.SettingButton; import me.retucio.sputnik.ui.widgets.buttons.SettingButton;
import me.retucio.sputnik.ui.screen.ClickGUI; import me.retucio.sputnik.ui.screen.ClickGUI;
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame; import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
import me.retucio.sputnik.util.ChatUtil;
import me.retucio.sputnik.util.Colors; import me.retucio.sputnik.util.Colors;
import me.retucio.sputnik.util.KeyUtil; import me.retucio.sputnik.util.KeyUtil;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
@@ -85,13 +84,14 @@ public class ListButton<T> extends SettingButton<ListSetting<T>> {
private void rebuildDummy() { private void rebuildDummy() {
dummy.getSettings().clear(); dummy.getSettings().clear();
dummy.getSgGeneral().getSettings().clear();
optionButtons.clear(); optionButtons.clear();
setting.getOptions().stream() setting.getOptions().stream()
.sorted(Comparator.comparing(setting::getDisplayName, String.CASE_INSENSITIVE_ORDER)) .sorted(Comparator.comparing(setting::getDisplayName, String.CASE_INSENSITIVE_ORDER))
.forEach(option -> { .forEach(option -> {
String displayName = setting.getDisplayName(option); String displayName = setting.getDisplayName(option);
BooleanSetting b = dummy.getSg("general").add(new BooleanSetting( BooleanSetting b = dummy.getSgGeneral().add(new BooleanSetting(
displayName, displayName,
"incluir " + displayName, "incluir " + displayName,
setting.isEnabled(option) setting.isEnabled(option)
@@ -100,10 +100,9 @@ public class ListButton<T> extends SettingButton<ListSetting<T>> {
optionButtons.put(option, b); optionButtons.put(option, b);
}); });
} }
public void refreshDummy() { public void refreshDummy() {
optionButtons.forEach((option, boolSetting) -> optionButtons.forEach((option, boolSetting) ->
boolSetting.setEnabled(setting.isEnabled(option))); boolSetting.setValue(setting.isEnabled(option)));
} }
private int countEnabled() { private int countEnabled() {
@@ -56,6 +56,12 @@ public class TextButton extends SettingButton<StringSetting> {
public void onKey(int key, int action) { public void onKey(int key, int action) {
if (!typing || action == GLFW.GLFW_RELEASE) return; if (!typing || action == GLFW.GLFW_RELEASE) return;
// pegar con ctrl + v
if (key == GLFW.GLFW_KEY_V && KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
buffer.append(mc.keyboard.getClipboard());
return;
}
switch (key) { // casos para teclas especiales como enter, escape o borrar switch (key) { // casos para teclas especiales como enter, escape o borrar
case GLFW.GLFW_KEY_ENTER -> { case GLFW.GLFW_KEY_ENTER -> {
setting.setValue(buffer.toString()); setting.setValue(buffer.toString());
@@ -24,7 +24,7 @@ public class ToggleButton extends SettingButton<BooleanSetting> {
@Override @Override
public void render(DrawContext ctx, int mouseX, int mouseY, float delta) { public void render(DrawContext ctx, int mouseX, int mouseY, float delta) {
// fondo // fondo
Color color = setting.isEnabled() Color color = setting.getValue()
? Colors.enabledToggleButtonColor ? Colors.enabledToggleButtonColor
: Colors.disabledToggleButtonColor; : Colors.disabledToggleButtonColor;
@@ -19,7 +19,7 @@ import java.util.List;
// marco para los botones de los ajustes de cada módulo // marco para los botones de los ajustes de cada módulo
public class SettingsFrame extends Frame<SettingButton<? extends Setting>> { public class SettingsFrame extends Frame<SettingButton<? extends Setting<?>>> {
private Module module; private Module module;
protected List<SettingGroup> settingGroups; protected List<SettingGroup> settingGroups;
@@ -295,7 +295,7 @@ public class SettingsFrame extends Frame<SettingButton<? extends Setting>> {
int offset = h; int offset = h;
for (SettingGroup group : settingGroups) { for (SettingGroup group : settingGroups) {
for (Setting setting : group) { for (Setting<?> setting : group) {
SettingButton<?> button = createSettingButton(setting, offset); SettingButton<?> button = createSettingButton(setting, offset);
if (button != null) { if (button != null) {
addButton(button); addButton(button);
@@ -305,7 +305,7 @@ public class SettingsFrame extends Frame<SettingButton<? extends Setting>> {
} }
} }
private SettingButton<?> createSettingButton(Setting setting, int offset) { private SettingButton<?> createSettingButton(Setting<?> setting, int offset) {
return switch (setting) { return switch (setting) {
case BooleanSetting b -> new ToggleButton(b, this, offset); case BooleanSetting b -> new ToggleButton(b, this, offset);
case NumberSetting n -> new SliderButton(n, this, offset); case NumberSetting n -> new SliderButton(n, this, offset);
@@ -320,7 +320,7 @@ public class SettingsFrame extends Frame<SettingButton<? extends Setting>> {
} }
protected boolean hasVisibleSettingsInGroup(SettingGroup group) { protected boolean hasVisibleSettingsInGroup(SettingGroup group) {
for (Setting setting : group) { for (Setting<?> setting : group) {
if (setting.isVisible()) { if (setting.isVisible()) {
return true; return true;
} }
@@ -331,7 +331,7 @@ public class SettingsFrame extends Frame<SettingButton<? extends Setting>> {
private List<SettingButton<?>> getButtonsForGroup(SettingGroup group) { private List<SettingButton<?>> getButtonsForGroup(SettingGroup group) {
List<SettingButton<?>> groupButtons = new ArrayList<>(); List<SettingButton<?>> groupButtons = new ArrayList<>();
for (SettingButton<?> button : buttons) { for (SettingButton<?> button : buttons) {
for (Setting setting : group) { for (Setting<?> setting : group) {
if (setting == button.getSetting()) { if (setting == button.getSetting()) {
groupButtons.add(button); groupButtons.add(button);
break; break;
@@ -45,7 +45,7 @@ public class ColorPickerFrame extends SettingsFrame {
super(module, x, y, w, h); super(module, x, y, w, h);
this.colorSetting = colorSetting; this.colorSetting = colorSetting;
this.currentColor = colorSetting.getColor(); this.currentColor = colorSetting.getValue();
dummyModule = new Module("selector de colores", "elige colores", Category.CLIENT) { dummyModule = new Module("selector de colores", "elige colores", Category.CLIENT) {
@Override public void onEnable() {} @Override public void onEnable() {}
@@ -58,27 +58,26 @@ public class ColorPickerFrame extends SettingsFrame {
// ajustes de color // ajustes de color
redSetting = new NumberSetting("rojo", "cantidad de rojo", colorSetting.getR(), 0, 255, 1); redSetting = new NumberSetting("rojo", "cantidad de rojo", colorSetting.getR(), 0, 255, 1);
redSetting.setDefaultValue(colorSetting.getDefaultR()); redSetting.setDefaultValue((double) colorSetting.getDefaultR());
greenSetting = new NumberSetting("verde", "cantidad de verde", colorSetting.getG(), 0, 255, 1); greenSetting = new NumberSetting("verde", "cantidad de verde", colorSetting.getG(), 0, 255, 1);
greenSetting.setDefaultValue(colorSetting.getDefaultG()); greenSetting.setDefaultValue((double) colorSetting.getDefaultG());
blueSetting = new NumberSetting("azul", "cantidad de azul", colorSetting.getB(), 0, 255, 1); blueSetting = new NumberSetting("azul", "cantidad de azul", colorSetting.getB(), 0, 255, 1);
blueSetting.setDefaultValue(colorSetting.getDefaultB()); blueSetting.setDefaultValue((double) colorSetting.getDefaultB());
// ajustes de arcoíris // ajustes de arcoíris
rainbowSetting = new BooleanSetting("arcoíris", "gay.", colorSetting.isRainbow()); rainbowSetting = new BooleanSetting("arcoíris", "gay.", colorSetting.isRainbow());
rainbowSetting.setDefaultValue(colorSetting.getDefaultRainbow()); rainbowSetting.setDefaultValue(colorSetting.getDefaultRainbow());
rainbowSpeedSetting = new NumberSetting("velocidad del arcoíris", "velocidad de gaming", colorSetting.getRainbowSpeed(), 1, 10000, 2); rainbowSpeedSetting = new NumberSetting("velocidad del arcoíris", "velocidad de gaming", colorSetting.getRainbowSpeed(), 1, 10000, 2);
rainbowSpeedSetting.setDefaultValue(colorSetting.getDefaultRainbowSpeed()); rainbowSpeedSetting.setDefaultValue((double) colorSetting.getDefaultRainbowSpeed());
saturationSetting = new NumberSetting("saturación", "intensidad de la homosexualidad", colorSetting.getSaturation(), 0, 1, 0.01f); saturationSetting = new NumberSetting("saturación", "intensidad de la homosexualidad", colorSetting.getSaturation(), 0, 1, 0.01f);
saturationSetting.setDefaultValue(colorSetting.getDefaultSaturation()); saturationSetting.setDefaultValue((double) colorSetting.getDefaultSaturation());
brightnessSetting = new NumberSetting("brillo", "brillo de la homosexualidad", colorSetting.getBrightness(), 0, 1, 0.01f); brightnessSetting = new NumberSetting("brillo", "brillo de la homosexualidad", colorSetting.getBrightness(), 0, 1, 0.01f);
brightnessSetting.setDefaultValue(colorSetting.getDefaultBrightness()); brightnessSetting.setDefaultValue((double) colorSetting.getDefaultBrightness());
// añadir ajustes y tal // añadir ajustes y tal
dummyModule.getSg("general").addAll(redSetting, greenSetting, blueSetting, rainbowSpeedSetting, saturationSetting, brightnessSetting, rainbowSetting); dummyModule.getSgGeneral().addAll(redSetting, greenSetting, blueSetting, rainbowSpeedSetting, saturationSetting, brightnessSetting, rainbowSetting);
for (Setting setting : dummyModule.getSettings()) { for (Setting<?> setting : dummyModule.getSettings()) {
if (setting instanceof NumberSetting n) n.onUpdate(v -> updateColorFromSettings()); setting.onUpdate(v -> updateColorFromSettings());
if (setting instanceof BooleanSetting b) b.onUpdate(v -> updateColorFromSettings());
rainbowSetting.onUpdate(v -> { rainbowSetting.onUpdate(v -> {
updateColorFromSettings(); updateColorFromSettings();
redSetting.setVisible(!v); redSetting.setVisible(!v);
@@ -123,11 +122,11 @@ public class ColorPickerFrame extends SettingsFrame {
updateWidth(); updateWidth();
// al parecer este era el problema :/ // al parecer este era el problema :/
for (Setting setting : dummyModule.getSettings()) for (Setting<?> setting : dummyModule.getSettings())
if (setting instanceof NumberSetting ns) ns.setLocked( if (setting instanceof NumberSetting ns) ns.setLocked(
pickingAlpha || pickingHue || pickingSaturationBrightness); pickingAlpha || pickingHue || pickingSaturationBrightness);
currentColor = colorSetting.getColor(); currentColor = colorSetting.getValue();
int padding = 5; int padding = 5;
@@ -461,7 +460,7 @@ public class ColorPickerFrame extends SettingsFrame {
green = greenSetting.getIntValue(); green = greenSetting.getIntValue();
blue = blueSetting.getIntValue(); blue = blueSetting.getIntValue();
alpha = colorSetting.getA(); alpha = colorSetting.getA();
rainbow = rainbowSetting.isEnabled(); rainbow = rainbowSetting.getValue();
rainbowSpeed = rainbowSpeedSetting.getIntValue(); rainbowSpeed = rainbowSpeedSetting.getIntValue();
saturation = saturationSetting.getFloatValue(); saturation = saturationSetting.getFloatValue();
brightness = brightnessSetting.getFloatValue(); brightness = brightnessSetting.getFloatValue();
@@ -476,13 +475,13 @@ public class ColorPickerFrame extends SettingsFrame {
private void updateSettingsFromColor() { private void updateSettingsFromColor() {
if (colorSetting == null) return; if (colorSetting == null) return;
for (Setting setting : dummyModule.getSettings()) { for (Setting<?> setting : dummyModule.getSettings()) {
switch (setting.getName()) { switch (setting.getName()) {
case "rojo" -> ((NumberSetting) setting).setValue(colorSetting.getR()); case "rojo" -> ((NumberSetting) setting).setValue(colorSetting.getR());
case "verde" -> ((NumberSetting) setting).setValue(colorSetting.getG()); case "verde" -> ((NumberSetting) setting).setValue(colorSetting.getG());
case "azul" -> ((NumberSetting) setting).setValue(colorSetting.getB()); case "azul" -> ((NumberSetting) setting).setValue(colorSetting.getB());
case "opacidad" -> ((NumberSetting) setting).setValue(colorSetting.getA()); case "opacidad" -> ((NumberSetting) setting).setValue(colorSetting.getA());
case "arcoíris" -> ((BooleanSetting) setting).setEnabled(colorSetting.isRainbow()); case "arcoíris" -> ((BooleanSetting) setting).setValue(colorSetting.isRainbow());
case "velocidad del arcoíris" -> ((NumberSetting) setting).setValue(colorSetting.getRainbowSpeed()); case "velocidad del arcoíris" -> ((NumberSetting) setting).setValue(colorSetting.getRainbowSpeed());
case "saturación" -> ((NumberSetting) setting).setValue(colorSetting.getSaturation()); case "saturación" -> ((NumberSetting) setting).setValue(colorSetting.getSaturation());
case "brillo" -> ((NumberSetting) setting).setValue(colorSetting.getBrightness()); case "brillo" -> ((NumberSetting) setting).setValue(colorSetting.getBrightness());
@@ -23,7 +23,7 @@ public class ScrollBarWidget extends Widget {
@Override @Override
public void render(DrawContext ctx, int mouseX, int mouseY, float delta) { public void render(DrawContext ctx, int mouseX, int mouseY, float delta) {
if (contentHeight <= windowHeight || !ClientSettingsFrame.guiSettings.scrollBar.isEnabled()) return; if (contentHeight <= windowHeight || !ClientSettingsFrame.guiSettings.scrollBar.getValue()) return;
int trackX1 = mc.getWindow().getScaledWidth() - 10; int trackX1 = mc.getWindow().getScaledWidth() - 10;
int trackX2 = trackX1 + 10; int trackX2 = trackX1 + 10;
@@ -44,7 +44,7 @@ public class ScrollBarWidget extends Widget {
@Override @Override
public void mouseClicked(int mouseX, int mouseY, int button) { public void mouseClicked(int mouseX, int mouseY, int button) {
if (button != 0 || !ClientSettingsFrame.guiSettings.scrollBar.isEnabled()) return; if (button != 0 || !ClientSettingsFrame.guiSettings.scrollBar.getValue()) return;
if (isThumbHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) { if (isThumbHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
dragging = true; dragging = true;
dragY = mouseY; dragY = mouseY;
@@ -60,7 +60,7 @@ public class ScrollBarWidget extends Widget {
@Override @Override
public void mouseDragged(int mouseX, int mouseY) { public void mouseDragged(int mouseX, int mouseY) {
if (!dragging || !ClientSettingsFrame.guiSettings.scrollBar.isEnabled()) return; if (!dragging || !ClientSettingsFrame.guiSettings.scrollBar.getValue()) return;
int thumbHeight = getThumbHeight(); int thumbHeight = getThumbHeight();
int trackHeight = windowHeight - thumbHeight; int trackHeight = windowHeight - thumbHeight;
@@ -1,17 +1,25 @@
package me.retucio.sputnik.ui.widgets.misc; package me.retucio.sputnik.ui.widgets.misc;
import me.retucio.sputnik.config.ConfigManager; import me.retucio.sputnik.config.ConfigManager;
import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.settings.OptionSetting;
import me.retucio.sputnik.ui.screen.ClickGUI; import me.retucio.sputnik.ui.screen.ClickGUI;
import me.retucio.sputnik.ui.widgets.buttons.settings.ChooseButton;
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame; import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
import me.retucio.sputnik.ui.widgets.Widget; import me.retucio.sputnik.ui.widgets.Widget;
import me.retucio.sputnik.util.Colors; import me.retucio.sputnik.util.Colors;
import me.retucio.sputnik.util.KeyUtil; import me.retucio.sputnik.util.KeyUtil;
import me.retucio.sputnik.util.render.Textures;
import net.minecraft.client.gl.RenderPipelines;
import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import java.awt.Color; import java.awt.Color;
import java.util.List;
public class SearchBarWidget extends Widget { public class SearchBarWidget extends Widget {
@@ -23,13 +31,32 @@ public class SearchBarWidget extends Widget {
private boolean focused; private boolean focused;
private final StringBuilder buffer = new StringBuilder(); private final StringBuilder buffer = new StringBuilder();
// simular un módulo
private final Module dummy = new Module("", "", Category.ALL);
private final OptionSetting<Category> categories = dummy.getSgGeneral().add(
new OptionSetting<>(
"filtrar",
"filtrar módulos por categoría",
List.of(Category.values()),
Category.ALL
)
);
private final ChooseButton<Category> dummyButton = new ChooseButton<>(
categories, new SettingsFrame(dummy, 0, 0, 50, 50), 0
);
public SearchBarWidget(int x, int y, int w, int h) { public SearchBarWidget(int x, int y, int w, int h) {
super(x, y, w, h); super(x, y, w, h);
categories.onUpdate(v -> {
if (ClickGUI.INSTANCE != null) ClickGUI.INSTANCE.setCategoryFilter(v);
});
} }
@Override @Override
public void render(DrawContext ctx, int mouseX, int mouseY, float delta) { public void render(DrawContext ctx, int mouseX, int mouseY, float delta) {
if (!ClientSettingsFrame.guiSettings.searchBar.isEnabled()) return; if (!ClientSettingsFrame.guiSettings.searchBar.getValue()) return;
Color textFieldColor = isTextFieldHovered(mouseX, mouseY) Color textFieldColor = isTextFieldHovered(mouseX, mouseY)
? Colors.buttonColor.brighter() ? Colors.buttonColor.brighter()
@@ -45,9 +72,18 @@ public class SearchBarWidget extends Widget {
ctx.fill(x + 20, renderY + 2, x + w - 20, renderY + h - 2, textFieldColor.getRGB()); ctx.fill(x + 20, renderY + 2, x + w - 20, renderY + h - 2, textFieldColor.getRGB());
ctx.drawTexture(RenderPipelines.GUI_TEXTURED, Textures.SEARCH_BAR_FILTER,
x + w - 35, renderY + h / 2 - 6,
0, 0, 12, 12, 12, 12,
isFilterButtonHovered(mouseX, mouseY)
? Colors.SILVER.getRGB()
: Colors.WHITE.getRGB()
);
// dibujar líneas en la parte agarrable, para indicárselo al usuario // dibujar líneas en la parte agarrable, para indicárselo al usuario
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++) {
ctx.drawHorizontalLine(x + 4, x + 16, renderY + 3 * i + 5, Color.LIGHT_GRAY.getRGB()); ctx.drawHorizontalLine(x + 4, x + 16, renderY + 3 * i + 5, Color.LIGHT_GRAY.getRGB());
}
// texto // texto
Text label = Text.literal(focused ? buffer + "_" : (buffer.isEmpty() ? Formatting.ITALIC + "\uD83D\uDD0D buscar..." : buffer.toString())); Text label = Text.literal(focused ? buffer + "_" : (buffer.isEmpty() ? Formatting.ITALIC + "\uD83D\uDD0D buscar..." : buffer.toString()));
@@ -58,24 +94,30 @@ public class SearchBarWidget extends Widget {
// botón para borrar búsqueda actual // botón para borrar búsqueda actual
ctx.drawText(mc.textRenderer, "×", x + w - mc.textRenderer.getWidth("×") - 6, renderY + (h / 2) - mc.textRenderer.fontHeight / 2, ctx.drawText(mc.textRenderer, "×", x + w - mc.textRenderer.getWidth("×") - 6, renderY + (h / 2) - mc.textRenderer.fontHeight / 2,
isClearButtonHovered(mouseX, mouseY) ? Color.RED.getRGB() : -1, true); isClearButtonHovered(mouseX, mouseY) ? Color.RED.getRGB() : -1, true);
if (isFilterButtonHovered(mouseX, mouseY)) {
ctx.drawTooltip(mc.textRenderer, Text.of("filtrar por categoría"), mouseX + 7, mouseY + 20);
}
} }
@Override @Override
public void mouseClicked(int mouseX, int mouseY, int button) { public void mouseClicked(int mouseX, int mouseY, int button) {
if (button != 0 || !ClientSettingsFrame.guiSettings.searchBar.isEnabled()) return; if (button != 0 || !ClientSettingsFrame.guiSettings.searchBar.getValue()) return;
if (isHandleHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) { if (isHandleHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
dragging = true; dragging = true;
dragX = (int) mouseX - x; dragX = mouseX - x;
dragY = (int) mouseY - y; dragY = mouseY - y;
} else if (isClearButtonHovered(mouseX, mouseY)) { } else if (isClearButtonHovered(mouseX, mouseY)) {
buffer.setLength(0); buffer.setLength(0);
} else if (isFilterButtonHovered(mouseX, mouseY)) {
openFilterFrame(mouseX, mouseY);
} }
focused = isTextFieldHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this); focused = isTextFieldHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this);
} }
@Override @Override
public void mouseReleased(int mouseX, int mouseY, int button) { public void mouseReleased(int mouseX, int mouseY, int button) {
if (!ClientSettingsFrame.guiSettings.searchBar.isEnabled()) return; if (!ClientSettingsFrame.guiSettings.searchBar.getValue()) return;
ClickGUI.INSTANCE.unselect(this); ClickGUI.INSTANCE.unselect(this);
if (button == 0 && dragging) { if (button == 0 && dragging) {
dragging = false; dragging = false;
@@ -85,7 +127,7 @@ public class SearchBarWidget extends Widget {
@Override @Override
public void onKey(int key, int action) { public void onKey(int key, int action) {
if (!ClientSettingsFrame.guiSettings.searchBar.isEnabled()) return; if (!ClientSettingsFrame.guiSettings.searchBar.getValue()) return;
if (!focused || action == GLFW.GLFW_RELEASE) return; if (!focused || action == GLFW.GLFW_RELEASE) return;
switch (key) { switch (key) {
@@ -122,26 +164,33 @@ public class SearchBarWidget extends Widget {
return buffer.toString(); return buffer.toString();
} }
public boolean isHandleHovered(double mouseX, double mouseY) { public boolean isHandleHovered(int mouseX, int mouseY) {
return ClickGUI.INSTANCE.canSelect(this) return ClickGUI.INSTANCE.canSelect(this)
&& mouseX > x && mouseX < x + 18 && mouseX > x && mouseX < x + 18
&& mouseY > renderY && mouseY < renderY + h; && mouseY > renderY && mouseY < renderY + h;
} }
public boolean isTextFieldHovered(double mouseX, double mouseY) { public boolean isTextFieldHovered(int mouseX, int mouseY) {
return ClickGUI.INSTANCE.canSelect(this) return ClickGUI.INSTANCE.canSelect(this)
&& mouseX > x + 20 && mouseX < x + w - 20 && mouseX > x + 20 && mouseX < x + w - 20
&& mouseY > renderY + 2 && mouseY < renderY + h - 2; && mouseY > renderY + 2 && mouseY < renderY + h - 2
&& !isFilterButtonHovered(mouseX, mouseY);
} }
public boolean isClearButtonHovered(double mouseX, double mouseY) { public boolean isClearButtonHovered(int mouseX, int mouseY) {
return ClickGUI.INSTANCE.canSelect(this) return ClickGUI.INSTANCE.canSelect(this)
&& mouseX > x + w - 15 && mouseX < x + w - 3 && mouseX > x + w - 15 && mouseX < x + w - 3
&& mouseY > renderY + 3 && mouseY < renderY + h - 5; && mouseY > renderY + 3 && mouseY < renderY + h - 5;
} }
public boolean isFilterButtonHovered(int mouseX, int mouseY) {
return ClickGUI.INSTANCE.canSelect(this)
&& mouseX > x + w - 37 && mouseX < x + w - 21
&& mouseY > renderY + h / 2 - 8 && mouseY < renderY + h / 2 + 8;
}
public boolean isFocused() { public boolean isFocused() {
return focused && ClientSettingsFrame.guiSettings.searchBar.isEnabled(); return focused && ClientSettingsFrame.guiSettings.searchBar.getValue();
} }
public void updateRenderY(int scrollOffset) { public void updateRenderY(int scrollOffset) {
@@ -160,4 +209,10 @@ public class SearchBarWidget extends Widget {
ConfigManager.setSearchBarPosition(x, y); ConfigManager.setSearchBarPosition(x, y);
} }
} }
private void openFilterFrame(int mouseX, int mouseY) {
dummyButton.getParent().setX(mouseX);
dummyButton.getParent().setY(mouseY);
dummyButton.openFrame();
}
} }
@@ -13,11 +13,6 @@ import net.minecraft.util.Identifier;
public class Pipelines { public class Pipelines {
static final RenderPipeline.Snippet MESH_UNIFORMS = RenderPipeline.builder()
.withUniform("MeshData",UniformType.UNIFORM_BUFFER)
.buildSnippet();
static final RenderPipeline LINES_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET) static final RenderPipeline LINES_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET)
.withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/lines")) .withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/lines"))
.withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH, VertexFormat.DrawMode.LINES) .withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH, VertexFormat.DrawMode.LINES)
@@ -53,14 +48,14 @@ public class Pipelines {
.build(); .build();
public static final RenderPipeline TEXT_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_TEX_COLOR_SNIPPET) public static final RenderPipeline TEXT_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_TEX_COLOR_SNIPPET)
.withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/text")) .withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/text"))
.withVertexFormat(VertexFormats.POSITION_TEXTURE_COLOR, VertexFormat.DrawMode.TRIANGLES) .withVertexFormat(VertexFormats.POSITION_TEXTURE_COLOR, VertexFormat.DrawMode.TRIANGLES)
.withVertexShader(Identifier.of(Sputnik.MOD_ID, "shaders/text.vert")) .withVertexShader(Identifier.of(Sputnik.MOD_ID, "shaders/text.vert"))
.withFragmentShader(Identifier.of(Sputnik.MOD_ID,"shaders/text.frag")) .withFragmentShader(Identifier.of(Sputnik.MOD_ID, "shaders/text.frag"))
.withSampler("u_Texture") .withSampler("u_Texture")
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST) .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
.withDepthWrite(false) .withDepthWrite(false)
.withBlend(BlendFunction.TRANSLUCENT) .withBlend(BlendFunction.TRANSLUCENT)
.withCull(false) .withCull(false)
.build(); .build();
} }
@@ -1,89 +0,0 @@
package me.retucio.sputnik.util.render;
import com.mojang.blaze3d.platform.TextureUtil;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.textures.AddressMode;
import com.mojang.blaze3d.textures.FilterMode;
import com.mojang.blaze3d.textures.TextureFormat;
import net.minecraft.client.texture.AbstractTexture;
import net.minecraft.client.texture.NativeImage;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.BufferUtils;
import org.lwjgl.stb.STBImage;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.system.MemoryUtil;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
public class Texture extends AbstractTexture {
public Texture(int width, int height, TextureFormat format, FilterMode min, FilterMode mag) {
glTexture = RenderSystem.getDevice().createTexture("", 15, format, width, height, 1, 1);
sampler = RenderSystem.getSamplerCache().get(AddressMode.REPEAT, AddressMode.REPEAT, min, mag, false);
glTextureView = RenderSystem.getDevice().createTextureView(glTexture);
}
public int getWidth() {
return getGlTexture().getWidth(0);
}
public int getHeight() {
return getGlTexture().getHeight(0);
}
public void upload(byte[] bytes) {
upload(BufferUtils.createByteBuffer(bytes.length).put(bytes));
}
public void upload(ByteBuffer buffer) {
NativeImage image = getImage();
buffer.rewind();
MemoryUtil.memCopy(MemoryUtil.memAddress(buffer), image.imageId(), buffer.remaining());
RenderSystem.getDevice().createCommandEncoder().writeToTexture(glTexture, image);
image.close();
}
private @NotNull NativeImage getImage() {
NativeImage.Format imageFormat = switch (glTexture.getFormat()) {
case RGBA8 -> NativeImage.Format.RGBA;
case RED8 -> NativeImage.Format.LUMINANCE;
default -> throw new IllegalArgumentException();
};
// Workaround for writeToTexture(IntBuffer) overload comparing width * height to the size of the int buffer.
// And since we are working with pixels which are only one byte in size, the sizes don't match
return new NativeImage(imageFormat, getWidth(), getHeight(), false);
}
public static Texture readResource(String path, boolean flipY, FilterMode filter) {
try (var in = Texture.class.getResourceAsStream(path)) {
if (in == null) return null;
var data = TextureUtil.readResource(in).rewind();
try (MemoryStack stack = MemoryStack.stackPush()) {
IntBuffer width = stack.mallocInt(1);
IntBuffer height = stack.mallocInt(1);
IntBuffer comp = stack.mallocInt(1);
STBImage.stbi_set_flip_vertically_on_load(flipY);
ByteBuffer image = STBImage.stbi_load_from_memory(data, width, height, comp, 4);
var texture = new Texture(width.get(0), height.get(0), TextureFormat.RGBA8, filter, filter);
texture.upload(image);
STBImage.stbi_image_free(image);
STBImage.stbi_set_flip_vertically_on_load(false);
return texture;
}
} catch (IOException e) {
return null;
}
}
}
@@ -0,0 +1,49 @@
package me.retucio.sputnik.util.render;
import me.retucio.sputnik.Sputnik;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.resource.Resource;
import net.minecraft.util.Identifier;
import java.util.ArrayList;
import java.util.List;
public class Textures {
public static final MinecraftClient mc = MinecraftClient.getInstance();
public static final List<Identifier> textures = new ArrayList<>();
public static final Identifier SEARCH_BAR_FILTER = texture("gui/filter_icon");
public static Identifier texture(String path) {
Identifier id = Identifier.of(Sputnik.MOD_ID, "textures/" + path + ".png");
textures.add(id);
return id;
}
public static boolean register(Identifier id) {
if (!textures.contains(id)) textures.add(id);
if (mc.getTextureManager() != null) {
try {
Resource resource = mc.getResourceManager().getResource(id).orElseThrow();
NativeImage image = NativeImage.read(resource.getInputStream());
NativeImageBackedTexture texture = new NativeImageBackedTexture(null, image);
mc.getTextureManager().registerTexture(id, texture);
return true;
} catch (Exception e) {
Sputnik.LOGGER.error("Failed to load texture: {}", id, e);
return false;
}
}
return false;
}
public static void registerAll() {
for (Identifier id : textures) {
register(id);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

+5
View File
@@ -18,12 +18,16 @@ accessible method net/minecraft/client/font/FontManager getStorageInternal (Lnet
accessible method net/minecraft/entity/Entity setFlag (IZ)V accessible method net/minecraft/entity/Entity setFlag (IZ)V
accessible method net/minecraft/entity/player/PlayerEntity canGlide ()Z accessible method net/minecraft/entity/player/PlayerEntity canGlide ()Z
accessible class net/minecraft/client/particle/ParticleSpriteManager$SpriteAwareFactory
accessible class net/minecraft/client/particle/ParticleSpriteManager$SimpleSpriteProvider
accessible field net/minecraft/client/particle/BillboardParticle alpha F accessible field net/minecraft/client/particle/BillboardParticle alpha F
accessible field net/minecraft/client/particle/BillboardParticle scale F accessible field net/minecraft/client/particle/BillboardParticle scale F
accessible field net/minecraft/client/particle/Particle velocityMultiplier F accessible field net/minecraft/client/particle/Particle velocityMultiplier F
accessible field net/minecraft/client/particle/Particle gravityStrength F accessible field net/minecraft/client/particle/Particle gravityStrength F
accessible field net/minecraft/client/particle/Particle collidesWithWorld Z accessible field net/minecraft/client/particle/Particle collidesWithWorld Z
accessible field net/minecraft/entity/LivingEntity jumpingCooldown I accessible field net/minecraft/entity/LivingEntity jumpingCooldown I
accessible method net/minecraft/entity/LivingEntity calcGlidingVelocity (Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;
accessible method net/minecraft/client/render/RenderLayer <init> (Ljava/lang/String;Lnet/minecraft/client/render/RenderSetup;)V accessible method net/minecraft/client/render/RenderLayer <init> (Ljava/lang/String;Lnet/minecraft/client/render/RenderSetup;)V
accessible field net/minecraft/client/render/WorldRenderer worldRenderState Lnet/minecraft/client/render/state/WorldRenderState; accessible field net/minecraft/client/render/WorldRenderer worldRenderState Lnet/minecraft/client/render/state/WorldRenderState;
@@ -31,3 +35,4 @@ accessible method net/minecraft/client/render/GameRenderer getProjectionMatrix (
accessible method net/minecraft/screen/ScreenHandlerType register (Ljava/lang/String;Lnet/minecraft/screen/ScreenHandlerType$Factory;)Lnet/minecraft/screen/ScreenHandlerType; accessible method net/minecraft/screen/ScreenHandlerType register (Ljava/lang/String;Lnet/minecraft/screen/ScreenHandlerType$Factory;)Lnet/minecraft/screen/ScreenHandlerType;
accessible method net/minecraft/client/Keyboard onKey (JILnet/minecraft/client/input/KeyInput;)V accessible method net/minecraft/client/Keyboard onKey (JILnet/minecraft/client/input/KeyInput;)V