v2.8
This commit is contained in:
1 parent
436b79fd2b
commit
f074f05c51
21 files changed
+277
-120
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# jenny's mod 2 100% real
|
||||
|
||||
mod para Minecraft Fabric 1.21.10 que añade algunas cosas QOL, mayormente relacionadas a la cámara.
|
||||
mod para Minecraft Fabric 1.21.11 que añade algunas cosas QOL, mayormente relacionadas a la cámara.
|
||||
|
||||
## instalación
|
||||
|
||||
|
||||
+12
-11
@@ -1,23 +1,24 @@
|
||||
# v2.7
|
||||
# v2.8
|
||||
|
||||
## novedades
|
||||
|
||||
### adiciones
|
||||
|
||||
- filtro por categoría de módulos en la barra de búsqueda
|
||||
|
||||
#### módulos nuevos:
|
||||
|
||||
- avioneta: vuela infinitamente usando el glitch de las elytras descubierto por Heppe, o al menos hasta que se te rompan las elytras
|
||||
- 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
|
||||
- discordrpc: personaliza la actividad de tu perfil de discord
|
||||
|
||||
### arreglos / mejoras
|
||||
|
||||
- ahora se puede hacer ctrl + v para pegar en los ajustes de texto
|
||||
- el color por defecto de la superposición de daño ya es el color principal del mod
|
||||
- arreglado el elemento del HUD de rotación
|
||||
- arreglado los marcos de ajustes de selección
|
||||
- arreglado el gradiente del selector de colores
|
||||
- ahora el marco del preview del color en el botón del ajuste de color será el color complementario (rgb, no ryb) del color seleccionado
|
||||
|
||||
- ahora puedes borrar palabras enteras con ctrl + borrar
|
||||
|
||||
- mejoras al HUD:
|
||||
- movimiento axial: centra los elementos más fácilmente
|
||||
- movimiento con flechas: mueve el elemento seleccionado con las flechas
|
||||
- ahora se puede abrir y usar el editor aun sin estar en un mundo
|
||||
- más previews de elementos coinciden con su valor actual
|
||||
- al parecer he arreglado sin querer un problema que había que no te dejaba seleccionar correctamente elementos del hud
|
||||
|
||||
## problemas reconocidos
|
||||
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@ loom_version=1.13-SNAPSHOT
|
||||
|
||||
fabric_api_version=0.140.2+1.21.11
|
||||
|
||||
mod_version=2.7
|
||||
mod_version=2.8
|
||||
maven_group=me.retucio
|
||||
archives_base_name=sputnik
|
||||
@@ -19,6 +19,7 @@ import me.retucio.sputnik.module.Module;
|
||||
import me.retucio.sputnik.module.ModuleManager;
|
||||
import me.retucio.sputnik.module.modules.client.HUD;
|
||||
|
||||
import me.retucio.sputnik.ui.hud.HudRenderer;
|
||||
import me.retucio.sputnik.ui.screen.ClickGUI;
|
||||
import me.retucio.sputnik.ui.hud.HudEditorScreen;
|
||||
import me.retucio.sputnik.ui.widgets.buttons.settings.BindButton;
|
||||
@@ -108,6 +109,8 @@ public class Sputnik implements ClientModInitializer {
|
||||
HudEditorScreen.INSTANCE = new HudEditorScreen();
|
||||
EVENT_BUS.post(new LoadClickGUIEvent());
|
||||
|
||||
mc.execute(HudRenderer::init);
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
EVENT_BUS.post(new ShutdownEvent());
|
||||
}));
|
||||
|
||||
@@ -38,8 +38,8 @@ public class DiscordRPC extends Module {
|
||||
));
|
||||
|
||||
public StringSetting startTimestamp = sgGeneral.add(new StringSetting(
|
||||
"sello de tiempo", "sello de tiempo del comienzo de la actividad, siguiendo el unix epoch (. para ahora)",
|
||||
".",
|
||||
"sello de tiempo", "sello de tiempo del comienzo de la actividad, siguiendo el unix epoch (dejar vacío para ahora)",
|
||||
"",
|
||||
20
|
||||
));
|
||||
|
||||
@@ -124,6 +124,8 @@ public class DiscordRPC extends Module {
|
||||
"personaliza la actividad de tu perfil en dishkor",
|
||||
Category.CLIENT);
|
||||
|
||||
rpc.setDebugMode(false);
|
||||
|
||||
for (Setting<?> s : getSettings()) {
|
||||
s.onUpdate(v -> update());
|
||||
}
|
||||
@@ -202,13 +204,15 @@ public class DiscordRPC extends Module {
|
||||
}
|
||||
|
||||
private long getTimestamp() {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
|
||||
if (!startTimestamp.getValue().equals(".")) {
|
||||
long timestamp;
|
||||
if (startTimestamp.getValue().trim().isEmpty()) {
|
||||
timestamp = System.currentTimeMillis();
|
||||
} else {
|
||||
try {
|
||||
timestamp = Long.parseLong(startTimestamp.getValue());
|
||||
} catch (NumberFormatException e) {
|
||||
ChatUtil.error("introduce un NÚMERO (o .)");
|
||||
ChatUtil.error("introduce un NÚMERO (o déjalo vacío)");
|
||||
timestamp = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,21 +25,92 @@ public class HUD extends Module {
|
||||
SettingGroup sgElements = addSg(new SettingGroup("elementos", false));
|
||||
|
||||
// editor
|
||||
public KeySetting editorKey = sgEditor.add(new KeySetting("tecla del editor", "tecla asignada al editor de elementos del hud", GLFW.GLFW_KEY_PAGE_UP));
|
||||
public KeySetting editorKey = sgEditor.add(new KeySetting(
|
||||
"tecla del editor",
|
||||
"tecla asignada al editor de elementos del hud",
|
||||
GLFW.GLFW_KEY_PAGE_UP
|
||||
));
|
||||
public BooleanSetting axialMovement = sgEditor.add(new BooleanSetting(
|
||||
"movimiento axial",
|
||||
"te permite mover los elementos sobre los ejes más fácilmente",
|
||||
true
|
||||
));
|
||||
public NumberSetting axisOffset = sgEditor.add(new NumberSetting(
|
||||
"offset de los ejes",
|
||||
"offset a tener en cuenta al usar el movimiento axial",
|
||||
10,
|
||||
0,
|
||||
50,
|
||||
1
|
||||
));
|
||||
public BooleanSetting arrowMovement = sgEditor.add(new BooleanSetting(
|
||||
"movimiento con flechas",
|
||||
"te permite mover el elemento seleccionado con las teclas de las flechas",
|
||||
true
|
||||
));
|
||||
public NumberSetting arrowOffset = sgEditor.add(new NumberSetting(
|
||||
"cuánto mover con las flechas",
|
||||
"cuántos píxeles mover el elemento seleccionado al usar las flechas",
|
||||
2,
|
||||
1,
|
||||
20,
|
||||
1
|
||||
));
|
||||
|
||||
// ajustes
|
||||
public ColorSetting color = sgDisplay.add(new ColorSetting("color", "color del texto de los elementos del HUD",
|
||||
new Color(255, 255, 255, 255), false));
|
||||
public BooleanSetting shadow = sgDisplay.add(new BooleanSetting("sombra", "texto con sombra", true));
|
||||
public BooleanSetting showOnF3 = sgDisplay.add(new BooleanSetting("mostrar en F3", "renderizar HUD en el menú de debug", false));
|
||||
public BooleanSetting showOnChat = sgDisplay.add(new BooleanSetting("mostrar en chat", "renderizar HUD en la pantalla del chat", false));
|
||||
// renderizado
|
||||
public ColorSetting color = sgDisplay.add(new ColorSetting(
|
||||
"color",
|
||||
"color del texto de los elementos del HUD",
|
||||
new Color(255, 255, 255, 255), false)
|
||||
);
|
||||
public BooleanSetting shadow = sgDisplay.add(new BooleanSetting(
|
||||
"sombra",
|
||||
"texto con sombra",
|
||||
true
|
||||
));
|
||||
public BooleanSetting showOnF3 = sgDisplay.add(new BooleanSetting(
|
||||
"mostrar en F3",
|
||||
"renderizar HUD en el menú de debug",
|
||||
false
|
||||
));
|
||||
public BooleanSetting showOnChat = sgDisplay.add(new BooleanSetting(
|
||||
"mostrar en chat",
|
||||
"renderizar HUD en la pantalla del chat",
|
||||
false
|
||||
));
|
||||
|
||||
public NumberSetting timezone = sgElements.add(new NumberSetting("zona horaria", "zona horaria en UTC+n", 1, -6, 6, 1));
|
||||
public EnumSetting<TimeFormat> timeFormat = sgElements.add(new EnumSetting<>("formato de la hora", "12h o 24h", TimeFormat.class, TimeFormat.TWENTY_FOUR_HOUR));
|
||||
public StringSetting customText = sgElements.add(new StringSetting("texto custom", "marca de agua (dejar vacío para quitar)", "adolf jitler inshtagram feishbuc twiter", 40));
|
||||
public EnumSetting<CoordsMode> coordsMode = sgElements.add(new EnumSetting<>("modo de coordenadas", "qué coordenadas mostrar", CoordsMode.class, CoordsMode.OVERWORLD));
|
||||
public EnumSetting<Dynosaurs> dyno = sgElements.add(new EnumSetting<>("dinosaurio", "qué dinosaurio mostrar",
|
||||
Dynosaurs.class, Dynosaurs.SPINOSAURUS));
|
||||
// elementos
|
||||
public NumberSetting timezone = sgElements.add(new NumberSetting(
|
||||
"zona horaria",
|
||||
"zona horaria en UTC+n",
|
||||
1,
|
||||
-6,
|
||||
6,
|
||||
1
|
||||
));
|
||||
public EnumSetting<TimeFormat> timeFormat = sgElements.add(new EnumSetting<>(
|
||||
"formato de la hora",
|
||||
"12h o 24h",
|
||||
TimeFormat.class,
|
||||
TimeFormat.TWENTY_FOUR_HOUR
|
||||
));
|
||||
public StringSetting customText = sgElements.add(new StringSetting(
|
||||
"texto custom",
|
||||
"marca de agua (dejar vacío para quitar)",
|
||||
"adolf jitler inshtagram feishbuc twiter",
|
||||
40
|
||||
));
|
||||
public EnumSetting<CoordsMode> coordsMode = sgElements.add(new EnumSetting<>(
|
||||
"modo de coordenadas",
|
||||
"qué coordenadas mostrar",
|
||||
CoordsMode.class,
|
||||
CoordsMode.OVERWORLD
|
||||
));
|
||||
public EnumSetting<Dynosaurs> dyno = sgElements.add(new EnumSetting<>(
|
||||
"dinosaurio",
|
||||
"qué dinosaurio mostrar",
|
||||
Dynosaurs.class, Dynosaurs.SPINOSAURUS
|
||||
));
|
||||
|
||||
public HUD() {
|
||||
super("HUD",
|
||||
@@ -48,6 +119,9 @@ public class HUD extends Module {
|
||||
GLFW.GLFW_KEY_F12
|
||||
);
|
||||
|
||||
axialMovement.onUpdate(v -> axisOffset.setVisible(v));
|
||||
arrowMovement.onUpdate(v -> arrowOffset.setVisible(v));
|
||||
|
||||
dyno.onUpdate(v -> {
|
||||
DynoElement element = (DynoElement) HudRenderer.getElement(DynoElement.class);
|
||||
if (element != null) element.reloadTexture();
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Map;
|
||||
|
||||
public class ColorSetting extends Setting<Color> {
|
||||
|
||||
private Color defaultColor;
|
||||
private final boolean defaultRainbow;
|
||||
private final int defaultRainbowSpeed;
|
||||
|
||||
@@ -21,13 +20,13 @@ public class ColorSetting extends Setting<Color> {
|
||||
private float saturation;
|
||||
private float brightness;
|
||||
|
||||
public ColorSetting(String name, String description, Color defaultColor, boolean rainbow) {
|
||||
super(name, description, defaultColor);
|
||||
public ColorSetting(String name, String description, Color defaultValue, boolean rainbow) {
|
||||
super(name, description, defaultValue);
|
||||
|
||||
this.r = defaultColor.getRed();
|
||||
this.g = defaultColor.getGreen();
|
||||
this.b = defaultColor.getBlue();
|
||||
this.a = defaultColor.getAlpha();
|
||||
this.r = defaultValue.getRed();
|
||||
this.g = defaultValue.getGreen();
|
||||
this.b = defaultValue.getBlue();
|
||||
this.a = defaultValue.getAlpha();
|
||||
|
||||
this.rainbow = rainbow;
|
||||
this.defaultRainbow = rainbow;
|
||||
@@ -192,28 +191,20 @@ public class ColorSetting extends Setting<Color> {
|
||||
}
|
||||
}
|
||||
|
||||
public Color getDefaultColor() {
|
||||
return defaultColor;
|
||||
}
|
||||
|
||||
public void setDefaultColor(Color defaultColor) {
|
||||
this.defaultColor = defaultColor;
|
||||
}
|
||||
|
||||
public int getDefaultR() {
|
||||
return defaultColor.getRed();
|
||||
return defaultValue.getRed();
|
||||
}
|
||||
|
||||
public int getDefaultG() {
|
||||
return defaultColor.getGreen();
|
||||
return defaultValue.getGreen();
|
||||
}
|
||||
|
||||
public int getDefaultB() {
|
||||
return defaultColor.getBlue();
|
||||
return defaultValue.getBlue();
|
||||
}
|
||||
|
||||
public int getDefaultA() {
|
||||
return defaultColor.getAlpha();
|
||||
return defaultValue.getAlpha();
|
||||
}
|
||||
|
||||
public float getDefaultSaturation() {
|
||||
@@ -242,10 +233,10 @@ public class ColorSetting extends Setting<Color> {
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.r = defaultColor.getRed();
|
||||
this.g = defaultColor.getGreen();
|
||||
this.b = defaultColor.getBlue();
|
||||
this.a = defaultColor.getAlpha();
|
||||
this.r = defaultValue.getRed();
|
||||
this.g = defaultValue.getGreen();
|
||||
this.b = defaultValue.getBlue();
|
||||
this.a = defaultValue.getAlpha();
|
||||
this.rainbow = false;
|
||||
this.rainbowSpeed = 2;
|
||||
this.saturation = 1f;
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package me.retucio.sputnik.ui.hud;
|
||||
|
||||
import me.retucio.sputnik.Sputnik;
|
||||
import me.retucio.sputnik.config.ConfigManager;
|
||||
import me.retucio.sputnik.event.SubscribeEvent;
|
||||
import me.retucio.sputnik.event.events.KeyEvent;
|
||||
import me.retucio.sputnik.module.ModuleManager;
|
||||
import me.retucio.sputnik.module.modules.client.HUD;
|
||||
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||
import me.retucio.sputnik.util.Colors;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Click;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.input.KeyInput;
|
||||
import net.minecraft.text.Text;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@@ -19,15 +23,17 @@ public class HudEditorScreen extends Screen {
|
||||
|
||||
public static HudEditorScreen INSTANCE;
|
||||
private final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
private final HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
|
||||
private final List<HudElement> elements = new ArrayList<>();
|
||||
@Nullable private HudElement selected = null;
|
||||
|
||||
private boolean dragging = false;
|
||||
private int dragOffsetX, dragOffsetY;
|
||||
private int dragX, dragY;
|
||||
|
||||
public HudEditorScreen() {
|
||||
super(Text.literal("editor del HUD"));
|
||||
Sputnik.EVENT_BUS.subscribe(this);
|
||||
}
|
||||
|
||||
public void setElements(List<HudElement> elements) {
|
||||
@@ -40,15 +46,30 @@ public class HudEditorScreen extends Screen {
|
||||
ctx.fill(0, 0, this.width, this.height, Colors.hudEditorScreenBackgroundColor.getRGB());
|
||||
|
||||
// instrucciones
|
||||
ctx.drawCenteredTextWithShadow(mc.textRenderer, "editor del HUD",
|
||||
ctx.drawCenteredTextWithShadow(mc.textRenderer, title,
|
||||
this.width / 2, this.height / 2 - mc.textRenderer.fontHeight, -1);
|
||||
ctx.drawCenteredTextWithShadow(mc.textRenderer,
|
||||
Text.literal("arrastrar para mover · clic derecho para visibilidad · ESC para guardar y salir · shift + clic derecho para restablecer"),
|
||||
this.width / 2, this.height / 2 + mc.textRenderer.fontHeight, Colors.instructionsTextColor.getRGB());
|
||||
|
||||
// movimiento axial
|
||||
if (hud.axialMovement.getValue()) {
|
||||
int centerX = mc.getWindow().getScaledWidth() / 2;
|
||||
if (dragging && selected != null && Math.abs(centerX - mouseX) < hud.axisOffset.getValue()) {
|
||||
dragX = mouseX - centerX + selected.getW() / 2;
|
||||
ctx.drawVerticalLine(centerX, 0, mc.getWindow().getScaledHeight(), Colors.CELESTE.getRGB());
|
||||
}
|
||||
|
||||
int centerY = mc.getWindow().getScaledHeight() / 2;
|
||||
if (dragging && selected != null && Math.abs(centerY - mouseY) < hud.axisOffset.getValue()) {
|
||||
dragY = mouseY - centerY + selected.getH() / 2;
|
||||
ctx.drawHorizontalLine(0, mc.getWindow().getScaledWidth(), centerY, Colors.CELESTE.getRGB());
|
||||
}
|
||||
}
|
||||
|
||||
// elementos
|
||||
for (HudElement element : elements)
|
||||
element.renderInEditor(ctx, null);
|
||||
element.renderInEditor(ctx, hud);
|
||||
|
||||
// tooltips
|
||||
if (!dragging) {
|
||||
@@ -72,17 +93,16 @@ public class HudEditorScreen extends Screen {
|
||||
int mouseX = (int) click.x();
|
||||
int mouseY = (int) click.y();
|
||||
|
||||
for (int i = elements.size() - 1; i >= 0; i--) {
|
||||
HudElement element = elements.get(i);
|
||||
for (HudElement element : elements) {
|
||||
if (element.isHovered(mouseX, mouseY)) {
|
||||
selected = element;
|
||||
|
||||
if (click.button() == 0) {
|
||||
dragging = true;
|
||||
dragOffsetX = mouseX - element.getX();
|
||||
dragOffsetY = mouseY - element.getY();
|
||||
dragX = mouseX - element.getX();
|
||||
dragY = mouseY - element.getY();
|
||||
|
||||
elements.remove(i);
|
||||
elements.remove(element);
|
||||
elements.add(element);
|
||||
return true;
|
||||
|
||||
@@ -109,8 +129,8 @@ public class HudEditorScreen extends Screen {
|
||||
int mouseX = (int) click.x();
|
||||
int mouseY = (int) click.y();
|
||||
|
||||
int newX = mouseX - dragOffsetX;
|
||||
int newY = mouseY - dragOffsetY;
|
||||
int newX = mouseX - dragX;
|
||||
int newY = mouseY - dragY;
|
||||
|
||||
newX = Math.max(1, Math.min(newX, width - selected.getW() - 1));
|
||||
newY = Math.max(1, Math.min(newY, height - selected.getH() - 1));
|
||||
@@ -132,15 +152,36 @@ public class HudEditorScreen extends Screen {
|
||||
return super.mouseReleased(click);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(KeyInput input) {
|
||||
if (input.key() == GLFW.GLFW_KEY_ESCAPE) {
|
||||
@SubscribeEvent
|
||||
// he sustituído el método del súper por un evento para ver si así se podían
|
||||
// registrar dos teclas a la vez, pero resulta que no :P
|
||||
public void onKey(KeyEvent event) {
|
||||
if (!(mc.currentScreen == INSTANCE)) return;
|
||||
if (event.getAction() == GLFW.GLFW_RELEASE) return;
|
||||
event.cancel();
|
||||
|
||||
// guardar y salir
|
||||
if (event.getKey() == GLFW.GLFW_KEY_ESCAPE) {
|
||||
saveAllElementsToConfig();
|
||||
selected = null;
|
||||
mc.setScreen(null);
|
||||
return true;
|
||||
}
|
||||
return super.keyPressed(input);
|
||||
// movimiento de los elementos con las teclas de las flechas
|
||||
else if (hud.arrowMovement.getValue() && selected != null) {
|
||||
int offset = hud.arrowOffset.getIntValue();
|
||||
if (event.getKey() == GLFW.GLFW_KEY_UP) {
|
||||
selected.setY(Math.max(1, selected.getY() - offset));
|
||||
}
|
||||
if (event.getKey() == GLFW.GLFW_KEY_DOWN) {
|
||||
selected.setY(Math.min(mc.getWindow().getScaledHeight() - selected.getH() + 1, selected.getY() + offset));
|
||||
}
|
||||
if (event.getKey() == GLFW.GLFW_KEY_LEFT) {
|
||||
selected.setX(Math.max(1, selected.getX() - offset));
|
||||
}
|
||||
if (event.getKey() == GLFW.GLFW_KEY_RIGHT) {
|
||||
selected.setX(Math.min(mc.getWindow().getScaledWidth() - selected.getW() + 1, selected.getX() + offset));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveElementToConfig(HudElement element) {
|
||||
|
||||
@@ -25,11 +25,6 @@ public abstract class HudElement extends Widget {
|
||||
public abstract void renderInEditor(DrawContext ctx, HUD hud);
|
||||
public abstract List<Text> getTooltip();
|
||||
|
||||
public boolean isHovered(int mouseX, int mouseY) {
|
||||
return mouseX >= x && mouseX <= x + w
|
||||
&& mouseY >= y && mouseY <= y + w;
|
||||
}
|
||||
|
||||
public String getId() { return id; }
|
||||
|
||||
public boolean isVisible() { return visible; }
|
||||
|
||||
@@ -93,31 +93,26 @@ public class HudRenderer {
|
||||
}
|
||||
|
||||
public static void render(DrawContext ctx, RenderTickCounter tickCounter) {
|
||||
if (shouldSkipRendering()) return;
|
||||
|
||||
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
if (!hud.isEnabled()) return;
|
||||
if (mc.debugHudEntryList.isF3Enabled() && !hud.showOnF3.getValue()) return;
|
||||
if (mc.currentScreen instanceof ChatScreen && !hud.showOnChat.getValue()) return;
|
||||
|
||||
init();
|
||||
|
||||
if (mc.currentScreen instanceof HudEditorScreen) return;
|
||||
|
||||
float delta = tickCounter.getDynamicDeltaTicks();
|
||||
for (HudElement element : elements) {
|
||||
if (element.isVisible()) {
|
||||
element.renderInGame(ctx, delta, hud);
|
||||
if (element.isVisible() && !shouldSkipRendering()) {
|
||||
element.renderInGame(ctx, tickCounter.getDynamicDeltaTicks(), hud);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean shouldSkipRendering() {
|
||||
HUD hud = ModuleManager.INSTANCE.getModuleByClass(HUD.class);
|
||||
return ModuleManager.INSTANCE == null
|
||||
|| mc.player == null
|
||||
|| mc.getCameraEntity() == null
|
||||
|| mc.currentScreen instanceof TitleScreen
|
||||
|| mc.options.hudHidden;
|
||||
|| mc.options.hudHidden
|
||||
|| !hud.isEnabled()
|
||||
|| (mc.debugHudEntryList.isF3Enabled() && !hud.showOnF3.getValue())
|
||||
|| (mc.currentScreen instanceof ChatScreen && !hud.showOnChat.getValue())
|
||||
|| mc.currentScreen instanceof HudEditorScreen;
|
||||
}
|
||||
|
||||
public static List<HudElement> getElements() {
|
||||
|
||||
@@ -20,6 +20,8 @@ public class CoordsElement extends TextHudElement {
|
||||
Freecam freecam = ModuleManager.INSTANCE.getModuleByClass(Freecam.class);
|
||||
Vec3d pos = freecam != null && freecam.isEnabled()
|
||||
? new Vec3d(freecam.getX(delta), freecam.getY(delta), freecam.getZ(delta))
|
||||
: mc.player == null
|
||||
? new Vec3d(67, 67, 67)
|
||||
: mc.player.getEntityPos();
|
||||
|
||||
String overworldCoords = (int) pos.x + " " + (int) pos.y + " " + (int) pos.z;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FpsElement extends TextHudElement {
|
||||
|
||||
@Override
|
||||
public String getPreviewText() {
|
||||
return "FPS: 67";
|
||||
return "FPS: " + mc.getCurrentFps();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ public class TimeElement extends TextHudElement {
|
||||
|
||||
@Override
|
||||
public String getPreviewText() {
|
||||
return "04:20 PM";
|
||||
return MiscUtil.getCurrentFormattedTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,10 +33,35 @@ public class TotemsElement extends ImageHudElement {
|
||||
if (stack.getItem() == Items.TOTEM_OF_UNDYING)
|
||||
count++;
|
||||
}
|
||||
} else {
|
||||
count = 69;
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(Items.TOTEM_OF_UNDYING, Math.max(1, count));
|
||||
drawItem(ctx, new ItemStack(Items.TOTEM_OF_UNDYING, Math.max(1, count)), count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInEditor(DrawContext ctx, HUD hud) {
|
||||
int count = 0;
|
||||
if (mc.player != null) {
|
||||
for (ItemStack stack : mc.player.getInventory()) {
|
||||
if (stack.getItem() == Items.TOTEM_OF_UNDYING)
|
||||
count++;
|
||||
}
|
||||
} else {
|
||||
count = 69;
|
||||
}
|
||||
|
||||
drawEditorBackground(ctx);
|
||||
drawItem(ctx, new ItemStack(Items.TOTEM_OF_UNDYING, Math.max(1, count)), count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Text> getTooltip() {
|
||||
return List.of(Text.of("totems disponibles"));
|
||||
}
|
||||
|
||||
private void drawItem(DrawContext ctx, ItemStack stack, int count) {
|
||||
ctx.drawItem(stack, x, y);
|
||||
if (count > 1) {
|
||||
ctx.drawStackOverlay(mc.textRenderer, stack, x, y);
|
||||
@@ -54,24 +79,4 @@ public class TotemsElement extends ImageHudElement {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInEditor(DrawContext ctx, HUD hud) {
|
||||
int count = 0;
|
||||
if (mc.player != null) {
|
||||
for (ItemStack stack : mc.player.getInventory()) {
|
||||
if (stack.getItem() == Items.TOTEM_OF_UNDYING)
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
drawEditorBackground(ctx);
|
||||
|
||||
ctx.drawItem(new ItemStack(Items.TOTEM_OF_UNDYING, count), x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Text> getTooltip() {
|
||||
return List.of(Text.of("totems disponibles"));
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -47,7 +48,7 @@ public class ClickGUI extends Screen {
|
||||
public static ClickGUI INSTANCE;
|
||||
|
||||
private boolean anyFocused;
|
||||
private Widget selected = null;
|
||||
private @Nullable Widget selected = null;
|
||||
|
||||
private Category categoryFilter = Category.ALL;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ColorButton extends SettingButton<ColorSetting> {
|
||||
int previewX = x + 5;
|
||||
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, Colors.getOppositeColor(setting.getValue(), true).getRGB());
|
||||
ctx.fill(previewX, previewY, previewX + previewSize, previewY + previewSize, setting.getValue().getRGB());
|
||||
|
||||
// texto
|
||||
|
||||
@@ -6,6 +6,7 @@ import me.retucio.sputnik.ui.screen.ClickGUI;
|
||||
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
|
||||
import me.retucio.sputnik.util.Colors;
|
||||
import me.retucio.sputnik.util.KeyUtil;
|
||||
import me.retucio.sputnik.util.MiscUtil;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@@ -58,7 +59,7 @@ public class TextButton extends SettingButton<StringSetting> {
|
||||
|
||||
// pegar con ctrl + v
|
||||
if (key == GLFW.GLFW_KEY_V && KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
|
||||
buffer.append(mc.keyboard.getClipboard());
|
||||
paste();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,8 +95,11 @@ public class TextButton extends SettingButton<StringSetting> {
|
||||
return typing;
|
||||
}
|
||||
|
||||
private void onBackspace() {
|
||||
if (!buffer.isEmpty())
|
||||
buffer.deleteCharAt(buffer.length() - 1);
|
||||
public void onBackspace() {
|
||||
MiscUtil.backspace(buffer);
|
||||
}
|
||||
|
||||
public void paste() {
|
||||
buffer.append(MiscUtil.getPasteContent(setting.getMaxLength() - buffer.length()));
|
||||
}
|
||||
}
|
||||
@@ -278,7 +278,7 @@ public class ColorPickerFrame extends SettingsFrame {
|
||||
|
||||
// gradiente vertical
|
||||
for (int sy = 0; sy < saturationBrightnessPickerHeight; sy++) {
|
||||
float brightness = 1 - (sy / (float) saturationBrightnessPickerHeight);
|
||||
float brightness = (sy / (float) saturationBrightnessPickerHeight);
|
||||
int alpha = (int)(brightness * 255);
|
||||
Color overlay = new Color(0, 0, 0, alpha);
|
||||
ctx.fill(saturationBrightnessPickerX, saturationBrightnessPickerY + sy,
|
||||
|
||||
@@ -11,6 +11,7 @@ import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||
import me.retucio.sputnik.ui.widgets.Widget;
|
||||
import me.retucio.sputnik.util.Colors;
|
||||
import me.retucio.sputnik.util.KeyUtil;
|
||||
import me.retucio.sputnik.util.MiscUtil;
|
||||
import me.retucio.sputnik.util.render.Textures;
|
||||
import net.minecraft.client.gl.RenderPipelines;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
@@ -130,6 +131,11 @@ public class SearchBarWidget extends Widget {
|
||||
if (!ClientSettingsFrame.guiSettings.searchBar.getValue()) return;
|
||||
if (!focused || action == GLFW.GLFW_RELEASE) return;
|
||||
|
||||
if (key == GLFW.GLFW_KEY_V && KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
|
||||
paste();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case GLFW.GLFW_KEY_ENTER -> focused = false;
|
||||
case GLFW.GLFW_KEY_ESCAPE -> {
|
||||
@@ -151,7 +157,11 @@ public class SearchBarWidget extends Widget {
|
||||
}
|
||||
|
||||
public void onBackspace() {
|
||||
if (!buffer.isEmpty()) buffer.deleteCharAt(buffer.length() - 1);
|
||||
MiscUtil.backspace(buffer);
|
||||
}
|
||||
|
||||
public void paste() {
|
||||
buffer.append(MiscUtil.getPasteContent(-1));
|
||||
}
|
||||
|
||||
public void charTyped(char c) {
|
||||
|
||||
@@ -147,4 +147,16 @@ public class Colors {
|
||||
int bDiff = c1.getBlue() - c2.getBlue();
|
||||
return rDiff * rDiff + gDiff * gDiff + bDiff * bDiff;
|
||||
}
|
||||
|
||||
// espacio de colores RGB, no RYB
|
||||
public static Color getOppositeColor(Color c, boolean keepAlpha) {
|
||||
int alpha = c.getAlpha();
|
||||
if (!keepAlpha) alpha = 255 - alpha;
|
||||
return new Color(
|
||||
255 - c.getRed(),
|
||||
255 - c.getGreen(),
|
||||
255 - c.getBlue(),
|
||||
alpha
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import me.retucio.sputnik.module.modules.client.HUD;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.joml.Vector3d;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
@@ -66,4 +67,22 @@ public class MiscUtil {
|
||||
.replace("ú", "u");
|
||||
}
|
||||
|
||||
public static String getPasteContent(int maxLength) {
|
||||
if (maxLength == -1) return mc.keyboard.getClipboard();
|
||||
return mc.keyboard.getClipboard().substring(0, Math.min(maxLength, mc.keyboard.getClipboard().length()));
|
||||
}
|
||||
|
||||
public static void backspace(StringBuilder buffer) {
|
||||
if (KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL)) {
|
||||
for (int i = buffer.length() - 1; i >= 0; i--) {
|
||||
char c = buffer.charAt(i);
|
||||
buffer.deleteCharAt(i);
|
||||
if (c == ' ') break;
|
||||
}
|
||||
} else {
|
||||
if (!buffer.isEmpty()) {
|
||||
buffer.deleteCharAt(buffer.length() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user