Compare commits

...
2 Commits
Author SHA1 Message Date
retuci0 acecda3c0d v3.5 2026-02-19 17:20:31 +01:00
retuci0 ad0349aa29 v3.4 2026-02-17 22:19:09 +01:00
20 changed files with 354 additions and 92 deletions

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
// sistema de eventos
modImplementation "com.github.retuci0:neutrino:${project.neutrino_version}"
include(modImplementation "com.github.retuci0:neutrino:${project.neutrino_version}")
// rpc de discord
include(modImplementation "dev.firstdark.discordrpc:discord-rpc:1.0.3")
+6 -10
View File
@@ -1,22 +1,18 @@
# v3.3
# v3.5
## novedades
- cambiado de sistema de eventos
- categoría de inventario
### adiciones
#### módulos nuevos:
- reponer: repone items a medida que se usan de forma automática
### arreglos / mejoras
- ahora el grosor de línea de hitboxes funciona
- ahora cabezas de chatplus funciona, a medias
- arreglado el crash por no incluir el sistema de eventos en el mod (soy gilipollas)
- mejoras varias al módulo tobillos fuertes
- ahora el módulo de interfaces en portales funciona correctamente
- reponer ya no está repe
## problemas reconocidos
- es posible que algunos módulos hayan dejado de funcionar correctamente, ya que he cambiado de sistema de eventos
- muchos, pero repórtalos en la página de problemas si quieres para que queden bien registrados
+1 -1
View File
@@ -10,6 +10,6 @@ fabric_api_version=0.140.2+1.21.11
neutrino_version=1.1.0
mod_version=3.3
mod_version=3.5
maven_group=me.retucio
archives_base_name=sputnik
@@ -132,8 +132,8 @@ public class Sputnik implements ClientModInitializer {
// se ejecuta cada vez que se presiona una tecla
public void onKey(int key, int action) {
if (key == GLFW.GLFW_KEY_F3) return; // prevenir activación de módulos al usar combinaciones de F3
public void onInput(int key, int action) {
if (key == GLFW.GLFW_KEY_F3) return; // prevenir interrumpir combos de F3
boolean anyFocused = isAnySettingButtonFocused() || ClickGUI.INSTANCE.getSearchBar().isFocused();
ClickGUI.INSTANCE.setAnyFocused(anyFocused);
@@ -145,7 +145,10 @@ public class Sputnik implements ClientModInitializer {
handleClickGUIKey(key, anyFocused);
handleHudEditorKey(key, anyFocused);
}
handleSettingButtonsKey(key, action);
// solo reenviar teclas del teclado
if (key >= 32) {
handleSettingButtonsKey(key, action);
}
} else if (!anyFocused) {
handleModuleRelease(key);
}
@@ -5,12 +5,20 @@ import me.retucio.sputnik.command.Command;
import me.retucio.sputnik.command.args.ModuleArgumentType;
import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.settings.KeySetting;
import me.retucio.sputnik.ui.widgets.frames.settings.ClientSettingsFrame;
import me.retucio.sputnik.util.ChatUtil;
import me.retucio.sputnik.util.KeyUtil;
import net.minecraft.client.input.KeyInput;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.command.CommandSource;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import javax.swing.text.JTextComponent;
import java.util.ArrayList;
import java.util.List;
// asignar una tecla a un módulo, lógica similar a BindButton
public class BindCommand extends Command {
@@ -42,6 +50,24 @@ public class BindCommand extends Command {
public static boolean onKeyPress(int key) {
if (listeningModule == null) return false;
KeySetting bind = listeningModule.getBind();
if (ClientSettingsFrame.guiSettings.multipleKeybinds.getValue()) {
List<KeyBinding> keys = new ArrayList<>(List.of(mc.options.allKeys));
keys.removeAll(List.of(mc.options.debugKeys));
for (KeyBinding kb : keys) {
boolean keyAlreadyBound = kb.matchesKey(new KeyInput(key, 0, 0));
boolean allowMultiple = ClientSettingsFrame.guiSettings.multipleKeybinds.getValue();
if (keyAlreadyBound && !allowMultiple) {
ChatUtil.warn("esa tecla ya está cogida por "
+ Formatting.GREEN + "\"" + I18n.translate(kb.getId()) + "\"");
listeningModule = null;
return true;
}
}
}
if (bind != null) bind.setValue(key);
ChatUtil.info(
@@ -33,4 +33,8 @@ public class Render3DEvent extends Event {
public Camera getCamera() {
return camera;
}
public float getTickDelta() {
return tc.getDynamicDeltaTicks();
}
}
@@ -17,7 +17,7 @@ public abstract class KeyboardMixin {
@Inject(method = "onKey", at = @At("HEAD"), cancellable = true)
private void onKeyPress(long window, int action, KeyInput input, CallbackInfo ci) {
if (input.key() == -1) return;
Sputnik.INSTANCE.onKey(input.key(), action);
Sputnik.INSTANCE.onInput(input.key(), action);
KeyEvent event = EVENT_BUS.post(new KeyEvent(input.key(), input.scancode(), action));
if (event.isCancelled()) ci.cancel();
}
@@ -1,5 +1,6 @@
package me.retucio.sputnik.mixin.mixins.io;
import me.retucio.sputnik.Sputnik;
import me.retucio.sputnik.event.input.MouseClickEvent;
import me.retucio.sputnik.event.input.MouseScrollEvent;
import net.minecraft.client.Mouse;
@@ -16,6 +17,7 @@ public abstract class MouseMixin {
@Inject(method = "onMouseButton", at = @At("HEAD"), cancellable = true)
private void onMouseButton(long window, MouseInput input, int action, CallbackInfo ci) {
Sputnik.INSTANCE.onInput(input.button(), action);
MouseClickEvent event = EVENT_BUS.post(new MouseClickEvent(action, input.button()));
if (event.isCancelled()) ci.cancel();
}
@@ -40,6 +40,7 @@ public class ModuleManager {
// añadir los módulos
addCamera();
addClient();
addInventory();
addMisc();
addMovement();
addNetwork();
@@ -87,16 +88,24 @@ public class ModuleManager {
add(new AnvilFont());
add(new BookBot());
add(new BossbarStack());
add(new BundleDupe());
add(new ChatPlus());
add(new CreativeInventoryHotbarKeybinds());
add(new FakePlayer());
add(new Replenish());
add(new ScreenshotPlus());
add(new ShulkerPeek());
add(new UnfocusedCpu());
}
private void addInventory() {
add(new BundleDupe());
add(new CreativeInventoryHotbarKeybinds());
add(new InventoryPlus());
add(new Offhand());
add(new PortalGUI());
add(new Replenish());
add(new ShulkerPeek());
add(new UIMove());
add(new XCarry());
}
private void addMovement() {
add(new BoatFly());
add(new Dolphin());
@@ -129,12 +138,9 @@ public class ModuleManager {
add(new Capes());
add(new FastUse());
add(new HandView());
add(new InventoryPlus());
add(new KeyPearl());
add(new MaceKill());
add(new NoFall());
add(new Offhand());
add(new PortalGUI());
add(new UIMove());
add(new SpearKill());
add(new WarnLowDurability());
}
@@ -0,0 +1,44 @@
package me.retucio.sputnik.module.modules.inventory;
import com.github.retucio.neutrino.EventListener;
import me.retucio.sputnik.event.network.PacketEvent;
import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.util.ChatUtil;
import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket;
public class XCarry extends Module {
private boolean invOpen;
public XCarry() {
super("mochila", "te permite llevar items en los slots de crafteo", Category.INVENTORY);
}
@Override
public void onEnable() {
if (mc.player != null) {
mc.player.networkHandler.sendPacket(new CloseHandledScreenC2SPacket(mc.player.playerScreenHandler.syncId));
}
invOpen = false;
super.onEnable();
}
@Override
public void onDisable() {
if (invOpen && mc.player != null) {
mc.player.networkHandler.sendPacket(new CloseHandledScreenC2SPacket(mc.player.playerScreenHandler.syncId));
}
super.onDisable();
}
@EventListener
public void onSendPacket(PacketEvent.Send event) {
if (event.getPacket() instanceof CloseHandledScreenC2SPacket packet
&& packet.getSyncId() == mc.player.playerScreenHandler.syncId) {
invOpen = true;
event.cancel();
}
}
}
@@ -0,0 +1,80 @@
package me.retucio.sputnik.module.modules.player;
import me.retucio.sputnik.module.Category;
import me.retucio.sputnik.module.Module;
import me.retucio.sputnik.module.setting.settings.BooleanSetting;
import me.retucio.sputnik.util.ChatUtil;
import me.retucio.sputnik.util.InventoryUtil;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.Items;
public class KeyPearl extends Module {
private final BooleanSetting swapBack = sgGeneral.add(new BooleanSetting(
"cambiar de vuelta",
"cambiar el ítem de vuelta a su lugar o seleccionar el slot original",
true
));
public KeyPearl() {
super("tecla de perla", "lanza una perla con una tecla", Category.PLAYER);
keyMode.setValue(KeyModes.HOLD);
}
private int prevSlot = -1;
private int prevStackSlot = -1;
private boolean didMoveItem = false;
@Override
public void onEnable() {
if (mc.player == null) return;
switchToPearl();
super.onEnable();
}
@Override
// al desactivar para poder prever la trayectoria si trayectorias está activado
public void onDisable() {
throwPearl();
switchBack();
prevSlot = -1;
prevStackSlot = -1;
didMoveItem = false;
super.onDisable();
}
private void switchToPearl() {
PlayerInventory inv = mc.player.getInventory();
int slot = InventoryUtil.findSlot(stack -> stack.isOf(Items.ENDER_PEARL));
if (slot < 0) {
ChatUtil.error("no tienes perlas");
toggle();
return;
}
if (PlayerInventory.isValidHotbarIndex(slot)) {
prevSlot = inv.getSelectedSlot();
inv.setSelectedSlot(slot);
return;
}
InventoryUtil.swapWithHotbar(slot, inv.getSelectedSlot());
didMoveItem = true;
prevStackSlot = slot;
}
private void throwPearl() {
if (!mc.player.getMainHandStack().isOf(Items.ENDER_PEARL)) return;
mc.doItemUse();
}
private void switchBack() {
if (!swapBack.getValue()) return;
if (didMoveItem) {
InventoryUtil.swapWithHotbar(prevStackSlot, mc.player.getInventory().getSelectedSlot());
} else {
mc.player.getInventory().setSelectedSlot(prevSlot);
}
}
}
@@ -11,7 +11,10 @@ import me.retucio.sputnik.module.setting.settings.NumberSetting;
import me.retucio.sputnik.util.ChatUtil;
import me.retucio.sputnik.util.InventoryUtil;
import me.retucio.sputnik.util.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
@@ -20,21 +23,32 @@ import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import java.util.List;
// todo: arreglar MLGs con bloques
public class NoFall extends Module {
private boolean placed;
private boolean placed, shouldUse;
private final List<Item> mlgItems = List.of(Items.WATER_BUCKET, Items.ENDER_PEARL, Items.POWDER_SNOW_BUCKET,
Items.SLIME_BLOCK, Items.HAY_BLOCK, Items.HONEY_BLOCK, Items.BLACK_BED,
private final List<Item> mlgItems = List.of(Items.WATER_BUCKET, Items.ENDER_PEARL,
Items.POWDER_SNOW_BUCKET, Items.TWISTING_VINES, Items.SLIME_BLOCK,
Items.HAY_BLOCK, Items.HONEY_BLOCK, Items.BLACK_BED,
Items.BLUE_BED, Items.BROWN_BED, Items.CYAN_BED, Items.GRAY_BED,
Items.GREEN_BED, Items.LIGHT_BLUE_BED, Items.LIGHT_GRAY_BED, Items.LIME_BED,
Items.MAGENTA_BED, Items.ORANGE_BED, Items.PINK_BED, Items.PURPLE_BED,
Items.RED_BED, Items.WHITE_BED, Items.YELLOW_BED);
private final List<Block> safeBlocks = List.of(
Blocks.WATER, Blocks.SLIME_BLOCK, Blocks.HAY_BLOCK, Blocks.HONEY_BLOCK,
Blocks.TWISTING_VINES, Blocks.BLACK_BED, Blocks.BLUE_BED, Blocks.BROWN_BED,
Blocks.CYAN_BED, Blocks.GRAY_BED, Blocks.GREEN_BED, Blocks.LIGHT_BLUE_BED,
Blocks.LIGHT_GRAY_BED, Blocks.LIME_BED, Blocks.MAGENTA_BED, Blocks.ORANGE_BED,
Blocks.PINK_BED, Blocks.PURPLE_BED, Blocks.RED_BED, Blocks. WHITE_BED,
Blocks.YELLOW_BED);
private final EnumSetting<NoFallMode> mode = sgGeneral.add(new EnumSetting<>(
"modo",
"de qué manera evitar el daño de caída",
@@ -57,12 +71,18 @@ public class NoFall extends Module {
1
));
private final BooleanSetting clutch = sgGeneral.add( new BooleanSetting(
private final BooleanSetting clutch = sgGeneral.add(new BooleanSetting(
"salvada",
"cambiar a modo paquete si no se encuentra un cubo disponible",
true
));
private final BooleanSetting center = sgGeneral.add(new BooleanSetting(
"centrar jugador",
"centrar jugador respecto al bloque que tenga debajo",
false
));
public NoFall() {
super("tobillos fuertes", "evita el daño de caída", Category.PLAYER);
}
@@ -77,11 +97,34 @@ public class NoFall extends Module {
if (mc.player.isOnGround()) {
placed = false;
shouldUse = false;
}
if (mode.is(NoFallMode.CLUTCH) && mc.player.fallDistance >= distance.getValue() && !mc.player.isOnGround() && !placed) {
HitResult result = mc.getCameraEntity().raycast(3, 0, false);
if (result instanceof BlockHitResult) {
if (shouldUse) {
mc.doItemUse();
}
if (mode.is(NoFallMode.CLUTCH)
&& mc.player.fallDistance >= distance.getValue()
&& !mc.player.isOnGround()
&& !placed) {
if (center.getValue()) {
Vec3d diff = mc.player.getEntityPos().subtract(mc.player.getBlockPos().toCenterPos());
if (diff.lengthSquared() > 10e-3) {
Vec3d impulse = new Vec3d(-diff.x * 0.05, 0, -diff.z * 0.05);
mc.player.addVelocity(impulse.x, impulse.y, impulse.z);
}
}
HitResult result = mc.getCameraEntity().raycast(3, 0, true);
if (result instanceof BlockHitResult bhr) {
BlockPos pos = bhr.getBlockPos();
while (mc.world.getBlockState(pos).isOf(Blocks.AIR)) {
pos = pos.down();
}
if (isSafeBlock(pos)) return;
// encontrar ítem
ItemStack mlgItem = getMlgItem();
if (mlgItem == null) {
@@ -102,6 +145,13 @@ public class NoFall extends Module {
int slot = mc.player.getInventory().getSlotWithStack(mlgItem);
mc.player.getInventory().setSelectedSlot(slot);
// usar bloque
if (mlgItem.getItem() instanceof BlockItem) {
shouldUse = true;
placed = true;
return;
}
// usar ítem
ActionResult didPlace = mc.interactionManager.interactItem(mc.player, Hand.MAIN_HAND);
if (didPlace.isAccepted())
@@ -143,7 +193,7 @@ public class NoFall extends Module {
private ItemStack getMlgItem() {
for (Item item : items.getEnabledOptions()) {
ItemStack stack = InventoryUtil.getStackOf(item);
ItemStack stack = InventoryUtil.find(itemStack -> itemStack.isOf(item));
if (stack != null && PlayerInventory.isValidHotbarIndex(mc.player.getInventory().getSlotWithStack(stack))) {
return stack;
}
@@ -151,6 +201,10 @@ public class NoFall extends Module {
return null;
}
private boolean isSafeBlock(BlockPos pos) {
return safeBlocks.contains(mc.world.getBlockState(pos).getBlock());
}
private enum NoFallMode {
CLUTCH("waterdrop"),
PACKET("paquetes");
@@ -32,7 +32,7 @@ public class KeySetting extends Setting<Integer> {
if (ModuleManager.INSTANCE != null) {
for (Module module : ModuleManager.INSTANCE.getModules())
if (module.getKey() == value && !ClientSettingsFrame.guiSettings.multipleKeybinds.getValue() && value != -1) {
if (module.getKey() == value && value != -1) {
module.setKey(-1);
ChatUtil.info("tecla del módulo " + module.getName() + " restablecida");
}
@@ -408,11 +408,11 @@ public class ClickGUI extends Screen {
// selección de widgets
public Widget getSelected() {
public @Nullable Widget getSelected() {
return selected;
}
public void setSelected(Widget widget) {
public void setSelected(@Nullable Widget widget) {
this.selected = widget;
}
@@ -51,7 +51,7 @@ public class ModuleButton extends Button {
ClickGUI.INSTANCE.closeSettingsFrame(module);
else
ClickGUI.INSTANCE.openSettingsFrame(module,
parent.getX() + parent.getW() + 120, parent.getRenderY() + offset);
parent.getX() + parent.getW() + 120, parent.getY() + offset);
}
}
}
@@ -15,6 +15,9 @@ import net.minecraft.client.resource.language.I18n;
import net.minecraft.util.Formatting;
import org.lwjgl.glfw.GLFW;
import java.util.ArrayList;
import java.util.List;
// botón para configurar la tecla asignada a un módulo. comienza a escuchar al hacerle clic.
public class BindButton extends SettingButton<KeySetting> {
@@ -41,15 +44,38 @@ public class BindButton extends SettingButton<KeySetting> {
@Override
public void mouseClicked(int mouseX, int mouseY, int button) {
if (isHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
if (button == 0) {
listening = !listening;
}
else if (button == 1 && KeyUtil.isShiftDown()) {
setting.reset();
boolean hovered = isHovered(mouseX, mouseY);
if (hovered && ClickGUI.INSTANCE.trySelect(this)) {
if (listening) {
List<KeyBinding> keys = new ArrayList<>(List.of(mc.options.allKeys));
keys.removeAll(List.of(mc.options.debugKeys));
boolean allowMultiple = ClientSettingsFrame.guiSettings.multipleKeybinds.getValue();
for (KeyBinding bind : keys) {
if (bind.matchesKey(new KeyInput(button, 0, 0))) {
if (!allowMultiple) {
ChatUtil.warn("esa tecla ya está cogida por "
+ Formatting.GREEN + "\"" + I18n.translate(bind.getId()) + "\"");
listening = false;
return;
}
}
}
setting.setValue(button);
listening = false;
} else {
if (button == 0) {
listening = true;
} else if (button == 1 && KeyUtil.isShiftDown()) {
setting.reset();
}
}
} else {
listening = false;
if (listening) {
listening = false;
}
}
}
@@ -59,7 +85,9 @@ public class BindButton extends SettingButton<KeySetting> {
if (key == GLFW.GLFW_KEY_ESCAPE) {
setting.setValue(GLFW.GLFW_KEY_UNKNOWN);
} else {
for (KeyBinding bind : mc.options.allKeys) {
List<KeyBinding> keys = new ArrayList<>(List.of(mc.options.allKeys));
keys.removeAll(List.of(mc.options.debugKeys));
for (KeyBinding bind : keys) {
// no permitir usar la misma tecla para varias acciones, si el ajuste para esto está activado
boolean keyAlreadyBound = bind.matchesKey(new KeyInput(key, 0, 0));
boolean allowMultiple = ClientSettingsFrame.guiSettings.multipleKeybinds.getValue();
@@ -47,6 +47,17 @@ public class InventoryUtil {
return null;
}
public static int findSlot(Predicate<ItemStack> predicate) {
if (mc.player == null) return -1;
for (int i = 0; i < mc.player.getInventory().size(); i++) {
ItemStack stack = mc.player.getInventory().getStack(i);
if (predicate.test(stack)) {
return i;
}
}
return -1;
}
public static List<ItemStack> findAll(Predicate<ItemStack> predicate) {
List<ItemStack> stacks = new ArrayList<>();
if (mc.player == null) return stacks;
@@ -59,14 +70,6 @@ public class InventoryUtil {
return stacks;
}
public static ItemStack getStackOf(Item item) {
if (mc.player == null) return null;
for (ItemStack stack : mc.player.getInventory())
if (stack.getItem() == item)
return stack;
return null;
}
public static List<ItemStack> getStacksOfTag(TagKey<Item> tag) {
if (mc.player == null) return null;
List<ItemStack> stacks = new ArrayList<>();
@@ -5,6 +5,7 @@ import net.minecraft.client.input.KeyInput;
import net.minecraft.client.option.KeyBinding;
import org.lwjgl.glfw.GLFW;
import java.util.List;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.im.InputContext;
@@ -19,34 +19,52 @@ public class RenderUtil {
// líneas
public static void drawHorizontalLine(MatrixStack matrices, float x1, float x2, float y, Color color) {
if (x2 < x1) {
float i = x1;
x1 = x2;
x2 = i;
}
public static void drawLine(MatrixStack matrices, Vec3d start, Vec3d end, Color color, float lineWidth) {
Camera camera = mc.gameRenderer.getCamera();
Vec3d cameraPos = camera.getCameraPos();
drawFilledRect(matrices, x1, y, x2 + 1, y + 1, color);
float startX = (float) (start.x - cameraPos.x);
float startY = (float) (start.y - cameraPos.y);
float startZ = (float) (start.z - cameraPos.z);
float endX = (float) (end.x - cameraPos.x);
float endY = (float) (end.y - cameraPos.y);
float endZ = (float) (end.z - cameraPos.z);
BufferBuilder buffer = tesselator.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH);
float nx = -1.0f, ny = -1f, nz = -1.0f;
buffer.vertex(matrices.peek().getPositionMatrix(), startX, startY, startZ)
.color(color.getRGB())
.normal(nx, ny, nz)
.lineWidth(lineWidth);
buffer.vertex(matrices.peek().getPositionMatrix(), endX, endY, endZ)
.color(color.getRGB())
.normal(nx, ny, nz)
.lineWidth(lineWidth);
Layers.lines().draw(buffer.end());
}
public static void drawVerticalLine(MatrixStack matrices, float x, float y1, float y2, Color color) {
if (y2 < y1) {
float i = y1;
y1 = y2;
y2 = i;
}
public static void drawLine2D(MatrixStack matrices, float x1, float y1, float x2, float y2, Color color, float lineWidth) {
float r = color.getRed() / 255f;
float g = color.getGreen() / 255f;
float b = color.getBlue() / 255f;
float a = color.getAlpha() / 255f;
drawFilledRect(matrices, x, y1 + 1, x + 1, y2, color);
}
BufferBuilder buffer = tesselator.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH);
float nx = 0, ny = 0, nz = 1; // normals not used
public static void drawHorizontalLine(MatrixStack matrices, float x1, float x2, float y, Color color, float width) {
if (x2 < x1) {
float i = x1;
x1 = x2;
x2 = i;
}
buffer.vertex(matrices.peek().getPositionMatrix(), x1, y1, 0)
.color(r, g, b, a)
.normal(nx, ny, nz)
.lineWidth(lineWidth);
buffer.vertex(matrices.peek().getPositionMatrix(), x2, y2, 0)
.color(r, g, b, a)
.normal(nx, ny, nz)
.lineWidth(lineWidth);
drawFilledRect(matrices, x1, y, x2 + width, y + width, color);
Layers.lines().draw(buffer.end());
}
public static void drawVector(MatrixStack matrices, Vector3f start, Vec3d direction, Color c, float lineWidth) {
@@ -77,18 +95,8 @@ public class RenderUtil {
Layers.lines().draw(buffer.end());
}
public static void drawVerticalLine(MatrixStack matrices, float x, float y1, float y2, Color color, float width) {
if (y2 < y1) {
float i = y1;
y1 = y2;
y2 = i;
}
drawFilledRect(matrices, x, y1 + width, x + width, y2, color);
}
// caras
/* caras */
public static void drawFilledRect(MatrixStack matrices, float x, float y, float width, float height, Color color) {
float r = color.getRed() / 255f;
@@ -110,13 +118,6 @@ public class RenderUtil {
matrices.pop();
}
public static void drawRectOutlines(MatrixStack stack, float x1, float y1, float x2, float y2, Color color, float width) {
drawHorizontalLine(stack, x1, x2, y1, color, width);
drawVerticalLine(stack, x2, y1, y2, color, width);
drawHorizontalLine(stack, x1, x2, y2, color, width);
drawVerticalLine(stack, x1, y1, y2, color, width);
}
public static void drawBlockFaceOutlines(MatrixStack matrices, BlockPos pos, Direction face, Color color, float lineWidth, boolean cull) {
Vec3d cameraPos = mc.gameRenderer.getCamera().getCameraPos();
@@ -303,6 +304,19 @@ public class RenderUtil {
}
public static void drawTriangle(MatrixStack matrices, float x1, float y1, float x2, float y2, float x3, float y3, Color color) {
float r = color.getRed() / 255f;
float g = color.getGreen() / 255f;
float b = color.getBlue() / 255f;
float a = color.getAlpha() / 255f;
BufferBuilder buffer = tesselator.begin(VertexFormat.DrawMode.TRIANGLES, VertexFormats.POSITION_COLOR);
buffer.vertex(matrices.peek().getPositionMatrix(), x1, y1, 0).color(r, g, b, a);
buffer.vertex(matrices.peek().getPositionMatrix(), x2, y2, 0).color(r, g, b, a);
buffer.vertex(matrices.peek().getPositionMatrix(), x3, y3, 0).color(r, g, b, a);
Layers.quads().draw(buffer.end());
}
// cajas
public static void drawOutlineBox(MatrixStack matrices, Box box, Color color, float lineWidth, boolean cull) {
+1
View File
@@ -60,6 +60,7 @@
"mixins.network.ResourcePackPolicyMixin",
"mixins.network.ServerInfoMixin",
"mixins.network.TelemetryManagerMixin",
"mixins.player.ClientPlayerEntityMixin",
"mixins.player.ClientPlayerInteractionManagerMixin",
"mixins.render.BufferStorageMixin",
"mixins.render.CameraMixin",