v3.4
This commit is contained in:
1 parent
f1eed6f957
commit
ad0349aa29
17 files changed
+286
-76
No files matched your search
+5
-7
@@ -2,21 +2,19 @@
|
|||||||
|
|
||||||
## novedades
|
## novedades
|
||||||
|
|
||||||
- cambiado de sistema de eventos
|
|
||||||
- categoría de inventario
|
|
||||||
|
|
||||||
### adiciones
|
### adiciones
|
||||||
|
|
||||||
|
- ahora se puede asignar un botón del ratón a un módulo
|
||||||
|
|
||||||
#### módulos nuevos:
|
#### módulos nuevos:
|
||||||
|
|
||||||
- reponer: repone items a medida que se usan de forma automática
|
- mochila: te permite llevar items en los slots de crafteo del inventario
|
||||||
|
- tecla de perla: te permite lanzar una perla con tan solo un pulsamiento de tecla, siempre y cuando tengas en el inventario
|
||||||
|
|
||||||
### arreglos / mejoras
|
### arreglos / mejoras
|
||||||
|
|
||||||
- ahora el grosor de línea de hitboxes funciona
|
- arreglada la cagada de Mojang de las teclas debug
|
||||||
- ahora cabezas de chatplus funciona, a medias
|
|
||||||
|
|
||||||
## problemas reconocidos
|
## 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
|
- muchos, pero repórtalos en la página de problemas si quieres para que queden bien registrados
|
||||||
@@ -132,8 +132,8 @@ public class Sputnik implements ClientModInitializer {
|
|||||||
|
|
||||||
|
|
||||||
// se ejecuta cada vez que se presiona una tecla
|
// se ejecuta cada vez que se presiona una tecla
|
||||||
public void onKey(int key, int action) {
|
public void onInput(int key, int action) {
|
||||||
if (key == GLFW.GLFW_KEY_F3) return; // prevenir activación de módulos al usar combinaciones de F3
|
if (key == GLFW.GLFW_KEY_F3) return; // prevenir interrumpir combos de F3
|
||||||
|
|
||||||
boolean anyFocused = isAnySettingButtonFocused() || ClickGUI.INSTANCE.getSearchBar().isFocused();
|
boolean anyFocused = isAnySettingButtonFocused() || ClickGUI.INSTANCE.getSearchBar().isFocused();
|
||||||
ClickGUI.INSTANCE.setAnyFocused(anyFocused);
|
ClickGUI.INSTANCE.setAnyFocused(anyFocused);
|
||||||
@@ -145,7 +145,10 @@ public class Sputnik implements ClientModInitializer {
|
|||||||
handleClickGUIKey(key, anyFocused);
|
handleClickGUIKey(key, anyFocused);
|
||||||
handleHudEditorKey(key, anyFocused);
|
handleHudEditorKey(key, anyFocused);
|
||||||
}
|
}
|
||||||
|
// solo reenviar teclas del teclado
|
||||||
|
if (key >= 32) {
|
||||||
handleSettingButtonsKey(key, action);
|
handleSettingButtonsKey(key, action);
|
||||||
|
}
|
||||||
} else if (!anyFocused) {
|
} else if (!anyFocused) {
|
||||||
handleModuleRelease(key);
|
handleModuleRelease(key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,20 @@ import me.retucio.sputnik.command.Command;
|
|||||||
import me.retucio.sputnik.command.args.ModuleArgumentType;
|
import me.retucio.sputnik.command.args.ModuleArgumentType;
|
||||||
import me.retucio.sputnik.module.Module;
|
import me.retucio.sputnik.module.Module;
|
||||||
import me.retucio.sputnik.module.setting.settings.KeySetting;
|
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.ChatUtil;
|
||||||
import me.retucio.sputnik.util.KeyUtil;
|
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.command.CommandSource;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
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
|
// asignar una tecla a un módulo, lógica similar a BindButton
|
||||||
public class BindCommand extends Command {
|
public class BindCommand extends Command {
|
||||||
|
|
||||||
@@ -42,6 +50,24 @@ public class BindCommand extends Command {
|
|||||||
public static boolean onKeyPress(int key) {
|
public static boolean onKeyPress(int key) {
|
||||||
if (listeningModule == null) return false;
|
if (listeningModule == null) return false;
|
||||||
KeySetting bind = listeningModule.getBind();
|
KeySetting bind = listeningModule.getBind();
|
||||||
|
|
||||||
|
if (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);
|
if (bind != null) bind.setValue(key);
|
||||||
|
|
||||||
ChatUtil.info(
|
ChatUtil.info(
|
||||||
|
|||||||
@@ -33,4 +33,8 @@ public class Render3DEvent extends Event {
|
|||||||
public Camera getCamera() {
|
public Camera getCamera() {
|
||||||
return camera;
|
return camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getTickDelta() {
|
||||||
|
return tc.getDynamicDeltaTicks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -17,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;
|
||||||
Sputnik.INSTANCE.onKey(input.key(), action);
|
Sputnik.INSTANCE.onInput(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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package me.retucio.sputnik.mixin.mixins.io;
|
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.MouseClickEvent;
|
||||||
import me.retucio.sputnik.event.input.MouseScrollEvent;
|
import me.retucio.sputnik.event.input.MouseScrollEvent;
|
||||||
import net.minecraft.client.Mouse;
|
import net.minecraft.client.Mouse;
|
||||||
@@ -16,6 +17,7 @@ public abstract class MouseMixin {
|
|||||||
|
|
||||||
@Inject(method = "onMouseButton", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onMouseButton", at = @At("HEAD"), cancellable = true)
|
||||||
private void onMouseButton(long window, MouseInput input, int action, CallbackInfo ci) {
|
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()));
|
MouseClickEvent event = EVENT_BUS.post(new MouseClickEvent(action, input.button()));
|
||||||
if (event.isCancelled()) ci.cancel();
|
if (event.isCancelled()) ci.cancel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public class ModuleManager {
|
|||||||
// añadir los módulos
|
// añadir los módulos
|
||||||
addCamera();
|
addCamera();
|
||||||
addClient();
|
addClient();
|
||||||
|
addInventory();
|
||||||
addMisc();
|
addMisc();
|
||||||
addMovement();
|
addMovement();
|
||||||
addNetwork();
|
addNetwork();
|
||||||
@@ -87,16 +88,25 @@ public class ModuleManager {
|
|||||||
add(new AnvilFont());
|
add(new AnvilFont());
|
||||||
add(new BookBot());
|
add(new BookBot());
|
||||||
add(new BossbarStack());
|
add(new BossbarStack());
|
||||||
add(new BundleDupe());
|
|
||||||
add(new ChatPlus());
|
add(new ChatPlus());
|
||||||
add(new CreativeInventoryHotbarKeybinds());
|
|
||||||
add(new FakePlayer());
|
add(new FakePlayer());
|
||||||
add(new Replenish());
|
add(new Replenish());
|
||||||
add(new ScreenshotPlus());
|
add(new ScreenshotPlus());
|
||||||
add(new ShulkerPeek());
|
|
||||||
add(new UnfocusedCpu());
|
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() {
|
private void addMovement() {
|
||||||
add(new BoatFly());
|
add(new BoatFly());
|
||||||
add(new Dolphin());
|
add(new Dolphin());
|
||||||
@@ -129,12 +139,9 @@ public class ModuleManager {
|
|||||||
add(new Capes());
|
add(new Capes());
|
||||||
add(new FastUse());
|
add(new FastUse());
|
||||||
add(new HandView());
|
add(new HandView());
|
||||||
add(new InventoryPlus());
|
add(new KeyPearl());
|
||||||
add(new MaceKill());
|
add(new MaceKill());
|
||||||
add(new NoFall());
|
add(new NoFall());
|
||||||
add(new Offhand());
|
|
||||||
add(new PortalGUI());
|
|
||||||
add(new UIMove());
|
|
||||||
add(new SpearKill());
|
add(new SpearKill());
|
||||||
add(new WarnLowDurability());
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -143,7 +143,7 @@ public class NoFall extends Module {
|
|||||||
|
|
||||||
private ItemStack getMlgItem() {
|
private ItemStack getMlgItem() {
|
||||||
for (Item item : items.getEnabledOptions()) {
|
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))) {
|
if (stack != null && PlayerInventory.isValidHotbarIndex(mc.player.getInventory().getSlotWithStack(stack))) {
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class KeySetting extends Setting<Integer> {
|
|||||||
|
|
||||||
if (ModuleManager.INSTANCE != null) {
|
if (ModuleManager.INSTANCE != null) {
|
||||||
for (Module module : ModuleManager.INSTANCE.getModules())
|
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);
|
module.setKey(-1);
|
||||||
ChatUtil.info("tecla del módulo " + module.getName() + " restablecida");
|
ChatUtil.info("tecla del módulo " + module.getName() + " restablecida");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -408,11 +408,11 @@ public class ClickGUI extends Screen {
|
|||||||
|
|
||||||
// selección de widgets
|
// selección de widgets
|
||||||
|
|
||||||
public Widget getSelected() {
|
public @Nullable Widget getSelected() {
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelected(Widget widget) {
|
public void setSelected(@Nullable Widget widget) {
|
||||||
this.selected = widget;
|
this.selected = widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class ModuleButton extends Button {
|
|||||||
ClickGUI.INSTANCE.closeSettingsFrame(module);
|
ClickGUI.INSTANCE.closeSettingsFrame(module);
|
||||||
else
|
else
|
||||||
ClickGUI.INSTANCE.openSettingsFrame(module,
|
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 net.minecraft.util.Formatting;
|
||||||
import org.lwjgl.glfw.GLFW;
|
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.
|
// botón para configurar la tecla asignada a un módulo. comienza a escuchar al hacerle clic.
|
||||||
public class BindButton extends SettingButton<KeySetting> {
|
public class BindButton extends SettingButton<KeySetting> {
|
||||||
@@ -41,17 +44,40 @@ public class BindButton extends SettingButton<KeySetting> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(int mouseX, int mouseY, int button) {
|
public void mouseClicked(int mouseX, int mouseY, int button) {
|
||||||
if (isHovered(mouseX, mouseY) && ClickGUI.INSTANCE.trySelect(this)) {
|
boolean hovered = isHovered(mouseX, mouseY);
|
||||||
if (button == 0) {
|
|
||||||
listening = !listening;
|
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;
|
||||||
}
|
}
|
||||||
else if (button == 1 && KeyUtil.isShiftDown()) {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setting.setValue(button);
|
||||||
|
listening = false;
|
||||||
|
} else {
|
||||||
|
if (button == 0) {
|
||||||
|
listening = true;
|
||||||
|
} else if (button == 1 && KeyUtil.isShiftDown()) {
|
||||||
setting.reset();
|
setting.reset();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (listening) {
|
||||||
listening = false;
|
listening = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onKey(int key, int action) {
|
public void onKey(int key, int action) {
|
||||||
if (!listening || action != GLFW.GLFW_PRESS) return;
|
if (!listening || action != GLFW.GLFW_PRESS) return;
|
||||||
@@ -59,7 +85,9 @@ public class BindButton extends SettingButton<KeySetting> {
|
|||||||
if (key == GLFW.GLFW_KEY_ESCAPE) {
|
if (key == GLFW.GLFW_KEY_ESCAPE) {
|
||||||
setting.setValue(GLFW.GLFW_KEY_UNKNOWN);
|
setting.setValue(GLFW.GLFW_KEY_UNKNOWN);
|
||||||
} else {
|
} 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
|
// no permitir usar la misma tecla para varias acciones, si el ajuste para esto está activado
|
||||||
boolean keyAlreadyBound = bind.matchesKey(new KeyInput(key, 0, 0));
|
boolean keyAlreadyBound = bind.matchesKey(new KeyInput(key, 0, 0));
|
||||||
boolean allowMultiple = ClientSettingsFrame.guiSettings.multipleKeybinds.getValue();
|
boolean allowMultiple = ClientSettingsFrame.guiSettings.multipleKeybinds.getValue();
|
||||||
|
|||||||
@@ -47,6 +47,17 @@ public class InventoryUtil {
|
|||||||
return null;
|
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) {
|
public static List<ItemStack> findAll(Predicate<ItemStack> predicate) {
|
||||||
List<ItemStack> stacks = new ArrayList<>();
|
List<ItemStack> stacks = new ArrayList<>();
|
||||||
if (mc.player == null) return stacks;
|
if (mc.player == null) return stacks;
|
||||||
@@ -59,14 +70,6 @@ public class InventoryUtil {
|
|||||||
return stacks;
|
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) {
|
public static List<ItemStack> getStacksOfTag(TagKey<Item> tag) {
|
||||||
if (mc.player == null) return null;
|
if (mc.player == null) return null;
|
||||||
List<ItemStack> stacks = new ArrayList<>();
|
List<ItemStack> stacks = new ArrayList<>();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.client.input.KeyInput;
|
|||||||
import net.minecraft.client.option.KeyBinding;
|
import net.minecraft.client.option.KeyBinding;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.im.InputContext;
|
import java.awt.im.InputContext;
|
||||||
|
|||||||
@@ -19,34 +19,52 @@ public class RenderUtil {
|
|||||||
|
|
||||||
// líneas
|
// líneas
|
||||||
|
|
||||||
public static void drawHorizontalLine(MatrixStack matrices, float x1, float x2, float y, Color color) {
|
public static void drawLine(MatrixStack matrices, Vec3d start, Vec3d end, Color color, float lineWidth) {
|
||||||
if (x2 < x1) {
|
Camera camera = mc.gameRenderer.getCamera();
|
||||||
float i = x1;
|
Vec3d cameraPos = camera.getCameraPos();
|
||||||
x1 = x2;
|
|
||||||
x2 = i;
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
drawFilledRect(matrices, x1, y, x2 + 1, y + 1, color);
|
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;
|
||||||
|
|
||||||
public static void drawVerticalLine(MatrixStack matrices, float x, float y1, float y2, Color color) {
|
BufferBuilder buffer = tesselator.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR_NORMAL_LINE_WIDTH);
|
||||||
if (y2 < y1) {
|
float nx = 0, ny = 0, nz = 1; // normals not used
|
||||||
float i = y1;
|
|
||||||
y1 = y2;
|
|
||||||
y2 = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawFilledRect(matrices, x, y1 + 1, x + 1, y2, color);
|
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);
|
||||||
|
|
||||||
public static void drawHorizontalLine(MatrixStack matrices, float x1, float x2, float y, Color color, float width) {
|
Layers.lines().draw(buffer.end());
|
||||||
if (x2 < x1) {
|
|
||||||
float i = x1;
|
|
||||||
x1 = x2;
|
|
||||||
x2 = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawFilledRect(matrices, x1, y, x2 + width, y + width, color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawVector(MatrixStack matrices, Vector3f start, Vec3d direction, Color c, float lineWidth) {
|
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());
|
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) {
|
public static void drawFilledRect(MatrixStack matrices, float x, float y, float width, float height, Color color) {
|
||||||
float r = color.getRed() / 255f;
|
float r = color.getRed() / 255f;
|
||||||
@@ -110,13 +118,6 @@ public class RenderUtil {
|
|||||||
matrices.pop();
|
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) {
|
public static void drawBlockFaceOutlines(MatrixStack matrices, BlockPos pos, Direction face, Color color, float lineWidth, boolean cull) {
|
||||||
Vec3d cameraPos = mc.gameRenderer.getCamera().getCameraPos();
|
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
|
// cajas
|
||||||
|
|
||||||
public static void drawOutlineBox(MatrixStack matrices, Box box, Color color, float lineWidth, boolean cull) {
|
public static void drawOutlineBox(MatrixStack matrices, Box box, Color color, float lineWidth, boolean cull) {
|
||||||
|
|||||||
Reference in new issue
Block a user