This commit is contained in:
retuci0 committed 2025-12-28 00:58:08 +01:00
1 parent 8e44dda9cf
commit a9cf6dd924
4 files changed
+89 -78

No files matched your search

+2 -19
View File
@@ -1,32 +1,15 @@
# v1.9 # v1.9.1
## novedades ## novedades
- ARREGLADO EL SELECTOR DE COLORES
### adiciones ### adiciones
- tipo de ajuste específico para colores (el selector está muy roto, ya lo arreglaré)
- comando para espectar a jugadores o entidades (`$spec`)
#### módulos nuevos: #### módulos nuevos:
- reconectar: añade un botón para reconectarse a un servidor tras ser desconectado
- superposición de luz: te muestra en qué bloques pueden spawnear bichos
- yunques con pluma: te permite utilizar tipografías distintas al renombrar items en un yunque (a falta de formato)
### arreglos / mejoras ### arreglos / mejoras
- aviso de baja dur. ya funciona en servers de paper
- ahora puedes filtrar módulos también mediante la barra de búsqueda, además de que esta ahora funciona y tal
- los ajustes cuya visibilidad dependía de otros ajustes ahora se muestran correctamente
- ahora la posición de la barra de búsqueda es guardada en el config
- ya no te sigues moviendo en el freecam al estar moviéndote, abrir una interfaz y soltar las teclas de movimiento
- elemento del hud que muestra el ping en milisegundos (a veces no va)
- ya no se dibujan los tooltips de ajustes del marco de ajustes del mod si no está extendido
- el problema donde se restablecían las teclas a las de por defecto en módulos cuyas teclas ya estaban establecidas tras cada relaunch se ha solucionado
- puntos de desconexión ahora funciona y todo (gracias Meteor)
- alguna que otra cosilla más, supongo
## problemas reconocidos ## problemas reconocidos
- muchos, pero repórtalos en la página de problemas si quieres para que queden bien registrados - muchos, pero repórtalos en la página de problemas si quieres para que queden bien registrados
@@ -10,6 +10,7 @@ public class NumberSetting extends AbstractSetting {
private double value; private double value;
private double defaultValue; private double defaultValue;
private boolean locked;
private final double min; private final double min;
private final double max; private final double max;
@@ -33,6 +34,7 @@ public class NumberSetting extends AbstractSetting {
// como decía, el valor crece o decrece por el "increment" definido // como decía, el valor crece o decrece por el "increment" definido
public void increment(boolean positive) { public void increment(boolean positive) {
if (locked) return;
if (positive) value += increment; if (positive) value += increment;
else value -= increment; else value -= increment;
value = clamp(value, min, max); value = clamp(value, min, max);
@@ -57,7 +59,7 @@ public class NumberSetting extends AbstractSetting {
} }
public void setValue(double value) { public void setValue(double value) {
if (this.value == value) 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; this.value = Math.round(clamped / increment) * increment;
fireUpdateEvent(); fireUpdateEvent();
@@ -88,6 +90,14 @@ public class NumberSetting extends AbstractSetting {
return increment; return increment;
} }
public boolean isLocked() {
return locked;
}
public void setLocked(boolean locked) {
this.locked = locked;
}
public void onUpdate(Consumer<Double> listener) { public void onUpdate(Consumer<Double> listener) {
this.updateListener = listener; this.updateListener = listener;
if (updateListener != null) updateListener.accept(value); if (updateListener != null) updateListener.accept(value);
@@ -31,7 +31,7 @@ public class ColorPickerFrame extends SettingsFrame {
private int alphaPickerX, alphaPickerY, alphaPickerWidth, alphaPickerHeight; private int alphaPickerX, alphaPickerY, alphaPickerWidth, alphaPickerHeight;
// ajustes // ajustes
NumberSetting redSetting, greenSetting, blueSetting, alphaSetting; NumberSetting redSetting, greenSetting, blueSetting;
BooleanSetting rainbowSetting; BooleanSetting rainbowSetting;
NumberSetting rainbowSpeedSetting; NumberSetting rainbowSpeedSetting;
NumberSetting saturationSetting, brightnessSetting; NumberSetting saturationSetting, brightnessSetting;
@@ -60,8 +60,6 @@ public class ColorPickerFrame extends SettingsFrame {
greenSetting.setDefaultValue(colorSetting.getDefaultG()); greenSetting.setDefaultValue(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(colorSetting.getDefaultB());
alphaSetting = new NumberSetting("opacidad", "transparencia inversa", colorSetting.getA(), 0, 255, 1);
alphaSetting.setDefaultValue(colorSetting.getDefaultA());
// ajustes de arcoíris // ajustes de arcoíris
rainbowSetting = new BooleanSetting("arcoíris", "gay.", colorSetting.isRainbow()); rainbowSetting = new BooleanSetting("arcoíris", "gay.", colorSetting.isRainbow());
@@ -74,10 +72,19 @@ public class ColorPickerFrame extends SettingsFrame {
brightnessSetting.setDefaultValue(colorSetting.getDefaultBrightness()); brightnessSetting.setDefaultValue(colorSetting.getDefaultBrightness());
// añadir ajustes y tal // añadir ajustes y tal
dummyModule.addSettings(redSetting, greenSetting, blueSetting, alphaSetting, rainbowSetting, rainbowSpeedSetting, saturationSetting, brightnessSetting); dummyModule.addSettings(redSetting, greenSetting, blueSetting, rainbowSpeedSetting, saturationSetting, brightnessSetting, rainbowSetting);
for (AbstractSetting setting : dummyModule.getSettings()) { for (AbstractSetting setting : dummyModule.getSettings()) {
if (setting instanceof NumberSetting n) n.onUpdate(v -> updateColorFromSettings()); if (setting instanceof NumberSetting n) n.onUpdate(v -> updateColorFromSettings());
if (setting instanceof BooleanSetting b) b.onUpdate(v -> updateColorFromSettings()); if (setting instanceof BooleanSetting b) b.onUpdate(v -> updateColorFromSettings());
rainbowSetting.onUpdate(v -> {
updateColorFromSettings();
redSetting.setVisible(!v);
greenSetting.setVisible(!v);
blueSetting.setVisible(!v);
rainbowSpeedSetting.setVisible(v);
saturationSetting.setVisible(v);
brightnessSetting.setVisible(v);
});
} }
settingButtons.clear(); settingButtons.clear();
@@ -112,6 +119,11 @@ public class ColorPickerFrame extends SettingsFrame {
if (colorSetting == null) return; if (colorSetting == null) return;
updateWidth(); updateWidth();
// al parecer este era el problema :/
for (AbstractSetting setting : dummyModule.getSettings())
if (setting instanceof NumberSetting ns) ns.setLocked(
pickingAlpha || pickingHue || pickingSaturationBrightness);
currentColor = colorSetting.getColor(); currentColor = colorSetting.getColor();
int padding = 5; int padding = 5;
@@ -137,6 +149,7 @@ public class ColorPickerFrame extends SettingsFrame {
int previewWidth = w - 2 * padding; int previewWidth = w - 2 * padding;
int previewHeight = 30; int previewHeight = 30;
// dimensiones
saturationBrightnessPickerX = x + padding; saturationBrightnessPickerX = x + padding;
saturationBrightnessPickerY = previewY + previewHeight + padding; saturationBrightnessPickerY = previewY + previewHeight + padding;
saturationBrightnessPickerWidth = w - 2 * padding - 20; saturationBrightnessPickerWidth = w - 2 * padding - 20;
@@ -155,7 +168,7 @@ public class ColorPickerFrame extends SettingsFrame {
int buttonAreaHeight = visibleButtons.size() * h; int buttonAreaHeight = visibleButtons.size() * h;
int bgX1 = x; int bgX1 = x;
int bgY1 = y + h + 1; int bgY1 = renderY + h + 1;
int bgX2 = x + w; int bgX2 = x + w;
int bgY2 = bgY1 + previewHeight + saturationBrightnessPickerHeight + alphaPickerHeight int bgY2 = bgY1 + previewHeight + saturationBrightnessPickerHeight + alphaPickerHeight
+ buttonAreaHeight + (padding * 6) - 11; + buttonAreaHeight + (padding * 6) - 11;
@@ -183,6 +196,7 @@ public class ColorPickerFrame extends SettingsFrame {
int hexWidth = mc.textRenderer.getWidth(hexText); int hexWidth = mc.textRenderer.getWidth(hexText);
ctx.drawText(mc.textRenderer, hexText, x + w / 2 - hexWidth / 2, previewY + previewHeight / 2 - mc.textRenderer.fontHeight / 2, -1, true); ctx.drawText(mc.textRenderer, hexText, x + w / 2 - hexWidth / 2, previewY + previewHeight / 2 - mc.textRenderer.fontHeight / 2, -1, true);
// utilizar un gradiente combinado, para mejorar la optimización
renderSaturationBrightnessGradient(ctx); renderSaturationBrightnessGradient(ctx);
DrawUtil.drawBorder(ctx, saturationBrightnessPickerX, saturationBrightnessPickerY, DrawUtil.drawBorder(ctx, saturationBrightnessPickerX, saturationBrightnessPickerY,
saturationBrightnessPickerWidth, saturationBrightnessPickerHeight, -1); saturationBrightnessPickerWidth, saturationBrightnessPickerHeight, -1);
@@ -200,7 +214,7 @@ public class ColorPickerFrame extends SettingsFrame {
int indicatorY = saturationBrightnessPickerY + (int)((1 - hsb1[2]) * saturationBrightnessPickerHeight); int indicatorY = saturationBrightnessPickerY + (int)((1 - hsb1[2]) * saturationBrightnessPickerHeight);
DrawUtil.drawCircle(ctx, indicatorX, indicatorY, 3, -1); DrawUtil.drawCircle(ctx, indicatorX, indicatorY, 3, -1);
// gradiente del "hue" - optimized // gradiente del "hue" (no sé cómo se dice en castellano)
for (int hy = 0; hy < huePickerHeight; hy += 2) { for (int hy = 0; hy < huePickerHeight; hy += 2) {
float hue = 1.0f - (hy / (float) huePickerHeight); float hue = 1.0f - (hy / (float) huePickerHeight);
Color hueColor = Color.getHSBColor(hue, 1.0f, 1.0f); Color hueColor = Color.getHSBColor(hue, 1.0f, 1.0f);
@@ -217,7 +231,7 @@ public class ColorPickerFrame extends SettingsFrame {
} }
renderAlphaGradient(ctx); renderAlphaGradient(ctx);
DrawUtil.drawBorder(ctx, alphaPickerX, alphaPickerY, alphaPickerWidth, alphaPickerHeight + 2, -1); DrawUtil.drawBorder(ctx, alphaPickerX, alphaPickerY, alphaPickerWidth, alphaPickerHeight, -1);
int alphaIndicatorX = alphaPickerX + (int)((colorSetting.getA() / 255f) * alphaPickerWidth); int alphaIndicatorX = alphaPickerX + (int)((colorSetting.getA() / 255f) * alphaPickerWidth);
DrawUtil.drawCircle(ctx, alphaIndicatorX, alphaPickerY + alphaPickerHeight / 2, 3, -1); DrawUtil.drawCircle(ctx, alphaIndicatorX, alphaPickerY + alphaPickerHeight / 2, 3, -1);
@@ -242,61 +256,38 @@ public class ColorPickerFrame extends SettingsFrame {
} }
private void renderSaturationBrightnessGradient(DrawContext ctx) { private void renderSaturationBrightnessGradient(DrawContext ctx) {
// dibujar en bloques en vez de píxeles float hue;
int blockSize = 4; // 4x4 (TRAVESTI ESCOTE REFERENCIA?!?!?!?) if (colorSetting.isRainbow()) {
hue = (System.currentTimeMillis() % (colorSetting.getRainbowSpeed() * 1000L))
/ (float) (colorSetting.getRainbowSpeed() * 1000L);
} else {
float[] hsb = Color.RGBtoHSB(colorSetting.getR(), colorSetting.getG(), colorSetting.getB(), null);
hue = hsb[0];
}
for (int sx = 0; sx < saturationBrightnessPickerWidth; sx += blockSize) { // gradiente horizontal
for (int sy = 0; sy < saturationBrightnessPickerHeight; sy += blockSize) { for (int sx = 0; sx < saturationBrightnessPickerWidth; sx++) {
int blockEndX = Math.min(sx + blockSize, saturationBrightnessPickerWidth); float saturation = sx / (float) saturationBrightnessPickerWidth;
int blockEndY = Math.min(sy + blockSize, saturationBrightnessPickerHeight); Color colorAtX = Color.getHSBColor(hue, saturation, 1);
ctx.fill(saturationBrightnessPickerX + sx, saturationBrightnessPickerY,
saturationBrightnessPickerX + sx + 1, saturationBrightnessPickerY + saturationBrightnessPickerHeight,
colorAtX.getRGB());
}
float saturation = (sx + (float) blockSize / 2) / (float) saturationBrightnessPickerWidth; // gradiente vertical
float brightness = 1 - ((sy + (float) blockSize / 2) / (float) saturationBrightnessPickerHeight); for (int sy = 0; sy < saturationBrightnessPickerHeight; sy++) {
float brightness = 1 - (sy / (float) saturationBrightnessPickerHeight);
Color color; int alpha = (int)(brightness * 255);
if (colorSetting != null && colorSetting.isRainbow()) { Color overlay = new Color(0, 0, 0, alpha);
color = Colors.rainbowColor(colorSetting.getRainbowSpeed(), colorSetting.getA(), colorSetting.getSaturation(), colorSetting.getBrightness()); ctx.fill(saturationBrightnessPickerX, saturationBrightnessPickerY + sy,
} else { saturationBrightnessPickerX + saturationBrightnessPickerWidth, saturationBrightnessPickerY + sy + 1,
float[] hsb = Color.RGBtoHSB(currentColor.getRed(), currentColor.getGreen(), currentColor.getBlue(), null); overlay.getRGB());
color = Color.getHSBColor(hsb[0], saturation, brightness);
}
ctx.fill(saturationBrightnessPickerX + sx, saturationBrightnessPickerY + sy,
saturationBrightnessPickerX + blockEndX, saturationBrightnessPickerY + blockEndY,
(colorSetting != null ? colorSetting.getA() : 255) << 24 | color.getRGB());
}
} }
} }
private void renderAlphaGradient(DrawContext ctx) { private void renderAlphaGradient(DrawContext ctx) {
int checkerSize = 4;
// dibujar casilleros alternando el tono de gris para el slider de la opacidad // dibujar casilleros alternando el tono de gris para el slider de la opacidad
for (int ax = 0; ax < alphaPickerWidth - 4; ax += checkerSize * 2) { DrawUtil.drawCheckerBoard(ctx, alphaPickerX + 1, alphaPickerY, alphaPickerWidth, alphaPickerHeight, 3, 0xFF333333, 0xFF666666);
for (int ay = 0; ay < alphaPickerHeight; ay += checkerSize * 2) {
ctx.fill(alphaPickerX + ax, alphaPickerY + ay,
alphaPickerX + ax + checkerSize, alphaPickerY + ay + checkerSize, 0xFF333333);
if (ax + checkerSize < alphaPickerWidth - 4 && ay + checkerSize < alphaPickerHeight) {
ctx.fill(alphaPickerX + ax + checkerSize, alphaPickerY + ay + checkerSize,
alphaPickerX + ax + checkerSize * 2, alphaPickerY + ay + checkerSize * 2, 0xFF333333);
}
}
}
for (int ax = checkerSize; ax < alphaPickerWidth - 4; ax += checkerSize * 2) {
for (int ay = 0; ay < alphaPickerHeight; ay += checkerSize * 2) {
ctx.fill(alphaPickerX + ax, alphaPickerY + ay,
alphaPickerX + ax + checkerSize, alphaPickerY + ay + checkerSize, 0xFF666666);
}
}
for (int ax = 0; ax < alphaPickerWidth - 4; ax += checkerSize * 2) {
for (int ay = checkerSize; ay < alphaPickerHeight; ay += checkerSize * 2) {
ctx.fill(alphaPickerX + ax, alphaPickerY + ay,
alphaPickerX + ax + checkerSize, alphaPickerY + ay + checkerSize, 0xFF666666);
}
}
if (colorSetting != null) { if (colorSetting != null) {
int alphaWidth = (int)(alphaPickerWidth * (colorSetting.getA() / 255f)); int alphaWidth = (int)(alphaPickerWidth * (colorSetting.getA() / 255f));
@@ -311,7 +302,7 @@ public class ColorPickerFrame extends SettingsFrame {
int stripEndX = Math.min(ax + stripWidth, alphaWidth); int stripEndX = Math.min(ax + stripWidth, alphaWidth);
ctx.fill(alphaPickerX + ax, alphaPickerY, ctx.fill(alphaPickerX + ax, alphaPickerY,
alphaPickerX + stripEndX, alphaPickerY + alphaPickerHeight + 2, overlayColor.getRGB()); alphaPickerX + stripEndX, alphaPickerY + alphaPickerHeight, overlayColor.getRGB());
} }
} }
} }
@@ -452,7 +443,6 @@ public class ColorPickerFrame extends SettingsFrame {
alpha = Math.max(0, Math.min(255, alpha)); alpha = Math.max(0, Math.min(255, alpha));
colorSetting.setA(alpha); colorSetting.setA(alpha);
alphaSetting.setValue(alpha);
} }
} }
@@ -467,7 +457,7 @@ public class ColorPickerFrame extends SettingsFrame {
red = redSetting.getIntValue(); red = redSetting.getIntValue();
green = greenSetting.getIntValue(); green = greenSetting.getIntValue();
blue = blueSetting.getIntValue(); blue = blueSetting.getIntValue();
alpha = alphaSetting.getIntValue(); alpha = colorSetting.getA();
rainbow = rainbowSetting.isEnabled(); rainbow = rainbowSetting.isEnabled();
rainbowSpeed = rainbowSpeedSetting.getIntValue(); rainbowSpeed = rainbowSpeedSetting.getIntValue();
saturation = saturationSetting.getFloatValue(); saturation = saturationSetting.getFloatValue();
@@ -17,4 +17,32 @@ public class DrawUtil {
if (i * i + j * j <= radius * radius) if (i * i + j * j <= radius * radius)
ctx.fill(x + i, y + j, x + i + 1, y + j + 1, color); ctx.fill(x + i, y + j, x + i + 1, y + j + 1, color);
} }
public static void drawCheckerBoard(DrawContext ctx, int x, int y, int width, int height, int checkerSize, int color1, int color2) {
for (int ax = 0; ax < width - 4; ax += checkerSize * 2) {
for (int ay = 0; ay < height; ay += checkerSize * 2) {
ctx.fill(x + ax, y + ay,
x + ax + checkerSize, y + ay + checkerSize, color1);
if (ax + checkerSize < width - 4 && ay + checkerSize < height) {
ctx.fill(x + ax + checkerSize, y + ay + checkerSize,
x + ax + checkerSize * 2, y + ay + checkerSize * 2, color1);
}
}
}
for (int ax = checkerSize; ax < width - 4; ax += checkerSize * 2) {
for (int ay = 0; ay < height; ay += checkerSize * 2) {
ctx.fill(x + ax, y + ay,
x + ax + checkerSize, y + ay + checkerSize, color2);
}
}
for (int ax = 0; ax < width - 4; ax += checkerSize * 2) {
for (int ay = checkerSize; ay < height; ay += checkerSize * 2) {
ctx.fill(x + ax, y + ay,
x + ax + checkerSize, y + ay + checkerSize, color2);
}
}
}
} }