v2.4
No files matched your search
@@ -1,17 +1,18 @@
|
|||||||
# v2.3
|
# v2.4
|
||||||
|
|
||||||
## novedades
|
## novedades
|
||||||
|
|
||||||
- renombrado el mod a sputnik porque esmegma o cameratweaks era un asco y sputnik ta to wapo
|
ahora se usa el formato binario (.dat) en vez de .json para guardar ajustes, lo que los hace más rápidos, y el archivo más liviano
|
||||||
|
|
||||||
### adiciones
|
### adiciones
|
||||||
|
|
||||||
#### módulos nuevos:
|
#### módulos nuevos:
|
||||||
|
|
||||||
|
- capas: cambia (solo visualmente, para ti) la capa que usas a una custom de las disponibles
|
||||||
|
|
||||||
### arreglos / mejoras
|
### arreglos / mejoras
|
||||||
|
|
||||||
- ahora tienes un múltiplo en críticos, es decir, un número por el que se multiplica la cantidad de partículas a generar
|
- renombrado bien todo que lo hice con prisa
|
||||||
- ya no se guardan los ajustes mientras se cargan
|
|
||||||
|
|
||||||
## problemas reconocidos
|
## problemas reconocidos
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
minecraft_version=1.21.11
|
minecraft_version=1.21.11
|
||||||
@@ -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.3
|
mod_version=2.4
|
||||||
maven_group=me.retucio
|
maven_group=me.retucio
|
||||||
archives_base_name=sputnik
|
archives_base_name=sputnik
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.retucio.sputnik;
|
package me.retucio.sputnik;
|
||||||
|
|
||||||
|
|
||||||
|
import me.retucio.sputnik.cape.CapeManager;
|
||||||
import me.retucio.sputnik.command.CommandManager;
|
import me.retucio.sputnik.command.CommandManager;
|
||||||
import me.retucio.sputnik.command.commands.BindCommand;
|
import me.retucio.sputnik.command.commands.BindCommand;
|
||||||
|
|
||||||
@@ -9,14 +10,15 @@ import me.retucio.sputnik.config.ConfigManager;
|
|||||||
import me.retucio.sputnik.event.EventBus;
|
import me.retucio.sputnik.event.EventBus;
|
||||||
import me.retucio.sputnik.event.SubscribeEvent;
|
import me.retucio.sputnik.event.SubscribeEvent;
|
||||||
import me.retucio.sputnik.event.events.ShutdownEvent;
|
import me.retucio.sputnik.event.events.ShutdownEvent;
|
||||||
|
import me.retucio.sputnik.event.events.sputnik.LoadCapeManagerEvent;
|
||||||
import me.retucio.sputnik.event.events.sputnik.LoadClickGUIEvent;
|
import me.retucio.sputnik.event.events.sputnik.LoadClickGUIEvent;
|
||||||
import me.retucio.sputnik.event.events.sputnik.LoadCommandManagerEvent;
|
import me.retucio.sputnik.event.events.sputnik.LoadCommandManagerEvent;
|
||||||
import me.retucio.sputnik.event.events.sputnik.LoadModuleManagerEvent;
|
import me.retucio.sputnik.event.events.sputnik.LoadModuleManagerEvent;
|
||||||
|
|
||||||
import me.retucio.sputnik.module.Module;
|
import me.retucio.sputnik.module.Module;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
|
|
||||||
import me.retucio.sputnik.module.modules.client.HUD;
|
import me.retucio.sputnik.module.modules.client.HUD;
|
||||||
|
|
||||||
import me.retucio.sputnik.ui.screen.ClickGUI;
|
import me.retucio.sputnik.ui.screen.ClickGUI;
|
||||||
import me.retucio.sputnik.ui.hud.HudEditorScreen;
|
import me.retucio.sputnik.ui.hud.HudEditorScreen;
|
||||||
import me.retucio.sputnik.ui.widgets.buttons.settings.BindButton;
|
import me.retucio.sputnik.ui.widgets.buttons.settings.BindButton;
|
||||||
@@ -24,21 +26,19 @@ import me.retucio.sputnik.ui.widgets.buttons.SettingButton;
|
|||||||
import me.retucio.sputnik.ui.widgets.buttons.settings.TextButton;
|
import me.retucio.sputnik.ui.widgets.buttons.settings.TextButton;
|
||||||
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||||
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 me.retucio.sputnik.util.*;
|
import me.retucio.sputnik.util.*;
|
||||||
|
|
||||||
|
|
||||||
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 net.fabricmc.api.ClientModInitializer;
|
|
||||||
|
|
||||||
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
|
||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.ChatScreen;
|
import net.minecraft.client.gui.screen.ChatScreen;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen;
|
import net.minecraft.client.gui.screen.ingame.AbstractCommandBlockScreen;
|
||||||
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
|
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
|
||||||
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
|
import net.minecraft.client.gui.screen.ingame.AnvilScreen;
|
||||||
@@ -86,6 +86,9 @@ public class Sputnik implements ClientModInitializer {
|
|||||||
|
|
||||||
Lists.init();
|
Lists.init();
|
||||||
|
|
||||||
|
CapeManager.INSTANCE = new CapeManager();
|
||||||
|
EVENT_BUS.post(new LoadCapeManagerEvent());
|
||||||
|
|
||||||
ModuleManager.INSTANCE = new ModuleManager();
|
ModuleManager.INSTANCE = new ModuleManager();
|
||||||
EVENT_BUS.post(new LoadModuleManagerEvent());
|
EVENT_BUS.post(new LoadModuleManagerEvent());
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package me.retucio.sputnik.cape;
|
||||||
|
|
||||||
|
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.util.Identifier;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
public class Cape {
|
||||||
|
|
||||||
|
private final MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final Identifier id;
|
||||||
|
private NativeImage img;
|
||||||
|
private NativeImageBackedTexture texture;
|
||||||
|
|
||||||
|
public Cape(String name) {
|
||||||
|
this.name = name;
|
||||||
|
this.id = Identifier.of(Sputnik.MOD_ID, "textures/capes/" + name + ".png");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
this.img = loadTexture(this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NativeImage loadTexture(Identifier id) {
|
||||||
|
try (InputStream inputStream = mc.getResourceManager().getResource(id).get().getInputStream()) {
|
||||||
|
return NativeImage.read(inputStream);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Sputnik.LOGGER.error("ups: {}", e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void register() {
|
||||||
|
texture = new NativeImageBackedTexture(null, img);
|
||||||
|
mc.getTextureManager().registerTexture(id, texture);
|
||||||
|
img = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Identifier getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NativeImageBackedTexture getTexture() {
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name.replace('-', ' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package me.retucio.sputnik.cape;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static me.retucio.sputnik.Sputnik.mc;
|
||||||
|
|
||||||
|
public class CapeManager {
|
||||||
|
|
||||||
|
public static CapeManager INSTANCE;
|
||||||
|
|
||||||
|
private final List<Cape> capes = new ArrayList<>();
|
||||||
|
|
||||||
|
public CapeManager() {
|
||||||
|
addCapes();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCapes() {
|
||||||
|
addCape("sputnik");
|
||||||
|
addCape("half-life");
|
||||||
|
addCape("hollow-knight");
|
||||||
|
|
||||||
|
addCape("cherry-blossom");
|
||||||
|
addCape("migrator");
|
||||||
|
addCape("minecraft");
|
||||||
|
addCape("pancakes");
|
||||||
|
addCape("vanilla");
|
||||||
|
|
||||||
|
addCape("tiktok");
|
||||||
|
addCape("twitch");
|
||||||
|
|
||||||
|
addCape("mojang");
|
||||||
|
addCape("mojang-old");
|
||||||
|
addCape("mojang-old-old");
|
||||||
|
|
||||||
|
addCape("minecon-2011");
|
||||||
|
addCape("minecon-2012");
|
||||||
|
addCape("minecon-2013");
|
||||||
|
addCape("minecon-2015");
|
||||||
|
addCape("minecon-2016");
|
||||||
|
addCape("experience-2025");
|
||||||
|
|
||||||
|
addCape("15th-anniversary");
|
||||||
|
addCape("bedrock");
|
||||||
|
addCape("birthday");
|
||||||
|
addCape("copper");
|
||||||
|
addCape("eye-blossom");
|
||||||
|
addCape("mcc-15");
|
||||||
|
addCape("prismarine");
|
||||||
|
addCape("turtle");
|
||||||
|
addCape("valentine");
|
||||||
|
|
||||||
|
addCape("chinese-translator");
|
||||||
|
addCape("cobalt");
|
||||||
|
addCape("mojira-mod");
|
||||||
|
addCape("millionth-customer");
|
||||||
|
addCape("realms-mapmaker");
|
||||||
|
addCape("scrolls-champion");
|
||||||
|
addCape("translator");
|
||||||
|
|
||||||
|
addCape("cheapsh0t");
|
||||||
|
addCape("dannybstyle");
|
||||||
|
addCape("julianclark");
|
||||||
|
addCape("mrmessiah");
|
||||||
|
|
||||||
|
for (Cape cape : capes) {
|
||||||
|
mc.execute(cape::load);
|
||||||
|
mc.execute(cape::register);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addCape(String name) {
|
||||||
|
capes.add(new Cape(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cape getCape(String name) {
|
||||||
|
for (Cape cape : capes)
|
||||||
|
if (cape.getName().equalsIgnoreCase(name))
|
||||||
|
return cape;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Cape> getCapes() {
|
||||||
|
return capes;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package me.retucio.sputnik.command;
|
|||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.command.commands.*;
|
import me.retucio.sputnik.command.commands.*;
|
||||||
import me.retucio.sputnik.event.SubscribeEvent;
|
import me.retucio.sputnik.event.SubscribeEvent;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
@@ -47,7 +48,7 @@ public class CommandManager {
|
|||||||
for (Command command : commands) {
|
for (Command command : commands) {
|
||||||
for (Method method : command.getClass().getDeclaredMethods()) {
|
for (Method method : command.getClass().getDeclaredMethods()) {
|
||||||
if (method.isAnnotationPresent(SubscribeEvent.class)) {
|
if (method.isAnnotationPresent(SubscribeEvent.class)) {
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.register(command);
|
Sputnik.EVENT_BUS.register(command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ import java.util.*;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
// para autocompletar entidades
|
|
||||||
import static me.retucio.sputnik.Sputnik.mc;
|
import static me.retucio.sputnik.Sputnik.mc;
|
||||||
|
|
||||||
|
|
||||||
|
// para autocompletar entidades
|
||||||
public class EntityArgumentType implements ArgumentType<Entity> {
|
public class EntityArgumentType implements ArgumentType<Entity> {
|
||||||
|
|
||||||
public static final EntityArgumentType INSTANCE = new EntityArgumentType();
|
public static final EntityArgumentType INSTANCE = new EntityArgumentType();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class PurgeCommand extends Command {
|
|||||||
ChatHud chatHud = mc.inGameHud.getChatHud();
|
ChatHud chatHud = mc.inGameHud.getChatHud();
|
||||||
|
|
||||||
synchronized (chatHud) {
|
synchronized (chatHud) {
|
||||||
List<ChatHudLine.Visible> visibleMessages = ((IChatHud) chatHud).smegma$getVisibleMessages();
|
List<ChatHudLine.Visible> visibleMessages = ((IChatHud) chatHud).sputnik$getVisibleMessages();
|
||||||
int toRemove = Math.min(amount, visibleMessages.size());
|
int toRemove = Math.min(amount, visibleMessages.size());
|
||||||
for (int i = 0; i < toRemove; i++)
|
for (int i = 0; i < toRemove; i++)
|
||||||
visibleMessages.removeFirst();
|
visibleMessages.removeFirst();
|
||||||
|
|||||||
@@ -0,0 +1,357 @@
|
|||||||
|
package me.retucio.sputnik.config;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class BinarySerializer {
|
||||||
|
|
||||||
|
private static final int MAGIC_NUMBER = 0x53505554; // "SPUT"
|
||||||
|
private static final int VERSION = 1;
|
||||||
|
|
||||||
|
private static final byte TYPE_NULL = 0;
|
||||||
|
private static final byte TYPE_BOOLEAN = 1;
|
||||||
|
private static final byte TYPE_INT = 2;
|
||||||
|
private static final byte TYPE_DOUBLE = 3;
|
||||||
|
private static final byte TYPE_STRING = 4;
|
||||||
|
private static final byte TYPE_MAP = 5;
|
||||||
|
private static final byte TYPE_INT_ARRAY = 6;
|
||||||
|
private static final byte TYPE_FRAME_DATA = 7;
|
||||||
|
|
||||||
|
public static void writeConfig(ClientConfig config, File file)
|
||||||
|
throws IOException {
|
||||||
|
try (DataOutputStream out = new DataOutputStream(
|
||||||
|
new BufferedOutputStream(new FileOutputStream(file)))) {
|
||||||
|
|
||||||
|
// cabezal
|
||||||
|
out.writeInt(MAGIC_NUMBER);
|
||||||
|
out.writeInt(VERSION);
|
||||||
|
|
||||||
|
// mapas
|
||||||
|
writeStringBooleanMap(out, config.moduleStates);
|
||||||
|
writeSettingsMap(out, config.settings);
|
||||||
|
writeStringIntArrayMap(out, config.settingsFrames);
|
||||||
|
writeExtendableFrames(out, config.extendableFrames);
|
||||||
|
writeStringIntArrayMap(out, config.hudPositions);
|
||||||
|
writeStringBooleanMap(out, config.hudVisibilities);
|
||||||
|
writeStringStringMap(out, config.hudImagePaths);
|
||||||
|
|
||||||
|
// posición de la barra de búsqueda
|
||||||
|
if (config.searchBarPosition != null) {
|
||||||
|
out.writeBoolean(true);
|
||||||
|
out.writeInt(config.searchBarPosition[0]);
|
||||||
|
out.writeInt(config.searchBarPosition[1]);
|
||||||
|
} else {
|
||||||
|
out.writeBoolean(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ClientConfig readConfig(File file)
|
||||||
|
throws IOException {
|
||||||
|
if (!file.exists() || file.length() == 0) {
|
||||||
|
throw new IOException("archivo de config. vacío o inexistente");
|
||||||
|
}
|
||||||
|
|
||||||
|
try (DataInputStream in = new DataInputStream(
|
||||||
|
new BufferedInputStream(new FileInputStream(file)))) {
|
||||||
|
|
||||||
|
if (file.length() < 8) {
|
||||||
|
throw new IOException("archivo demasiado pequeño para ser válido");
|
||||||
|
}
|
||||||
|
|
||||||
|
// verificar cabezal
|
||||||
|
int magic = in.readInt();
|
||||||
|
if (magic != MAGIC_NUMBER) {
|
||||||
|
throw new IOException("formato de archivo inválido: " + magic);
|
||||||
|
}
|
||||||
|
|
||||||
|
int version = in.readInt();
|
||||||
|
if (version != VERSION) {
|
||||||
|
throw new IOException("versión inválida: " + version);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientConfig config = new ClientConfig();
|
||||||
|
|
||||||
|
// leer mapas
|
||||||
|
config.moduleStates = readStringBooleanMap(in);
|
||||||
|
config.settings = readSettingsMap(in);
|
||||||
|
config.settingsFrames = readStringIntArrayMap(in);
|
||||||
|
config.extendableFrames = readExtendableFrames(in);
|
||||||
|
config.hudPositions = readStringIntArrayMap(in);
|
||||||
|
config.hudVisibilities = readStringBooleanMap(in);
|
||||||
|
config.hudImagePaths = readStringStringMap(in);
|
||||||
|
|
||||||
|
// leer pos. de la barra de búsqueda
|
||||||
|
if (in.readBoolean()) {
|
||||||
|
config.searchBarPosition = new int[]{in.readInt(), in.readInt()};
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeStringBooleanMap(DataOutputStream out, Map<String, Boolean> map)
|
||||||
|
throws IOException {
|
||||||
|
if (map == null) {
|
||||||
|
out.writeInt(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.writeInt(map.size());
|
||||||
|
for (Map.Entry<String, Boolean> entry : map.entrySet()) {
|
||||||
|
writeString(out, entry.getKey());
|
||||||
|
out.writeBoolean(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, Boolean> readStringBooleanMap(DataInputStream in)
|
||||||
|
throws IOException {
|
||||||
|
int size = in.readInt();
|
||||||
|
Map<String, Boolean> map = new HashMap<>(size);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
String key = readString(in);
|
||||||
|
boolean value = in.readBoolean();
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeSettingsMap(DataOutputStream out, Map<String, Object> map)
|
||||||
|
throws IOException {
|
||||||
|
if (map == null) {
|
||||||
|
out.writeInt(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.writeInt(map.size());
|
||||||
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
|
writeString(out, entry.getKey());
|
||||||
|
writeSettingValue(out, entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, Object> readSettingsMap(DataInputStream in)
|
||||||
|
throws IOException {
|
||||||
|
int size = in.readInt();
|
||||||
|
Map<String, Object> map = new HashMap<>(size);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
String key = readString(in);
|
||||||
|
Object value = readSettingValue(in);
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeSettingValue(DataOutputStream out, Object value)
|
||||||
|
throws IOException {
|
||||||
|
switch (value) {
|
||||||
|
case Boolean b -> {
|
||||||
|
out.writeByte(TYPE_BOOLEAN);
|
||||||
|
out.writeBoolean(b);
|
||||||
|
}
|
||||||
|
case Integer i -> {
|
||||||
|
out.writeByte(TYPE_INT);
|
||||||
|
out.writeInt(i);
|
||||||
|
}
|
||||||
|
case Double v -> {
|
||||||
|
out.writeByte(TYPE_DOUBLE);
|
||||||
|
out.writeDouble(v);
|
||||||
|
}
|
||||||
|
case String s -> {
|
||||||
|
out.writeByte(TYPE_STRING);
|
||||||
|
writeString(out, s);
|
||||||
|
}
|
||||||
|
case Map<?, ?> map -> {
|
||||||
|
out.writeByte(TYPE_MAP);
|
||||||
|
writeGenericMap(out, map);
|
||||||
|
} // fallback
|
||||||
|
case null, default -> out.writeByte(TYPE_NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object readSettingValue(DataInputStream in) throws IOException {
|
||||||
|
byte type = in.readByte();
|
||||||
|
return switch (type) {
|
||||||
|
case TYPE_BOOLEAN -> in.readBoolean();
|
||||||
|
case TYPE_INT -> in.readInt();
|
||||||
|
case TYPE_DOUBLE -> in.readDouble();
|
||||||
|
case TYPE_STRING -> readString(in);
|
||||||
|
case TYPE_MAP -> readGenericMap(in);
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeGenericMap(DataOutputStream out, Map<?, ?> map)
|
||||||
|
throws IOException {
|
||||||
|
if (map == null) {
|
||||||
|
out.writeInt(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.writeInt(map.size());
|
||||||
|
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
||||||
|
writeObject(out, entry.getKey());
|
||||||
|
writeObject(out, entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<Object, Object> readGenericMap(DataInputStream in)
|
||||||
|
throws IOException {
|
||||||
|
int size = in.readInt();
|
||||||
|
Map<Object, Object> map = new HashMap<>(size);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
Object key = readObject(in);
|
||||||
|
Object value = readObject(in);
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeObject(DataOutputStream out, Object obj)
|
||||||
|
throws IOException {
|
||||||
|
switch (obj) {
|
||||||
|
case String s -> {
|
||||||
|
out.writeByte(TYPE_STRING);
|
||||||
|
writeString(out, s);
|
||||||
|
}
|
||||||
|
case Boolean b -> {
|
||||||
|
out.writeByte(TYPE_BOOLEAN);
|
||||||
|
out.writeBoolean(b);
|
||||||
|
}
|
||||||
|
case Number number -> {
|
||||||
|
if (obj instanceof Integer) {
|
||||||
|
out.writeByte(TYPE_INT);
|
||||||
|
out.writeInt((Integer) obj);
|
||||||
|
} else if (obj instanceof Double) {
|
||||||
|
out.writeByte(TYPE_DOUBLE);
|
||||||
|
out.writeDouble((Double) obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
out.writeByte(TYPE_STRING);
|
||||||
|
writeString(out, obj.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object readObject(DataInputStream in) throws IOException {
|
||||||
|
byte type = in.readByte();
|
||||||
|
return switch (type) {
|
||||||
|
case TYPE_STRING -> readString(in);
|
||||||
|
case TYPE_BOOLEAN -> in.readBoolean();
|
||||||
|
case TYPE_INT -> in.readInt();
|
||||||
|
case TYPE_DOUBLE -> in.readDouble();
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeStringIntArrayMap(DataOutputStream out, Map<String, int[]> map)
|
||||||
|
throws IOException {
|
||||||
|
if (map == null) {
|
||||||
|
out.writeInt(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.writeInt(map.size());
|
||||||
|
for (Map.Entry<String, int[]> entry : map.entrySet()) {
|
||||||
|
writeString(out, entry.getKey());
|
||||||
|
int[] array = entry.getValue();
|
||||||
|
if (array == null) {
|
||||||
|
out.writeInt(0);
|
||||||
|
} else {
|
||||||
|
out.writeInt(array.length);
|
||||||
|
for (int value : array) {
|
||||||
|
out.writeInt(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, int[]> readStringIntArrayMap(DataInputStream in)
|
||||||
|
throws IOException {
|
||||||
|
int size = in.readInt();
|
||||||
|
Map<String, int[]> map = new HashMap<>(size);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
String key = readString(in);
|
||||||
|
int arraySize = in.readInt();
|
||||||
|
int[] array = new int[arraySize];
|
||||||
|
for (int j = 0; j < arraySize; j++) {
|
||||||
|
array[j] = in.readInt();
|
||||||
|
}
|
||||||
|
map.put(key, array);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeExtendableFrames(DataOutputStream out, Map<String, ClientConfig.FrameData> map)
|
||||||
|
throws IOException {
|
||||||
|
if (map == null) {
|
||||||
|
out.writeInt(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.writeInt(map.size());
|
||||||
|
for (Map.Entry<String, ClientConfig.FrameData> entry : map.entrySet()) {
|
||||||
|
writeString(out, entry.getKey());
|
||||||
|
ClientConfig.FrameData data = entry.getValue();
|
||||||
|
out.writeInt(data.x());
|
||||||
|
out.writeInt(data.y());
|
||||||
|
out.writeBoolean(data.extended());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, ClientConfig.FrameData> readExtendableFrames(DataInputStream in)
|
||||||
|
throws IOException {
|
||||||
|
int size = in.readInt();
|
||||||
|
Map<String, ClientConfig.FrameData> map = new HashMap<>(size);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
String key = readString(in);
|
||||||
|
int x = in.readInt();
|
||||||
|
int y = in.readInt();
|
||||||
|
boolean extended = in.readBoolean();
|
||||||
|
map.put(key, new ClientConfig.FrameData(x, y, extended));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeStringStringMap(DataOutputStream out, Map<String, String> map)
|
||||||
|
throws IOException {
|
||||||
|
if (map == null) {
|
||||||
|
out.writeInt(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
out.writeInt(map.size());
|
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
|
writeString(out, entry.getKey());
|
||||||
|
writeString(out, entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, String> readStringStringMap(DataInputStream in)
|
||||||
|
throws IOException {
|
||||||
|
int size = in.readInt();
|
||||||
|
Map<String, String> map = new HashMap<>(size);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
String key = readString(in);
|
||||||
|
String value = readString(in);
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optimized string writing (UTF-8 with length prefix)
|
||||||
|
private static void writeString(DataOutputStream out, String str) throws IOException {
|
||||||
|
if (str == null) {
|
||||||
|
out.writeInt(-1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
|
||||||
|
out.writeInt(bytes.length);
|
||||||
|
out.write(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String readString(DataInputStream in) throws IOException {
|
||||||
|
int length = in.readInt();
|
||||||
|
if (length == -1) return null;
|
||||||
|
byte[] bytes = new byte[length];
|
||||||
|
in.readFully(bytes);
|
||||||
|
return new String(bytes, "UTF-8");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ import me.retucio.sputnik.event.events.sputnik.*;
|
|||||||
import me.retucio.sputnik.module.settings.*;
|
import me.retucio.sputnik.module.settings.*;
|
||||||
import me.retucio.sputnik.ui.screen.ClickGUI;
|
import me.retucio.sputnik.ui.screen.ClickGUI;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -62,7 +64,7 @@ public class ClientConfig {
|
|||||||
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;
|
||||||
case ColorSetting c: value = c.getConfigValue(); break;
|
case ColorSetting c: value = c.getConfigValue(); break;
|
||||||
case OptionSetting o: value = o.getIndex(); break;
|
case OptionSetting o: value = o.getDisplayName(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +73,6 @@ public class ClientConfig {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onOpenSettingsFrame(SettingsFrameEvent.Open event) {
|
public void onOpenSettingsFrame(SettingsFrameEvent.Open event) {
|
||||||
if (settingsFrames.containsKey(event.getFrame().module.getName())) return;
|
|
||||||
ConfigManager.setFramePosition(event.getFrame());
|
ConfigManager.setFramePosition(event.getFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,5 +120,7 @@ public class ClientConfig {
|
|||||||
ClickGUI.INSTANCE.getGuiSettingsFrame().extended));
|
ClickGUI.INSTANCE.getGuiSettingsFrame().extended));
|
||||||
}
|
}
|
||||||
|
|
||||||
public record FrameData(int x, int y, boolean extended) {}
|
public record FrameData(int x, int y, boolean extended) implements Serializable {
|
||||||
|
@Serial private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package me.retucio.sputnik.config;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.module.Module;
|
import me.retucio.sputnik.module.Module;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.settings.*;
|
import me.retucio.sputnik.module.settings.*;
|
||||||
@@ -10,20 +11,20 @@ import me.retucio.sputnik.ui.widgets.frames.ModuleFrame;
|
|||||||
import me.retucio.sputnik.ui.screen.ClickGUI;
|
import me.retucio.sputnik.ui.screen.ClickGUI;
|
||||||
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||||
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
|
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
|
||||||
|
import me.retucio.sputnik.util.ChatUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
// se ocupa de guardar, cargar y aplicar ajustes
|
// se ocupa de guardar, cargar y aplicar ajustes
|
||||||
// pues no me ha dado dolores de cabeza el coso este con los NPE de los cojones...
|
|
||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
|
|
||||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
private static final File CONFIG_FILE = new File("sputnik.dat");
|
||||||
private static final File CONFIG_FILE = new File("sputnik.json");
|
private static final File LEGACY_JSON_FILE = new File("sputnik.json");
|
||||||
|
|
||||||
private static boolean loaded = false;
|
private static boolean loaded = false;
|
||||||
private static ClientConfig config = null;
|
private static ClientConfig config = null;
|
||||||
@@ -36,31 +37,44 @@ public class ConfigManager {
|
|||||||
if (!loaded) return;
|
if (!loaded) return;
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
|
|
||||||
try (FileWriter writer = new FileWriter(CONFIG_FILE)) {
|
try {
|
||||||
GSON.toJson(config, writer);
|
BinarySerializer.writeConfig(config, CONFIG_FILE);
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("ajustes guardados");
|
Sputnik.LOGGER.info("ajustes guardados");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.error("error al guardar ajustes", e);
|
Sputnik.LOGGER.error("error al guardar ajustes", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cargar configuraciones
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("cargando ajustes...");
|
Sputnik.LOGGER.info("cargando ajustes...");
|
||||||
|
|
||||||
if (!CONFIG_FILE.exists()) {
|
if (CONFIG_FILE.exists()) {
|
||||||
ensureConfig();
|
try {
|
||||||
save();
|
config = BinarySerializer.readConfig(CONFIG_FILE);
|
||||||
return;
|
Sputnik.LOGGER.info("ajustes cargados");
|
||||||
|
return;
|
||||||
|
} catch (IOException e) {
|
||||||
|
Sputnik.LOGGER.error("error cargando ajustes, intentando json", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try (FileReader reader = new FileReader(CONFIG_FILE)) {
|
// Fallback to legacy JSON
|
||||||
config = GSON.fromJson(reader, ClientConfig.class);
|
if (LEGACY_JSON_FILE.exists()) {
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("ajustes cargados");
|
try (FileReader reader = new FileReader(LEGACY_JSON_FILE)) {
|
||||||
} catch (IOException e) {
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.error("no se pudieron cargar los ajustes, usando ajustes por defecto", e);
|
config = gson.fromJson(reader, ClientConfig.class);
|
||||||
ensureConfig();
|
Sputnik.LOGGER.info("ajustes json cargados (migración)");
|
||||||
|
|
||||||
|
save();
|
||||||
|
return;
|
||||||
|
} catch (IOException e) {
|
||||||
|
Sputnik.LOGGER.error("error cargando json, usando defaults", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// crear nuevo config
|
||||||
|
ensureConfig();
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// aplicar configuraciones cargadas
|
// aplicar configuraciones cargadas
|
||||||
@@ -75,7 +89,7 @@ public class ConfigManager {
|
|||||||
applyExtendableFrames();
|
applyExtendableFrames();
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("ajustes aplicados");
|
Sputnik.LOGGER.info("ajustes aplicados");
|
||||||
}
|
}
|
||||||
|
|
||||||
// obtener configuración actual
|
// obtener configuración actual
|
||||||
@@ -101,7 +115,10 @@ public class ConfigManager {
|
|||||||
|
|
||||||
public static void setFramePosition(SettingsFrame frame) {
|
public static void setFramePosition(SettingsFrame frame) {
|
||||||
ensureConfig();
|
ensureConfig();
|
||||||
config.settingsFrames.put(frame.module.getName(), new int[] {frame.getX(), frame.getY()});
|
if (!config.settingsFrames.containsKey(frame.module.getName()))
|
||||||
|
config.settingsFrames.put(frame.module.getName(), new int[] {frame.getX(), frame.getY()});
|
||||||
|
else
|
||||||
|
config.settingsFrames.replace(frame.module.getName(), new int[] {frame.getX(), frame.getY()});
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +177,7 @@ public class ConfigManager {
|
|||||||
case ListSetting listSetting -> applyListSetting(listSetting, value);
|
case ListSetting listSetting -> applyListSetting(listSetting, value);
|
||||||
case ColorSetting colorSetting -> applyColorSetting(colorSetting, value);
|
case ColorSetting colorSetting -> applyColorSetting(colorSetting, value);
|
||||||
case OptionSetting optionSetting -> applyOptionSetting(optionSetting, value);
|
case OptionSetting optionSetting -> applyOptionSetting(optionSetting, value);
|
||||||
default -> me.retucio.sputnik.Sputnik.LOGGER.warn("watafac queseso: {}", setting.getClass().getSimpleName());
|
default -> Sputnik.LOGGER.warn("watafac queseso: {}", setting.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,14 +187,14 @@ public class ConfigManager {
|
|||||||
module.setEnabled(config.moduleStates.get(module.getName()));
|
module.setEnabled(config.moduleStates.get(module.getName()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("estados de módulos aplicados");
|
Sputnik.LOGGER.info("estados de módulos aplicados");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyModuleSettings() {
|
private static void applyModuleSettings() {
|
||||||
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
ModuleManager.INSTANCE.getModules().forEach(module -> {
|
||||||
module.getSettings().forEach(setting -> applySetting(module, setting));
|
module.getSettings().forEach(setting -> applySetting(module, setting));
|
||||||
});
|
});
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("ajustes de módulos aplicados");
|
Sputnik.LOGGER.info("ajustes de módulos aplicados");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applySettingsFrames() {
|
private static void applySettingsFrames() {
|
||||||
@@ -185,7 +202,7 @@ public class ConfigManager {
|
|||||||
Module module = ModuleManager.INSTANCE.getModuleByName(moduleName);
|
Module module = ModuleManager.INSTANCE.getModuleByName(moduleName);
|
||||||
ClickGUI.INSTANCE.openSettingsFrame(module, position[0], position[1]);
|
ClickGUI.INSTANCE.openSettingsFrame(module, position[0], position[1]);
|
||||||
});
|
});
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("estados de marcos de ajustes aplicados");
|
Sputnik.LOGGER.info("estados de marcos de ajustes aplicados");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applySearchBarPosition() {
|
private static void applySearchBarPosition() {
|
||||||
@@ -193,7 +210,7 @@ public class ConfigManager {
|
|||||||
ClickGUI.INSTANCE.getSearchBar().setX(config.searchBarPosition[0]);
|
ClickGUI.INSTANCE.getSearchBar().setX(config.searchBarPosition[0]);
|
||||||
ClickGUI.INSTANCE.getSearchBar().setY(config.searchBarPosition[1]);
|
ClickGUI.INSTANCE.getSearchBar().setY(config.searchBarPosition[1]);
|
||||||
}
|
}
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("posición de la barra de búsqueda aplicada");
|
Sputnik.LOGGER.info("posición de la barra de búsqueda aplicada");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyGuiSettings() {
|
private static void applyGuiSettings() {
|
||||||
@@ -201,14 +218,14 @@ public class ConfigManager {
|
|||||||
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> {
|
ClientSettingsFrame.guiSettings.getSettings().forEach(setting -> {
|
||||||
applySetting(ClientSettingsFrame.guiSettings, setting);
|
applySetting(ClientSettingsFrame.guiSettings, setting);
|
||||||
});
|
});
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("ajustes del cliente aplicados");
|
Sputnik.LOGGER.info("ajustes del cliente aplicados");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyExtendableFrames() {
|
private static void applyExtendableFrames() {
|
||||||
applyExtendableFrame(ClickGUI.INSTANCE.getModulesFrame());
|
applyExtendableFrame(ClickGUI.INSTANCE.getModulesFrame());
|
||||||
applyExtendableFrame(ClickGUI.INSTANCE.getGuiSettingsFrame());
|
applyExtendableFrame(ClickGUI.INSTANCE.getGuiSettingsFrame());
|
||||||
|
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("posiciones de marcos extendibles aplicadasa");
|
Sputnik.LOGGER.info("posiciones de marcos extendibles aplicadas");
|
||||||
ClickGUI.INSTANCE.refreshListButtons();
|
ClickGUI.INSTANCE.refreshListButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,9 +316,8 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static <T> void applyOptionSetting(OptionSetting<T> setting, Object value) {
|
private static <T> void applyOptionSetting(OptionSetting<T> setting, Object value) {
|
||||||
if (value instanceof Double) {
|
if (value instanceof String name) {
|
||||||
int index = ((Double) value).intValue();
|
setting.setValueByName(name);
|
||||||
setting.setValue(setting.getOption(index));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,10 +332,9 @@ public class ConfigManager {
|
|||||||
// ------------------ MÉTODOS DE AYUDA ------------------
|
// ------------------ MÉTODOS DE AYUDA ------------------
|
||||||
|
|
||||||
private static boolean shouldApply() {
|
private static boolean shouldApply() {
|
||||||
return me.retucio.sputnik.Sputnik.mc != null && ModuleManager.INSTANCE != null && config != null;
|
return Sputnik.mc != null && ModuleManager.INSTANCE != null && config != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void ensureConfig() {
|
private static void ensureConfig() {
|
||||||
if (config == null) config = new ClientConfig();
|
if (config == null) config = new ClientConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.event;
|
package me.retucio.sputnik.event.events;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.event.Event;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package me.retucio.sputnik.event.events.sputnik;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.event.Event;
|
||||||
|
|
||||||
|
// se genera cuando carga el gestor de capas
|
||||||
|
public class LoadCapeManagerEvent extends Event {}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package me.retucio.sputnik.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
|
import me.retucio.sputnik.module.modules.player.Capes;
|
||||||
|
import net.minecraft.client.render.command.OrderedRenderCommandQueue;
|
||||||
|
import net.minecraft.client.render.entity.feature.CapeFeatureRenderer;
|
||||||
|
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.AssetInfo;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(CapeFeatureRenderer.class)
|
||||||
|
public abstract class CapeFeatureRendererMixin {
|
||||||
|
|
||||||
|
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/SkinTextures;cape()Lnet/minecraft/util/AssetInfo$TextureAsset;"))
|
||||||
|
private AssetInfo.TextureAsset modifyCapeTexture(AssetInfo.TextureAsset original, MatrixStack matrices, OrderedRenderCommandQueue entityRenderCommandQueue, int i, PlayerEntityRenderState state, float f, float g) {
|
||||||
|
Capes capes = ModuleManager.INSTANCE.getModuleByClass(Capes.class);
|
||||||
|
if (!capes.isEnabled()) return original;
|
||||||
|
|
||||||
|
Identifier id = capes.cape.getValue().getId();
|
||||||
|
return id == null ? original : new AssetInfo.TextureAssetInfo(id, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,17 +22,17 @@ public class ChatHudLineMixin implements IChatHudLine {
|
|||||||
private GameProfile sender;
|
private GameProfile sender;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String smegma$getText() { return content.toString(); }
|
public String sputnik$getText() { return content.toString(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int smegma$getId() { return id; }
|
public int sputnik$getId() { return id; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$setId(int id) { this.id = id; }
|
public void sputnik$setId(int id) { this.id = id; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameProfile smegma$getSender() { return sender; }
|
public GameProfile sputnik$getSender() { return sender; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$setSender(GameProfile profile) { this.sender = profile; }
|
public void sputnik$setSender(GameProfile profile) { this.sender = profile; }
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ public class ChatHudLineVisibleMixin implements IChatHudLineVisible {
|
|||||||
private boolean startOfEntry;
|
private boolean startOfEntry;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String smegma$getText() {
|
public String sputnik$getText() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
content.accept((index, style, codePoint) -> {
|
content.accept((index, style, codePoint) -> {
|
||||||
@@ -36,20 +36,20 @@ public class ChatHudLineVisibleMixin implements IChatHudLineVisible {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int smegma$getId() { return id; }
|
public int sputnik$getId() { return id; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$setId(int id) { this.id = id; }
|
public void sputnik$setId(int id) { this.id = id; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameProfile smegma$getSender() { return sender; }
|
public GameProfile sputnik$getSender() { return sender; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$setSender(GameProfile profile) { this.sender = profile; }
|
public void sputnik$setSender(GameProfile profile) { this.sender = profile; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean smegma$isStartOfEntry() { return startOfEntry; }
|
public boolean sputnik$isStartOfEntry() { return startOfEntry; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$setStartOfEntry(boolean start) { this.startOfEntry = start; }
|
public void sputnik$setStartOfEntry(boolean start) { this.startOfEntry = start; }
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ public abstract class ChatHudMixin implements IChatHud {
|
|||||||
// métodos relacionados a las interfaces IChatHud, IChatHudLine, IChadHudLineVisible y IMessageHandler
|
// métodos relacionados a las interfaces IChatHud, IChatHudLine, IChadHudLineVisible y IMessageHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$add(Text message, int id) {
|
public void sputnik$add(Text message, int id) {
|
||||||
nextId = id;
|
nextId = id;
|
||||||
addMessage(message);
|
addMessage(message);
|
||||||
nextId = 0;
|
nextId = 0;
|
||||||
@@ -70,12 +70,12 @@ public abstract class ChatHudMixin implements IChatHud {
|
|||||||
|
|
||||||
@Inject(method = "addVisibleMessage", at = @At(value = "INVOKE", target = "Ljava/util/List;addFirst(Ljava/lang/Object;)V", shift = At.Shift.AFTER))
|
@Inject(method = "addVisibleMessage", at = @At(value = "INVOKE", target = "Ljava/util/List;addFirst(Ljava/lang/Object;)V", shift = At.Shift.AFTER))
|
||||||
private void onAddMessageAfterNewChatHudLineVisible(ChatHudLine message, CallbackInfo ci) {
|
private void onAddMessageAfterNewChatHudLineVisible(ChatHudLine message, CallbackInfo ci) {
|
||||||
((IChatHudLine) (Object) visibleMessages.getFirst()).smegma$setId(nextId);
|
((IChatHudLine) (Object) visibleMessages.getFirst()).sputnik$setId(nextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "addMessage(Lnet/minecraft/client/gui/hud/ChatHudLine;)V", at = @At(value = "INVOKE", target = "Ljava/util/List;addFirst(Ljava/lang/Object;)V", shift = At.Shift.AFTER))
|
@Inject(method = "addMessage(Lnet/minecraft/client/gui/hud/ChatHudLine;)V", at = @At(value = "INVOKE", target = "Ljava/util/List;addFirst(Ljava/lang/Object;)V", shift = At.Shift.AFTER))
|
||||||
private void onAddMessageAfterNewChatHudLine(ChatHudLine message, CallbackInfo ci) {
|
private void onAddMessageAfterNewChatHudLine(ChatHudLine message, CallbackInfo ci) {
|
||||||
((IChatHudLine) (Object) messages.getFirst()).smegma$setId(nextId);
|
((IChatHudLine) (Object) messages.getFirst()).sputnik$setId(nextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("DataFlowIssue")
|
@SuppressWarnings("DataFlowIssue")
|
||||||
@@ -86,8 +86,8 @@ public abstract class ChatHudMixin implements IChatHud {
|
|||||||
|
|
||||||
IChatHudLineVisible iLine = (IChatHudLineVisible) (Object) line;
|
IChatHudLineVisible iLine = (IChatHudLineVisible) (Object) line;
|
||||||
|
|
||||||
iLine.smegma$setSender(handler.smegma$getSender());
|
iLine.sputnik$setSender(handler.sputnik$getSender());
|
||||||
iLine.smegma$setStartOfEntry(j == 0);
|
iLine.sputnik$setStartOfEntry(j == 0);
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
@@ -97,12 +97,12 @@ public abstract class ChatHudMixin implements IChatHud {
|
|||||||
IMessageHandler handler = (IMessageHandler) mc.getMessageHandler();
|
IMessageHandler handler = (IMessageHandler) mc.getMessageHandler();
|
||||||
if (handler == null) return line;
|
if (handler == null) return line;
|
||||||
|
|
||||||
((IChatHudLine) (Object) line).smegma$setSender(handler.smegma$getSender());
|
((IChatHudLine) (Object) line).sputnik$setSender(handler.sputnik$getSender());
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ChatHudLine.Visible> smegma$getVisibleMessages() {
|
public List<ChatHudLine.Visible> sputnik$getVisibleMessages() {
|
||||||
return visibleMessages;
|
return visibleMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,10 +118,10 @@ public abstract class ChatHudMixin implements IChatHud {
|
|||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
} else {
|
} else {
|
||||||
visibleMessages.removeIf(msg -> ((IChatHudLine) (Object) msg).smegma$getId() == nextId && nextId != 0);
|
visibleMessages.removeIf(msg -> ((IChatHudLine) (Object) msg).sputnik$getId() == nextId && nextId != 0);
|
||||||
|
|
||||||
for (int i = messages.size() - 1; i > -1; i--) {
|
for (int i = messages.size() - 1; i > -1; i--) {
|
||||||
if (((IChatHudLine) (Object) messages.get(i)).smegma$getId() == nextId && nextId != 0) {
|
if (((IChatHudLine) (Object) messages.get(i)).sputnik$getId() == nextId && nextId != 0) {
|
||||||
messages.remove(i);
|
messages.remove(i);
|
||||||
chatPlus.removeLine(i);
|
chatPlus.removeLine(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class ClientCommonNetworkHandlerMixin {
|
|||||||
if (!bypassPack.isEnabled()) return;
|
if (!bypassPack.isEnabled()) return;
|
||||||
|
|
||||||
final Screen screen = cir.getReturnValue();
|
final Screen screen = cir.getReturnValue();
|
||||||
((IConfirmScreen) screen).smegma$setBypassAction(() -> {
|
((IConfirmScreen) screen).sputnik$setBypassAction(() -> {
|
||||||
client.setScreen(((ConfirmServerResourcePackScreenAccessor) screen).getParentScreen());
|
client.setScreen(((ConfirmServerResourcePackScreenAccessor) screen).getParentScreen());
|
||||||
if (this.serverInfo != null) {
|
if (this.serverInfo != null) {
|
||||||
this.serverInfo.setResourcePackPolicy(bypassPack.getPolicy());
|
this.serverInfo.setResourcePackPolicy(bypassPack.getPolicy());
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public abstract class ConfirmScreenMixin extends Screen implements IConfirmScree
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$setBypassAction(Runnable bypass) {
|
public void sputnik$setBypassAction(Runnable bypass) {
|
||||||
this.bypassAction = bypass;
|
this.bypassAction = bypass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package me.retucio.sputnik.mixin;
|
||||||
|
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
|
import me.retucio.sputnik.module.modules.player.Capes;
|
||||||
|
import net.minecraft.client.render.command.OrderedRenderCommandQueue;
|
||||||
|
import net.minecraft.client.render.entity.feature.ElytraFeatureRenderer;
|
||||||
|
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||||
|
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
||||||
|
import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
|
import net.minecraft.client.render.entity.state.BipedEntityRenderState;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(ElytraFeatureRenderer.class)
|
||||||
|
public abstract class ElytraFeatureRendererMixin<S extends BipedEntityRenderState, M extends EntityModel<S>> extends FeatureRenderer<S, M> {
|
||||||
|
|
||||||
|
public ElytraFeatureRendererMixin(FeatureRendererContext<S, M> context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/client/render/entity/state/BipedEntityRenderState;FF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/feature/ElytraFeatureRenderer;getTexture(Lnet/minecraft/client/render/entity/state/BipedEntityRenderState;)Lnet/minecraft/util/Identifier;"))
|
||||||
|
private Identifier modifyCapeTexture(Identifier original, MatrixStack matrices, OrderedRenderCommandQueue entityRenderCommandQueue, int i, S state, float f, float g) {
|
||||||
|
Capes capes = ModuleManager.INSTANCE.getModuleByClass(Capes.class);
|
||||||
|
if (!capes.isEnabled()) return original;
|
||||||
|
|
||||||
|
Identifier id = capes.cape.getValue().getId();
|
||||||
|
return id == null ? original : id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -84,7 +84,7 @@ public abstract class GameRendererMixin {
|
|||||||
float lastYaw = cameraEntity.lastYaw;
|
float lastYaw = cameraEntity.lastYaw;
|
||||||
float lastPitch = cameraEntity.lastPitch;
|
float lastPitch = cameraEntity.lastPitch;
|
||||||
|
|
||||||
((IVec3d) cameraEntity.getEntityPos()).smegma$set(pos.x, pos.y - cameraEntity.getEyeHeight(cameraEntity.getPose()), pos.z);
|
((IVec3d) cameraEntity.getEntityPos()).sputnik$set(pos.x, pos.y - cameraEntity.getEyeHeight(cameraEntity.getPose()), pos.z);
|
||||||
cameraEntity.lastX = prevPos.x;
|
cameraEntity.lastX = prevPos.x;
|
||||||
cameraEntity.lastY = prevPos.y - cameraEntity.getEyeHeight(cameraEntity.getPose());
|
cameraEntity.lastY = prevPos.y - cameraEntity.getEyeHeight(cameraEntity.getPose());
|
||||||
cameraEntity.lastZ = prevPos.z;
|
cameraEntity.lastZ = prevPos.z;
|
||||||
@@ -97,7 +97,7 @@ public abstract class GameRendererMixin {
|
|||||||
updateCrosshairTarget(tickDelta);
|
updateCrosshairTarget(tickDelta);
|
||||||
freecamDone = false;
|
freecamDone = false;
|
||||||
|
|
||||||
((IVec3d) cameraEntity.getEntityPos()).smegma$set(x, y, z);
|
((IVec3d) cameraEntity.getEntityPos()).sputnik$set(x, y, z);
|
||||||
cameraEntity.lastX = lastX;
|
cameraEntity.lastX = lastX;
|
||||||
cameraEntity.lastY = lastY;
|
cameraEntity.lastY = lastY;
|
||||||
cameraEntity.lastZ = lastZ;
|
cameraEntity.lastZ = lastZ;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.mixin;
|
package me.retucio.sputnik.mixin;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.events.KeyEvent;
|
import me.retucio.sputnik.event.events.KeyEvent;
|
||||||
import net.minecraft.client.Keyboard;
|
import net.minecraft.client.Keyboard;
|
||||||
import net.minecraft.client.input.KeyInput;
|
import net.minecraft.client.input.KeyInput;
|
||||||
@@ -16,7 +17,7 @@ public abstract class KeyboardMixin {
|
|||||||
@Inject(method = "onKey", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onKey", at = @At("HEAD"), cancellable = true)
|
||||||
private void onKeyPress(long window, int action, KeyInput input, CallbackInfo ci) {
|
private void onKeyPress(long window, int action, KeyInput input, CallbackInfo ci) {
|
||||||
if (input.key() == -1) return;
|
if (input.key() == -1) return;
|
||||||
me.retucio.sputnik.Sputnik.INSTANCE.onKey(input.key(), action);
|
Sputnik.INSTANCE.onKey(input.key(), action);
|
||||||
KeyEvent event = EVENT_BUS.post(new KeyEvent(input.key(), input.scancode(), action));
|
KeyEvent event = EVENT_BUS.post(new KeyEvent(input.key(), input.scancode(), action));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public abstract class MessageHandlerMixin implements IMessageHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameProfile smegma$getSender() {
|
public GameProfile sputnik$getSender() {
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package me.retucio.sputnik.mixin;
|
package me.retucio.sputnik.mixin;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.sugar.Local;
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
import me.retucio.sputnik.event.JoinWorldEvent;
|
import me.retucio.sputnik.Sputnik;
|
||||||
|
import me.retucio.sputnik.event.events.JoinWorldEvent;
|
||||||
import me.retucio.sputnik.event.events.OpenScreenEvent;
|
import me.retucio.sputnik.event.events.OpenScreenEvent;
|
||||||
import me.retucio.sputnik.event.events.ShutdownEvent;
|
import me.retucio.sputnik.event.events.ShutdownEvent;
|
||||||
import me.retucio.sputnik.event.events.TickEvent;
|
import me.retucio.sputnik.event.events.TickEvent;
|
||||||
@@ -20,8 +21,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
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 static me.retucio.sputnik.Sputnik.EVENT_BUS;
|
|
||||||
import static me.retucio.sputnik.Sputnik.mc;
|
|
||||||
|
|
||||||
@Mixin(MinecraftClient.class)
|
@Mixin(MinecraftClient.class)
|
||||||
public abstract class MinecraftClientMixin {
|
public abstract class MinecraftClientMixin {
|
||||||
@@ -31,23 +30,23 @@ public abstract class MinecraftClientMixin {
|
|||||||
|
|
||||||
@Inject(method = "tick", at = @At("HEAD"))
|
@Inject(method = "tick", at = @At("HEAD"))
|
||||||
private void onTickPre(CallbackInfo ci) {
|
private void onTickPre(CallbackInfo ci) {
|
||||||
me.retucio.sputnik.Sputnik.INSTANCE.onTick();
|
Sputnik.INSTANCE.onTick();
|
||||||
EVENT_BUS.post(new TickEvent.Pre());
|
Sputnik.EVENT_BUS.post(new TickEvent.Pre());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "tick", at = @At("TAIL"))
|
@Inject(method = "tick", at = @At("TAIL"))
|
||||||
private void onTickPost(CallbackInfo ci) {
|
private void onTickPost(CallbackInfo ci) {
|
||||||
EVENT_BUS.post(new TickEvent.Post());
|
Sputnik.EVENT_BUS.post(new TickEvent.Post());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "stop", at = @At("HEAD"))
|
@Inject(method = "stop", at = @At("HEAD"))
|
||||||
private void onStop(CallbackInfo ci) {
|
private void onStop(CallbackInfo ci) {
|
||||||
EVENT_BUS.post(new ShutdownEvent());
|
Sputnik.EVENT_BUS.post(new ShutdownEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "setScreen", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "setScreen", at = @At("HEAD"), cancellable = true)
|
||||||
private void onOpenScreen(Screen screen, CallbackInfo ci) {
|
private void onOpenScreen(Screen screen, CallbackInfo ci) {
|
||||||
OpenScreenEvent event = EVENT_BUS.post(new OpenScreenEvent(screen));
|
OpenScreenEvent event = Sputnik.EVENT_BUS.post(new OpenScreenEvent(screen));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,8 +57,8 @@ public abstract class MinecraftClientMixin {
|
|||||||
|
|
||||||
@Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;"), cancellable = true)
|
@Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;"), cancellable = true)
|
||||||
private void onUseItem(CallbackInfo ci, @Local Hand hand) {
|
private void onUseItem(CallbackInfo ci, @Local Hand hand) {
|
||||||
if (mc.player == null) return;
|
if (Sputnik.mc.player == null) return;
|
||||||
UseItemEvent event = EVENT_BUS.post(new UseItemEvent(mc.player.getStackInHand(hand), hand));
|
UseItemEvent event = Sputnik.EVENT_BUS.post(new UseItemEvent(Sputnik.mc.player.getStackInHand(hand), hand));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@ public abstract class MinecraftClientMixin {
|
|||||||
|
|
||||||
@Inject(method = "joinWorld", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "joinWorld", at = @At("HEAD"), cancellable = true)
|
||||||
private void onJoinWorld(ClientWorld world, CallbackInfo ci) {
|
private void onJoinWorld(ClientWorld world, CallbackInfo ci) {
|
||||||
JoinWorldEvent event = EVENT_BUS.post(new JoinWorldEvent(world));
|
JoinWorldEvent event = Sputnik.EVENT_BUS.post(new JoinWorldEvent(world));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package me.retucio.sputnik.mixin;
|
package me.retucio.sputnik.mixin;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.events.ClipAtLedgeEvent;
|
import me.retucio.sputnik.event.events.ClipAtLedgeEvent;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.render.Nametags;
|
import me.retucio.sputnik.module.modules.render.Nametags;
|
||||||
@@ -56,7 +57,7 @@ public abstract class PlayerEntityMixin extends LivingEntity {
|
|||||||
@Inject(method = "clipAtLedge", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "clipAtLedge", at = @At("HEAD"), cancellable = true)
|
||||||
private void clipAtLedge(CallbackInfoReturnable<Boolean> cir) {
|
private void clipAtLedge(CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (!getEntityWorld().isClient()) return;
|
if (!getEntityWorld().isClient()) return;
|
||||||
ClipAtLedgeEvent event = me.retucio.sputnik.Sputnik.EVENT_BUS.post(new ClipAtLedgeEvent(isSneaking()));
|
ClipAtLedgeEvent event = Sputnik.EVENT_BUS.post(new ClipAtLedgeEvent(isSneaking()));
|
||||||
cir.setReturnValue(event.isClipping());
|
cir.setReturnValue(event.isClipping());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,20 +20,20 @@ public abstract class Vec3dMixin implements IVec3d {
|
|||||||
public double z;
|
public double z;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$set(double x, double y, double z) {
|
public void sputnik$set(double x, double y, double z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$setXZ(double x, double z) {
|
public void sputnik$setXZ(double x, double z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void smegma$setY(double y) {
|
public void sputnik$setY(double y) {
|
||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package me.retucio.sputnik.mixin;
|
|||||||
|
|
||||||
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.event.events.RenderWorldEvent;
|
import me.retucio.sputnik.event.events.RenderWorldEvent;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
import me.retucio.sputnik.module.modules.render.BlockOutline;
|
import me.retucio.sputnik.module.modules.render.BlockOutline;
|
||||||
@@ -45,7 +46,7 @@ public abstract class WorldRendererMixin {
|
|||||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch()));
|
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(camera.getPitch()));
|
||||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180f));
|
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw() + 180f));
|
||||||
|
|
||||||
profiler.push(me.retucio.sputnik.Sputnik.MOD_ID + "-3d");
|
profiler.push(Sputnik.MOD_ID + "-3d");
|
||||||
EVENT_BUS.post(new RenderWorldEvent(matrices, tickCounter, camera));
|
EVENT_BUS.post(new RenderWorldEvent(matrices, tickCounter, camera));
|
||||||
|
|
||||||
profiler.pop();
|
profiler.pop();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.module;
|
package me.retucio.sputnik.module;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.config.ConfigManager;
|
import me.retucio.sputnik.config.ConfigManager;
|
||||||
import me.retucio.sputnik.event.SubscribeEvent;
|
import me.retucio.sputnik.event.SubscribeEvent;
|
||||||
import me.retucio.sputnik.event.events.sputnik.ToggleModuleEvent;
|
import me.retucio.sputnik.event.events.sputnik.ToggleModuleEvent;
|
||||||
@@ -78,24 +79,24 @@ public class Module {
|
|||||||
enabled = !enabled;
|
enabled = !enabled;
|
||||||
if (enabled) onEnable();
|
if (enabled) onEnable();
|
||||||
else onDisable();
|
else onDisable();
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new ToggleModuleEvent(this));
|
Sputnik.EVENT_BUS.post(new ToggleModuleEvent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
if (notify.isEnabled()) ChatUtil.info(getName() + " fue activado");
|
if (notify.isEnabled()) 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)) {
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.register(this);
|
Sputnik.EVENT_BUS.register(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new ToggleModuleEvent(this));
|
Sputnik.EVENT_BUS.post(new ToggleModuleEvent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
if (notify.isEnabled()) ChatUtil.info(getName() + " fue desactivado");
|
if (notify.isEnabled()) ChatUtil.info(getName() + " fue desactivado");
|
||||||
if (me.retucio.sputnik.Sputnik.EVENT_BUS.isRegistered(this))
|
if (Sputnik.EVENT_BUS.isRegistered(this))
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.unregister(this);
|
Sputnik.EVENT_BUS.unregister(this);
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new ToggleModuleEvent(this));
|
Sputnik.EVENT_BUS.post(new ToggleModuleEvent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.module;
|
package me.retucio.sputnik.module;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.SubscribeEvent;
|
import me.retucio.sputnik.event.SubscribeEvent;
|
||||||
import me.retucio.sputnik.module.modules.camera.*;
|
import me.retucio.sputnik.module.modules.camera.*;
|
||||||
import me.retucio.sputnik.module.modules.client.HUD;
|
import me.retucio.sputnik.module.modules.client.HUD;
|
||||||
@@ -38,6 +39,7 @@ public class ModuleManager {
|
|||||||
modules.add(new BossbarStack());
|
modules.add(new BossbarStack());
|
||||||
modules.add(new BreakingProgress());
|
modules.add(new BreakingProgress());
|
||||||
modules.add(new BungeecordSpoofer());
|
modules.add(new BungeecordSpoofer());
|
||||||
|
modules.add(new Capes());
|
||||||
modules.add(new ChatPlus());
|
modules.add(new ChatPlus());
|
||||||
modules.add(new ColoredSigns());
|
modules.add(new ColoredSigns());
|
||||||
modules.add(new CritsPlus());
|
modules.add(new CritsPlus());
|
||||||
@@ -80,7 +82,7 @@ public class ModuleManager {
|
|||||||
for (Module module : getEnabledModules()) {
|
for (Module module : getEnabledModules()) {
|
||||||
for (Method method : module.getClass().getDeclaredMethods()) {
|
for (Method method : module.getClass().getDeclaredMethods()) {
|
||||||
if (method.isAnnotationPresent(SubscribeEvent.class)) {
|
if (method.isAnnotationPresent(SubscribeEvent.class)) {
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.register(module);
|
Sputnik.EVENT_BUS.register(module);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class ChatPlus extends Module {
|
|||||||
if (!isEnabled() || !showHeads.isEnabled()) return;
|
if (!isEnabled() || !showHeads.isEnabled()) return;
|
||||||
|
|
||||||
// dibujar la cabeza al principio del mensaje
|
// dibujar la cabeza al principio del mensaje
|
||||||
if (((IChatHudLineVisible) (Object) line).smegma$isStartOfEntry())
|
if (((IChatHudLineVisible) (Object) line).sputnik$isStartOfEntry())
|
||||||
drawTexture(context, (IChatHudLine) (Object) line, y, color);
|
drawTexture(context, (IChatHudLine) (Object) line, y, color);
|
||||||
|
|
||||||
context.getMatrices().pushMatrix();
|
context.getMatrices().pushMatrix();
|
||||||
@@ -142,7 +142,7 @@ public class ChatPlus extends Module {
|
|||||||
|
|
||||||
@SuppressWarnings("DataFlowIssue")
|
@SuppressWarnings("DataFlowIssue")
|
||||||
private void drawTexture(DrawContext context, IChatHudLine line, int y, int color) {
|
private void drawTexture(DrawContext context, IChatHudLine line, int y, int color) {
|
||||||
String text = line.smegma$getText().trim();
|
String text = line.sputnik$getText().trim();
|
||||||
|
|
||||||
int startOffset = 0;
|
int startOffset = 0;
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ public class ChatPlus extends Module {
|
|||||||
@SuppressWarnings("DataFlowIssue")
|
@SuppressWarnings("DataFlowIssue")
|
||||||
private GameProfile getSender(IChatHudLine line, String text) {
|
private GameProfile getSender(IChatHudLine line, String text) {
|
||||||
// obtener el jugador que envió un mensaje
|
// obtener el jugador que envió un mensaje
|
||||||
GameProfile sender = line.smegma$getSender();
|
GameProfile sender = line.sputnik$getSender();
|
||||||
|
|
||||||
if (sender == null) {
|
if (sender == null) {
|
||||||
Matcher usernameMatcher = usernameRegex.matcher(text);
|
Matcher usernameMatcher = usernameRegex.matcher(text);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package me.retucio.sputnik.module.modules.network;
|
package me.retucio.sputnik.module.modules.network;
|
||||||
|
|
||||||
import me.retucio.sputnik.event.JoinWorldEvent;
|
import me.retucio.sputnik.event.events.JoinWorldEvent;
|
||||||
import me.retucio.sputnik.event.SubscribeEvent;
|
import me.retucio.sputnik.event.SubscribeEvent;
|
||||||
import me.retucio.sputnik.event.events.PacketEvent;
|
import me.retucio.sputnik.event.events.PacketEvent;
|
||||||
import me.retucio.sputnik.module.Category;
|
import me.retucio.sputnik.module.Category;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package me.retucio.sputnik.module.modules.player;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.cape.Cape;
|
||||||
|
import me.retucio.sputnik.cape.CapeManager;
|
||||||
|
import me.retucio.sputnik.module.Category;
|
||||||
|
import me.retucio.sputnik.module.Module;
|
||||||
|
import me.retucio.sputnik.module.settings.OptionSetting;
|
||||||
|
|
||||||
|
public class Capes extends Module {
|
||||||
|
|
||||||
|
public OptionSetting<Cape> cape = addSetting(new OptionSetting<>("capa", "qué capa llevar puesta",
|
||||||
|
CapeManager.INSTANCE.getCapes(), CapeManager.INSTANCE.getCape("hollow-knight")));
|
||||||
|
|
||||||
|
public Capes() {
|
||||||
|
super("capas", "elige qué capa llevar (solo visible para ti)", Category.PLAYER);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ public class UIMove extends Module {
|
|||||||
private final ScreenHandlerType<?> inventoryHandlerType = ScreenHandlerType.register(
|
private final ScreenHandlerType<?> inventoryHandlerType = ScreenHandlerType.register(
|
||||||
"player_inventory", GenericContainerScreenHandler::createGeneric9x3);
|
"player_inventory", GenericContainerScreenHandler::createGeneric9x3);
|
||||||
private final ScreenHandlerType<?> clickGuiHandlerType = ScreenHandlerType.register(
|
private final ScreenHandlerType<?> clickGuiHandlerType = ScreenHandlerType.register(
|
||||||
"camtweaks_clickgui", GenericContainerScreenHandler::createGeneric9x3); // 9x3 porque no importa (creo)
|
"sputnik_clickgui", GenericContainerScreenHandler::createGeneric9x3); // 9x3 porque no importa (creo)
|
||||||
|
|
||||||
public UIMove() {
|
public UIMove() {
|
||||||
super("moverse en interfaz",
|
super("moverse en interfaz",
|
||||||
|
|||||||
@@ -270,8 +270,8 @@ public class ColorSetting extends Setting {
|
|||||||
map.put("a", a);
|
map.put("a", a);
|
||||||
map.put("rb", rainbow);
|
map.put("rb", rainbow);
|
||||||
map.put("rs", rainbowSpeed);
|
map.put("rs", rainbowSpeed);
|
||||||
map.put("sat", saturation);
|
map.put("sat", (double) saturation);
|
||||||
map.put("bri", brightness);
|
map.put("bri", (double) brightness);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,15 @@
|
|||||||
package me.retucio.sputnik.module.settings;
|
package me.retucio.sputnik.module.settings;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
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{
|
||||||
|
|
||||||
List<T> options = new ArrayList<>();
|
private final List<T> options;
|
||||||
Map<T, String> displayNames;
|
private Map<T, String> displayNames;
|
||||||
T option;
|
private T option;
|
||||||
T defaultOption;
|
private final T defaultOption;
|
||||||
|
|
||||||
private Consumer<T> updateListener;
|
private Consumer<T> updateListener;
|
||||||
|
|
||||||
@@ -39,6 +38,20 @@ public class OptionSetting<T> extends Setting{
|
|||||||
if (updateListener != null) updateListener.accept(option);
|
if (updateListener != null) updateListener.accept(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setValueByName(String name) {
|
||||||
|
for (T opt : options) {
|
||||||
|
if (displayNames != null && !displayNames.isEmpty()) {
|
||||||
|
if (displayNames.get(opt).equals(name)) {
|
||||||
|
setValue(opt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (opt.toString().equals(name)) {
|
||||||
|
setValue(opt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<T> getOptions() {
|
public List<T> getOptions() {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
@@ -64,6 +77,10 @@ public class OptionSetting<T> extends Setting{
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index) {
|
||||||
|
setValue(getOption(index));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean is(T option) {
|
public boolean is(T option) {
|
||||||
return getValue() == option;
|
return getValue() == option;
|
||||||
}
|
}
|
||||||
@@ -94,4 +111,8 @@ public class OptionSetting<T> extends Setting{
|
|||||||
if (displayNames != null) return displayNames.get(key);
|
if (displayNames != null) return displayNames.get(key);
|
||||||
return key.toString();
|
return key.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDisplayName() {
|
||||||
|
return getDisplayName(option);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.module.settings;
|
package me.retucio.sputnik.module.settings;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
@@ -52,6 +53,6 @@ public abstract class Setting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void fireUpdateEvent() {
|
public void fireUpdateEvent() {
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new UpdateSettingEvent(this, module.shouldSaveSettings()));
|
Sputnik.EVENT_BUS.post(new UpdateSettingEvent(this, module.shouldSaveSettings()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.ui.hud;
|
package me.retucio.sputnik.ui.hud;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.module.modules.client.HUD;
|
import me.retucio.sputnik.module.modules.client.HUD;
|
||||||
import me.retucio.sputnik.util.Colors;
|
import me.retucio.sputnik.util.Colors;
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ public abstract class ImageHudElement extends HudElement {
|
|||||||
|
|
||||||
public ImageHudElement(String id, int defaultX, int defaultY) {
|
public ImageHudElement(String id, int defaultX, int defaultY) {
|
||||||
super(id, defaultX, defaultY);
|
super(id, defaultX, defaultY);
|
||||||
this.textureId = Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, "textures/" + id);
|
this.textureId = Identifier.of(Sputnik.MOD_ID, "textures/" + id);
|
||||||
this.w = imageWidth;
|
this.w = imageWidth;
|
||||||
this.h = imageHeight;
|
this.h = imageHeight;
|
||||||
}
|
}
|
||||||
@@ -36,7 +37,7 @@ public abstract class ImageHudElement extends HudElement {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// cargar
|
// cargar
|
||||||
Identifier resourceId = Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, imagePath);
|
Identifier resourceId = Identifier.of(Sputnik.MOD_ID, imagePath);
|
||||||
try (InputStream stream = mc.getResourceManager().getResource(resourceId).get().getInputStream()) {
|
try (InputStream stream = mc.getResourceManager().getResource(resourceId).get().getInputStream()) {
|
||||||
NativeImage image = NativeImage.read(stream);
|
NativeImage image = NativeImage.read(stream);
|
||||||
|
|
||||||
@@ -57,10 +58,10 @@ public abstract class ImageHudElement extends HudElement {
|
|||||||
mc.getTextureManager().registerTexture(textureId, texture);
|
mc.getTextureManager().registerTexture(textureId, texture);
|
||||||
textureLoaded = true;
|
textureLoaded = true;
|
||||||
|
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.info("textura para el elemento del HUD {} cargada", getId());
|
Sputnik.LOGGER.info("textura para el elemento del HUD {} cargada", getId());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
me.retucio.sputnik.Sputnik.LOGGER.error("no se pudo cargar la textura para el elemento del HUD {}: {}", getId(), e.getMessage());
|
Sputnik.LOGGER.error("no se pudo cargar la textura para el elemento del HUD {}: {}", getId(), e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.ui.screen;
|
package me.retucio.sputnik.ui.screen;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.SubscribeEvent;
|
import me.retucio.sputnik.event.SubscribeEvent;
|
||||||
import me.retucio.sputnik.event.events.KeyEvent;
|
import me.retucio.sputnik.event.events.KeyEvent;
|
||||||
import me.retucio.sputnik.event.events.MouseClickEvent;
|
import me.retucio.sputnik.event.events.MouseClickEvent;
|
||||||
@@ -57,7 +58,7 @@ public class ClickGUI extends Screen {
|
|||||||
public ClickGUI() {
|
public ClickGUI() {
|
||||||
super(Text.of("interfaz"));
|
super(Text.of("interfaz"));
|
||||||
settingsFrames.add(guiSettingsFrame);
|
settingsFrames.add(guiSettingsFrame);
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.register(this);
|
Sputnik.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -179,9 +180,9 @@ public class ClickGUI extends Screen {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onMouseMiddleButton(MouseClickEvent event) {
|
public void onMouseMiddleButton(MouseClickEvent event) {
|
||||||
// mover todos los marcos a un punto visible al presionar shift + la rueda del ratón
|
// mover todos los marcos a un punto visible al presionar shift + la rueda del ratón
|
||||||
if (me.retucio.sputnik.Sputnik.mc.currentScreen != this || event.getButton() != 2 || !KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) return;
|
if (Sputnik.mc.currentScreen != this || event.getButton() != 2 || !KeyUtil.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) return;
|
||||||
|
|
||||||
int h = me.retucio.sputnik.Sputnik.mc.getWindow().getScaledHeight();
|
int h = Sputnik.mc.getWindow().getScaledHeight();
|
||||||
int minY = Math.min(modulesFrame.getY(), settingsFrames.stream().mapToInt(Frame::getY).min().orElse(modulesFrame.getY()));
|
int minY = Math.min(modulesFrame.getY(), settingsFrames.stream().mapToInt(Frame::getY).min().orElse(modulesFrame.getY()));
|
||||||
int maxY = Math.max(modulesFrame.getY() + modulesFrame.getH(), settingsFrames.stream().mapToInt(sf -> sf.getY() + sf.getH()).max().orElse(modulesFrame.getY() + modulesFrame.getH()));
|
int maxY = Math.max(modulesFrame.getY() + modulesFrame.getH(), settingsFrames.stream().mapToInt(sf -> sf.getY() + sf.getH()).max().orElse(modulesFrame.getY() + modulesFrame.getH()));
|
||||||
int correction = minY < 0 ? -minY + 4 : (maxY > h ? h - maxY - 4 : 0);
|
int correction = minY < 0 ? -minY + 4 : (maxY > h ? h - maxY - 4 : 0);
|
||||||
@@ -247,10 +248,18 @@ public class ClickGUI extends Screen {
|
|||||||
|
|
||||||
// abrir un marco donde se encuentran los ajustes del módulo deseado
|
// abrir un marco donde se encuentran los ajustes del módulo deseado
|
||||||
public void openSettingsFrame(Module module, int x, int y) {
|
public void openSettingsFrame(Module module, int x, int y) {
|
||||||
if (isSettingsFrameOpen(module)) return; // permitir un solo marco de ajustes por módulo
|
for (SettingsFrame frame : settingsFrames) {
|
||||||
SettingsFrame frame = new SettingsFrame(module, x, y, 120, 20);
|
if (frame.module == module) {
|
||||||
|
frame.setX(x);
|
||||||
|
frame.setY(y);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsFrame frame = new SettingsFrame(module, x, y, 100, 20);
|
||||||
settingsFrames.add(frame);
|
settingsFrames.add(frame);
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new SettingsFrameEvent.Open(frame));
|
|
||||||
|
Sputnik.EVENT_BUS.post(new SettingsFrameEvent.Open(frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
// abrir un marco de ajustes específicamente para ajustes de selección múltiple
|
// abrir un marco de ajustes específicamente para ajustes de selección múltiple
|
||||||
@@ -268,7 +277,7 @@ public class ClickGUI extends Screen {
|
|||||||
if ((sf instanceof ColorPickerFrame cpf && cpf.dummyModule == module) // para los selectores de colores
|
if ((sf instanceof ColorPickerFrame cpf && cpf.dummyModule == module) // para los selectores de colores
|
||||||
|| (!(sf instanceof ColorPickerFrame) && sf.module == module)) { // lógica muy mierdas, lo sé, pero paso de hacerlo bien
|
|| (!(sf instanceof ColorPickerFrame) && sf.module == module)) { // lógica muy mierdas, lo sé, pero paso de hacerlo bien
|
||||||
toRemove.add(sf);
|
toRemove.add(sf);
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new SettingsFrameEvent.Close(sf));
|
Sputnik.EVENT_BUS.post(new SettingsFrameEvent.Close(sf));
|
||||||
unselect(sf);
|
unselect(sf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.ui.screen;
|
package me.retucio.sputnik.ui.screen;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.module.modules.misc.ShulkerPeek;
|
import me.retucio.sputnik.module.modules.misc.ShulkerPeek;
|
||||||
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||||
import me.retucio.sputnik.util.Colors;
|
import me.retucio.sputnik.util.Colors;
|
||||||
@@ -19,7 +20,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class PreviewScreen extends Screen {
|
public class PreviewScreen extends Screen {
|
||||||
|
|
||||||
private static final Identifier TEXTURE = Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, "textures/gui/preview.png");
|
private static final Identifier TEXTURE = Identifier.of(Sputnik.MOD_ID, "textures/gui/preview.png");
|
||||||
|
|
||||||
private int x, y;
|
private int x, y;
|
||||||
private final int bgWidth = 176;
|
private final int bgWidth = 176;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.ui.widgets.frames;
|
package me.retucio.sputnik.ui.widgets.frames;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.events.sputnik.ModuleFrameEvent;
|
import me.retucio.sputnik.event.events.sputnik.ModuleFrameEvent;
|
||||||
import me.retucio.sputnik.module.Module;
|
import me.retucio.sputnik.module.Module;
|
||||||
import me.retucio.sputnik.module.ModuleManager;
|
import me.retucio.sputnik.module.ModuleManager;
|
||||||
@@ -101,7 +102,7 @@ public class ModuleFrame extends Frame<ModuleButton> {
|
|||||||
dragY = mouseY - y;
|
dragY = mouseY - y;
|
||||||
} else if (button == 1) { // clic derecho para extenderlo
|
} else if (button == 1) { // clic derecho para extenderlo
|
||||||
extended = !extended;
|
extended = !extended;
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new ModuleFrameEvent.Extend());
|
Sputnik.EVENT_BUS.post(new ModuleFrameEvent.Extend());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ public class ModuleFrame extends Frame<ModuleButton> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isHovered(mouseX, mouseY))
|
if (isHovered(mouseX, mouseY))
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new ModuleFrameEvent.Move());
|
Sputnik.EVENT_BUS.post(new ModuleFrameEvent.Move());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.ui.widgets.frames;
|
package me.retucio.sputnik.ui.widgets.frames;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.events.sputnik.SettingsFrameEvent;
|
import me.retucio.sputnik.event.events.sputnik.SettingsFrameEvent;
|
||||||
import me.retucio.sputnik.module.Module;
|
import me.retucio.sputnik.module.Module;
|
||||||
import me.retucio.sputnik.module.settings.*;
|
import me.retucio.sputnik.module.settings.*;
|
||||||
@@ -130,7 +131,9 @@ public class SettingsFrame extends Frame<SettingButton<? extends Setting>> {
|
|||||||
super.mouseReleased(mouseX, mouseY, button);
|
super.mouseReleased(mouseX, mouseY, button);
|
||||||
if (button == 0) {
|
if (button == 0) {
|
||||||
dragging = false;
|
dragging = false;
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new SettingsFrameEvent.Move(this));
|
|
||||||
|
if (isHovered(mouseX, mouseY))
|
||||||
|
Sputnik.EVENT_BUS.post(new SettingsFrameEvent.Move(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SettingButton<?> sb : visibleButtons)
|
for (SettingButton<?> sb : visibleButtons)
|
||||||
@@ -143,9 +146,6 @@ public class SettingsFrame extends Frame<SettingButton<? extends Setting>> {
|
|||||||
sb.mouseDragged(mouseX, mouseY);
|
sb.mouseDragged(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onKey(int key, int action) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateWidth() {
|
public void updateWidth() {
|
||||||
// asegurarse de que todos los botones caben en el marco, haciendo que la anchura se ajuste al texto más largo
|
// asegurarse de que todos los botones caben en el marco, haciendo que la anchura se ajuste al texto más largo
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.ui.widgets.frames.settings;
|
package me.retucio.sputnik.ui.widgets.frames.settings;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.events.sputnik.GUISettingsFrameEvent;
|
import me.retucio.sputnik.event.events.sputnik.GUISettingsFrameEvent;
|
||||||
import me.retucio.sputnik.module.modules.client.GUI;
|
import me.retucio.sputnik.module.modules.client.GUI;
|
||||||
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
|
import me.retucio.sputnik.ui.widgets.frames.SettingsFrame;
|
||||||
@@ -65,7 +66,7 @@ public class ClientSettingsFrame extends SettingsFrame {
|
|||||||
dragY = mouseY - y;
|
dragY = mouseY - y;
|
||||||
} else if (button == 1) {
|
} else if (button == 1) {
|
||||||
extended = !extended;
|
extended = !extended;
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new GUISettingsFrameEvent.Extend());
|
Sputnik.EVENT_BUS.post(new GUISettingsFrameEvent.Extend());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +79,7 @@ public class ClientSettingsFrame extends SettingsFrame {
|
|||||||
public void mouseReleased(int mouseX, int mouseY, int button) {
|
public void mouseReleased(int mouseX, int mouseY, int button) {
|
||||||
ClickGUI.INSTANCE.unselect(this);
|
ClickGUI.INSTANCE.unselect(this);
|
||||||
if (button == 0 && dragging)
|
if (button == 0 && dragging)
|
||||||
me.retucio.sputnik.Sputnik.EVENT_BUS.post(new GUISettingsFrameEvent.Move());
|
Sputnik.EVENT_BUS.post(new GUISettingsFrameEvent.Move());
|
||||||
|
|
||||||
super.mouseReleased(mouseX, mouseY, button);
|
super.mouseReleased(mouseX, mouseY, button);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.util;
|
package me.retucio.sputnik.util;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.event.SubscribeEvent;
|
import me.retucio.sputnik.event.SubscribeEvent;
|
||||||
import me.retucio.sputnik.event.events.sputnik.LoadModuleManagerEvent;
|
import me.retucio.sputnik.event.events.sputnik.LoadModuleManagerEvent;
|
||||||
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
|
||||||
@@ -24,7 +25,7 @@ public class ChatUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addMessage(Text text) {
|
public static void addMessage(Text text) {
|
||||||
if (mc.inGameHud == null || !me.retucio.sputnik.Sputnik.settingsApplied) return;
|
if (mc.inGameHud == null || !Sputnik.settingsApplied) return;
|
||||||
mc.inGameHud.getChatHud().addMessage(text);
|
mc.inGameHud.getChatHud().addMessage(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +88,6 @@ public class ChatUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getDefaultPrefix() {
|
public static String getDefaultPrefix() {
|
||||||
return Colors.getFormatting(Colors.mainColor) + "[smegma] ";
|
return Colors.getFormatting(Colors.mainColor) + "[sputnik] ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface IChatHud {
|
public interface IChatHud {
|
||||||
|
|
||||||
void smegma$add(Text message, int id);
|
void sputnik$add(Text message, int id);
|
||||||
|
|
||||||
List<ChatHudLine.Visible> smegma$getVisibleMessages();
|
List<ChatHudLine.Visible> sputnik$getVisibleMessages();
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,11 @@ import com.mojang.authlib.GameProfile;
|
|||||||
|
|
||||||
public interface IChatHudLine {
|
public interface IChatHudLine {
|
||||||
|
|
||||||
String smegma$getText();
|
String sputnik$getText();
|
||||||
|
|
||||||
int smegma$getId();
|
int sputnik$getId();
|
||||||
void smegma$setId(int id);
|
void sputnik$setId(int id);
|
||||||
|
|
||||||
GameProfile smegma$getSender();
|
GameProfile sputnik$getSender();
|
||||||
void smegma$setSender(GameProfile profile);
|
void sputnik$setSender(GameProfile profile);
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,6 @@ package me.retucio.sputnik.util.interfaces;
|
|||||||
|
|
||||||
public interface IChatHudLineVisible extends IChatHudLine {
|
public interface IChatHudLineVisible extends IChatHudLine {
|
||||||
|
|
||||||
boolean smegma$isStartOfEntry();
|
boolean sputnik$isStartOfEntry();
|
||||||
void smegma$setStartOfEntry(boolean start);
|
void sputnik$setStartOfEntry(boolean start);
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,5 @@ package me.retucio.sputnik.util.interfaces;
|
|||||||
|
|
||||||
public interface IConfirmScreen {
|
public interface IConfirmScreen {
|
||||||
|
|
||||||
void smegma$setBypassAction(Runnable action);
|
void sputnik$setBypassAction(Runnable action);
|
||||||
}
|
}
|
||||||
@@ -4,5 +4,5 @@ import com.mojang.authlib.GameProfile;
|
|||||||
|
|
||||||
public interface IMessageHandler {
|
public interface IMessageHandler {
|
||||||
|
|
||||||
GameProfile smegma$getSender();
|
GameProfile sputnik$getSender();
|
||||||
}
|
}
|
||||||
@@ -5,10 +5,10 @@ import org.joml.Vector3d;
|
|||||||
|
|
||||||
public interface IVec3d {
|
public interface IVec3d {
|
||||||
|
|
||||||
void smegma$set(double x, double y, double z);
|
void sputnik$set(double x, double y, double z);
|
||||||
default void smegma$set(Vec3i vec) { smegma$set(vec.getX(), vec.getY(), vec.getZ()); }
|
default void sputnik$set(Vec3i vec) { sputnik$set(vec.getX(), vec.getY(), vec.getZ()); }
|
||||||
default void semgma$set(Vector3d vec) { smegma$set(vec.x, vec.y, vec.z); }
|
default void sputnik$set(Vector3d vec) { sputnik$set(vec.x, vec.y, vec.z); }
|
||||||
|
|
||||||
void smegma$setXZ(double x, double z);
|
void sputnik$setXZ(double x, double z);
|
||||||
void smegma$setY(double y);
|
void sputnik$setY(double y);
|
||||||
}
|
}
|
||||||
@@ -23,14 +23,6 @@ public interface TextVisitor<T> {
|
|||||||
return text.visit((style, string) -> visitor.accept(queue.remove(), style, string), baseStyle);
|
return text.visit((style, string) -> visitor.accept(queue.remove(), style, string), baseStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Collapses the tree of {@link Text} siblings into a one dimensional FIFO {@link Queue}. To match the behaviours of
|
|
||||||
* the {@link Text#visit(StringVisitable.Visitor)} and {@link Text#visit(StringVisitable.StyledVisitor, Style)}
|
|
||||||
* methods, texts with empty contents (created from {@link Text#empty()}) are ignored but their siblings are still
|
|
||||||
* processed.
|
|
||||||
* @param text the text
|
|
||||||
* @return the text and its siblings in the order they appear when rendered.
|
|
||||||
*/
|
|
||||||
static ArrayDeque<Text> collectSiblings(Text text) {
|
static ArrayDeque<Text> collectSiblings(Text text) {
|
||||||
ArrayDeque<Text> queue = new ArrayDeque<>();
|
ArrayDeque<Text> queue = new ArrayDeque<>();
|
||||||
collectSiblings(text, queue);
|
collectSiblings(text, queue);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package me.retucio.sputnik.util.render;
|
|||||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import me.retucio.sputnik.module.modules.render.GlintPlus;
|
import me.retucio.sputnik.module.modules.render.GlintPlus;
|
||||||
import net.minecraft.client.gl.RenderPipelines;
|
import net.minecraft.client.gl.RenderPipelines;
|
||||||
import net.minecraft.client.render.*;
|
import net.minecraft.client.render.*;
|
||||||
@@ -55,7 +56,7 @@ public class GlintRenderLayer extends RenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static RenderLayer buildGlintRenderLayer(String name) {
|
private static RenderLayer buildGlintRenderLayer(String name) {
|
||||||
final Identifier res = Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
|
final Identifier res = Identifier.of(Sputnik.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
|
||||||
|
|
||||||
return RenderLayer.of("glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
|
return RenderLayer.of("glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
|
||||||
.texture("Sampler0", res)
|
.texture("Sampler0", res)
|
||||||
@@ -66,7 +67,7 @@ public class GlintRenderLayer extends RenderLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static RenderLayer buildEntityGlintRenderLayer(String name) {
|
private static RenderLayer buildEntityGlintRenderLayer(String name) {
|
||||||
final Identifier res = Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
|
final Identifier res = Identifier.of(Sputnik.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
|
||||||
|
|
||||||
return RenderLayer.of("entity_glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
|
return RenderLayer.of("entity_glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
|
||||||
.texture("Sampler0", res)
|
.texture("Sampler0", res)
|
||||||
@@ -78,7 +79,7 @@ public class GlintRenderLayer extends RenderLayer {
|
|||||||
|
|
||||||
|
|
||||||
private static RenderLayer buildArmorEntityGlintRenderLayer(String name) {
|
private static RenderLayer buildArmorEntityGlintRenderLayer(String name) {
|
||||||
final Identifier res = Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
|
final Identifier res = Identifier.of(Sputnik.MOD_ID, "textures/misc/glint_" + name.toLowerCase() + ".png");
|
||||||
|
|
||||||
return RenderLayer.of("armor_glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
|
return RenderLayer.of("armor_glint_" + name, RenderSetup.builder(RenderPipelines.GLINT)
|
||||||
.texture("Sampler0", res)
|
.texture("Sampler0", res)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.util.render;
|
package me.retucio.sputnik.util.render;
|
||||||
|
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.RenderSetup;
|
import net.minecraft.client.render.RenderSetup;
|
||||||
|
|
||||||
@@ -31,11 +32,11 @@ public class Layers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
LINES = RenderLayer.of(me.retucio.sputnik.Sputnik.MOD_ID + "_lines", RenderSetup.builder(LINES_PIPELINE).build());
|
LINES = RenderLayer.of(Sputnik.MOD_ID + "_lines", RenderSetup.builder(LINES_PIPELINE).build());
|
||||||
LINES_CULL = RenderLayer.of(me.retucio.sputnik.Sputnik.MOD_ID + "_lines_cull", RenderSetup.builder(LINES_CULL_PIPELINE).build());
|
LINES_CULL = RenderLayer.of(Sputnik.MOD_ID + "_lines_cull", RenderSetup.builder(LINES_CULL_PIPELINE).build());
|
||||||
|
|
||||||
QUADS = RenderLayer.of(me.retucio.sputnik.Sputnik.MOD_ID + "_quads", RenderSetup.builder(QUADS_PIPELINE).build());
|
QUADS = RenderLayer.of(Sputnik.MOD_ID + "_quads", RenderSetup.builder(QUADS_PIPELINE).build());
|
||||||
QUADS_CULL = RenderLayer.of(me.retucio.sputnik.Sputnik.MOD_ID + "quads_cull", RenderSetup.builder(QUADS_CULL_PIPELINE).build());
|
QUADS_CULL = RenderLayer.of(Sputnik.MOD_ID + "quads_cull", RenderSetup.builder(QUADS_CULL_PIPELINE).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.mojang.blaze3d.pipeline.BlendFunction;
|
|||||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
import com.mojang.blaze3d.platform.DepthTestFunction;
|
import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||||
|
import me.retucio.sputnik.Sputnik;
|
||||||
import net.minecraft.client.gl.RenderPipelines;
|
import net.minecraft.client.gl.RenderPipelines;
|
||||||
import net.minecraft.client.render.VertexFormats;
|
import net.minecraft.client.render.VertexFormats;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
@@ -12,7 +13,7 @@ import net.minecraft.util.Identifier;
|
|||||||
public class Pipelines {
|
public class Pipelines {
|
||||||
|
|
||||||
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(me.retucio.sputnik.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)
|
||||||
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
||||||
.withDepthWrite(false)
|
.withDepthWrite(false)
|
||||||
@@ -20,7 +21,7 @@ public class Pipelines {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
static final RenderPipeline LINES_CULL_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET)
|
static final RenderPipeline LINES_CULL_PIPELINE = RenderPipeline.builder(RenderPipelines.RENDERTYPE_LINES_SNIPPET)
|
||||||
.withLocation(Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, "pipeline/lines_cull"))
|
.withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/lines_cull"))
|
||||||
.withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH, VertexFormat.DrawMode.LINES)
|
.withVertexFormat(VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH, VertexFormat.DrawMode.LINES)
|
||||||
.withDepthTestFunction(DepthTestFunction.LEQUAL_DEPTH_TEST)
|
.withDepthTestFunction(DepthTestFunction.LEQUAL_DEPTH_TEST)
|
||||||
.withDepthWrite(false)
|
.withDepthWrite(false)
|
||||||
@@ -28,7 +29,7 @@ public class Pipelines {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
static final RenderPipeline QUADS_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET)
|
static final RenderPipeline QUADS_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET)
|
||||||
.withLocation(Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, "pipeline/quads"))
|
.withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/quads"))
|
||||||
.withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS)
|
.withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS)
|
||||||
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
||||||
.withBlend(BlendFunction.TRANSLUCENT)
|
.withBlend(BlendFunction.TRANSLUCENT)
|
||||||
@@ -37,7 +38,7 @@ public class Pipelines {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
static final RenderPipeline QUADS_CULL_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET)
|
static final RenderPipeline QUADS_CULL_PIPELINE = RenderPipeline.builder(RenderPipelines.POSITION_COLOR_SNIPPET)
|
||||||
.withLocation(Identifier.of(me.retucio.sputnik.Sputnik.MOD_ID, "pipeline/quads_cull"))
|
.withLocation(Identifier.of(Sputnik.MOD_ID, "pipeline/quads_cull"))
|
||||||
.withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS)
|
.withVertexFormat(VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS)
|
||||||
.withDepthTestFunction(DepthTestFunction.LEQUAL_DEPTH_TEST)
|
.withDepthTestFunction(DepthTestFunction.LEQUAL_DEPTH_TEST)
|
||||||
.withBlend(BlendFunction.TRANSLUCENT)
|
.withBlend(BlendFunction.TRANSLUCENT)
|
||||||
|
|||||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 572 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 694 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 918 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 784 B |
|
After Width: | Height: | Size: 578 B |
|
After Width: | Height: | Size: 625 B |
|
After Width: | Height: | Size: 779 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 717 B |
|
After Width: | Height: | Size: 705 B |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 937 B |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 754 B |
|
After Width: | Height: | Size: 686 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 560 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 657 B |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 926 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 417 B |
|
After Width: | Height: | Size: 616 B |
@@ -30,6 +30,7 @@
|
|||||||
"BossBarHudMixin",
|
"BossBarHudMixin",
|
||||||
"BufferStorageMixin",
|
"BufferStorageMixin",
|
||||||
"CameraMixin",
|
"CameraMixin",
|
||||||
|
"CapeFeatureRendererMixin",
|
||||||
"ChatHudLineMixin",
|
"ChatHudLineMixin",
|
||||||
"ChatHudLineVisibleMixin",
|
"ChatHudLineVisibleMixin",
|
||||||
"ChatHudMixin",
|
"ChatHudMixin",
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
"DamageParticleFactoryMixin",
|
"DamageParticleFactoryMixin",
|
||||||
"DamageParticleMixin",
|
"DamageParticleMixin",
|
||||||
"DisconnectedScreenMixin",
|
"DisconnectedScreenMixin",
|
||||||
|
"ElytraFeatureRendererMixin",
|
||||||
"EmitterParticleMixin",
|
"EmitterParticleMixin",
|
||||||
"EquipmentRendererMixin",
|
"EquipmentRendererMixin",
|
||||||
"FogRendererMixin",
|
"FogRendererMixin",
|
||||||
|
|||||||