From 4f7d5228a58005bc6866ae6b0ad090c4b69a8506 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Tue, 28 Nov 2023 18:19:55 +0100 Subject: Some misc changes (more in commit messages) (#957) --- .../notenoughupdates/listener/RenderListener.java | 16 -- .../miscfeatures/PetInfoOverlay.java | 9 - .../notenoughupdates/miscfeatures/WarpDessert.kt | 37 ----- .../overlays/RancherBootOverlay.java | 184 --------------------- .../notenoughupdates/commands/help/HelpCommand.kt | 2 +- .../notenoughupdates/miscfeatures/WarpDessert.kt | 37 +++++ 6 files changed, 38 insertions(+), 247 deletions(-) delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java create mode 100644 src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java index 45aa6612..1cb015c5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java @@ -48,7 +48,6 @@ import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay; import io.github.moulberry.notenoughupdates.overlays.BazaarSearchOverlay; import io.github.moulberry.notenoughupdates.overlays.OverlayManager; -import io.github.moulberry.notenoughupdates.overlays.RancherBootOverlay; import io.github.moulberry.notenoughupdates.overlays.TextOverlay; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewerUtils; @@ -392,11 +391,6 @@ public class RenderListener { event.setCanceled(true); return; } - if (RancherBootOverlay.shouldReplace()) { - RancherBootOverlay.render(); - event.setCanceled(true); - return; - } String containerName = null; GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; @@ -901,11 +895,6 @@ public class RenderListener { event.setCanceled(true); return; } - if (RancherBootOverlay.shouldReplace()) { - RancherBootOverlay.mouseEvent(); - event.setCanceled(true); - return; - } String containerName = null; GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; @@ -1069,11 +1058,6 @@ public class RenderListener { event.setCanceled(true); return; } - if (RancherBootOverlay.shouldReplace()) { - RancherBootOverlay.keyEvent(); - event.setCanceled(true); - return; - } String containerName = null; GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index f3efa453..557ecf84 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -57,7 +57,6 @@ import org.apache.commons.lang3.text.WordUtils; import org.lwjgl.util.vector.Vector2f; import java.io.File; -import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -66,7 +65,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.UUID; import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -717,13 +715,6 @@ public class PetInfoOverlay extends TextOverlay { } } - if (isPets - && Minecraft.getMinecraft().thePlayer.getUniqueID().equals(UUID.fromString( - "7d35e96a-6827-4fae-aa80-08bfccd02478")) - && Instant.now().isBefore(Instant.ofEpochMilli(1696111664000L))) { - isPets = false; - } - if (isPets) { boolean isRemoving = event.clickedButton == 1; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt deleted file mode 100644 index f6f272b9..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2023 NotEnoughUpdates contributors - * - * This file is part of NotEnoughUpdates. - * - * NotEnoughUpdates is free software: you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * NotEnoughUpdates is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with NotEnoughUpdates. If not, see . - */ - -package io.github.moulberry.notenoughupdates.miscfeatures - -import io.github.moulberry.notenoughupdates.util.Utils -import net.minecraft.client.Minecraft -import net.minecraft.network.play.client.C01PacketChatMessage - -object WarpDessert { - @JvmStatic - fun onPacketChatMessage(packet: C01PacketChatMessage): Boolean { - val message = packet.message.lowercase() - if (message == "/warp dessert") { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp desert") - Utils.addChatMessage("§eDid someone say §d§lDessert§e? Sand is yummy!") - return true - } - return false - } -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java deleted file mode 100644 index 22f6eb96..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/RancherBootOverlay.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2022 NotEnoughUpdates contributors - * - * This file is part of NotEnoughUpdates. - * - * NotEnoughUpdates is free software: you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * NotEnoughUpdates is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with NotEnoughUpdates. If not, see . - */ - -package io.github.moulberry.notenoughupdates.overlays; - -import io.github.moulberry.notenoughupdates.core.GuiElementTextField; -import io.github.moulberry.notenoughupdates.core.util.GuiElementSlider; -import io.github.moulberry.notenoughupdates.mixins.AccessorGuiEditSign; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiEditSign; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntitySign; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; - -import java.util.HashMap; - -public class RancherBootOverlay { - private static int selectedIndex = 0; - - private static final HashMap currentSpeeds = new HashMap<>(); - private static final GuiElementSlider slider = - new GuiElementSlider(0, 0, 145, 100, 400, 1, 300, (val) -> setValue(val.intValue())); - private static final GuiElementTextField textField = - new GuiElementTextField("", 48, 20, GuiElementTextField.NUM_ONLY); - private static boolean textFieldClicked = false; - - public static boolean shouldReplace() { - if (true) return false; - //if(!NotEnoughUpdates.INSTANCE.config.auctionHouseSearch.enableSearchOverlay) return false; - - if (!(Minecraft.getMinecraft().currentScreen instanceof GuiEditSign)) return false; - - TileEntitySign tes = ((AccessorGuiEditSign) Minecraft.getMinecraft().currentScreen).getTileSign(); - - if (tes == null) return false; - if (tes.getPos().getY() != 0) return false; - if (!tes.signText[1].getUnformattedText().equals("^^^^^^")) return false; - if (!tes.signText[2].getUnformattedText().equals("Set your")) return false; - return tes.signText[3].getUnformattedText().equals("speed cap!"); - } - - public static void render() { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - int width = scaledResolution.getScaledWidth(); - int height = scaledResolution.getScaledHeight(); - int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; - int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - - Utils.drawGradientRect(0, 0, width, height, -1072689136, -804253680); - - int topY = height / 4; - - //Gui.drawRect(width/2-100, topY, width/2+48, topY+20, 0xffffffff); - Gui.drawRect(width / 2 + 52, topY, width / 2 + 100, topY + 20, 0xffffffff); - - textField.render(width / 2 + 52, topY); - - slider.x = width / 2 - 100; - slider.y = topY; - slider.render(); - - int numIcons = 3; - int iconsLeft = width / 2 - (numIcons * 25 - 5) / 2; - - for (int i = 0; i < numIcons; i++) { - Gui.drawRect( - iconsLeft + i * 25, - topY + 25, - iconsLeft + i * 25 + 20, - topY + 45, - selectedIndex == i ? 0xff0000ff : 0xff808080 - ); - Utils.drawItemStack(new ItemStack(Items.carrot), iconsLeft + i * 25 + 2, topY + 25 + 2); - Utils.drawStringCentered("" + currentSpeeds.get(i), iconsLeft + i * 25 + 10, topY + 52, true, 0xffffffff); - //Minecraft.getMinecraft().fontRendererObj.drawString("\u2710", iconsLeft+i*25+15, topY+40, 0xffffff, false); - } - - //Minecraft.getMinecraft().fontRendererObj.drawString("Hello!", 100, 100, 0xffffff); - } - - public static void close() { - - } - - public static void keyEvent() { - if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { - Minecraft.getMinecraft().displayGuiScreen(null); - } else { - slider.keyboardInput(); - - if (Keyboard.getEventKeyState()) { - textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey()); - if (textField.getText().length() > 5) textField.setText(textField.getText().substring(0, 5)); - - try { - setCurrentSpeed(Integer.parseInt(textField.getText().trim())); - slider.setValue(getCurrentSpeed()); - textField.setCustomBorderColour(0xfeffffff); - } catch (NumberFormatException ignored) { - textField.setCustomBorderColour(0xffff0000); - } - } - } - } - - private static int getCurrentSpeed() { - return currentSpeeds.get(selectedIndex); - } - - private static void setCurrentSpeed(int speed) { - currentSpeeds.put(selectedIndex, speed); - } - - public static void setValue(int value) { - setCurrentSpeed(value); - textField.setText("" + getCurrentSpeed()); - } - - public static void mouseEvent() { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - int width = scaledResolution.getScaledWidth(); - int height = scaledResolution.getScaledHeight(); - int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; - int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - - int topY = height / 4; - - slider.mouseInput(mouseX, mouseY); - - if (!Mouse.getEventButtonState() && Mouse.getEventButton() == -1 && textFieldClicked) { - textField.mouseClickMove(mouseX - 2, topY + 10, 0, 0); - } - - if (Mouse.getEventButton() != -1) { - textFieldClicked = false; - } - - if (mouseX > width / 2 + 52 && mouseX < width / 2 + 100 && mouseY > topY && mouseY < topY + 20) { - if (Mouse.getEventButtonState()) { - textField.mouseClicked(mouseX, mouseY, Mouse.getEventButton()); - textFieldClicked = true; - } - } - - if (Mouse.getEventButtonState()) { - int numIcons = 3; - int iconsLeft = width / 2 - (numIcons * 25 - 5) / 2; - - for (int i = 0; i < numIcons; i++) { - if (mouseX > iconsLeft + i * 25 && mouseX < iconsLeft + i * 25 + 20 && mouseY > topY + 25 && - mouseY < topY + 45) { - if (i != selectedIndex) { - selectedIndex = i; - slider.setValue(getCurrentSpeed()); - textField.setText("" + getCurrentSpeed()); - } - return; - } - //Minecraft.getMinecraft().fontRendererObj.drawString("\u2710", iconsLeft+i*25+15, topY+40, 0xffffff, false); - } - } - } -} diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt index 16ca0d1b..64575688 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt @@ -42,7 +42,7 @@ class HelpCommand { "§6/neuoverlay §r§7- Opens GUI Editor for quickcommands and searchbar.", "§6/neucalendar §r§7- Opens NEU's custom calendar GUI.", "§6/neucalc §r§7- Run calculations.", - "§6/join §r7- Join instance like k1/f1/m7/fe/kuudra inf", + "§6/join §r§7- Join instance like k1/f1/m7/fe/kuudra inf", "", "§6§lOld commands:", "§6/peek §b?{user} §r§7- Shows quick stats for a user.", diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt new file mode 100644 index 00000000..f6f272b9 --- /dev/null +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2023 NotEnoughUpdates contributors + * + * This file is part of NotEnoughUpdates. + * + * NotEnoughUpdates is free software: you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + * + * NotEnoughUpdates is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with NotEnoughUpdates. If not, see . + */ + +package io.github.moulberry.notenoughupdates.miscfeatures + +import io.github.moulberry.notenoughupdates.util.Utils +import net.minecraft.client.Minecraft +import net.minecraft.network.play.client.C01PacketChatMessage + +object WarpDessert { + @JvmStatic + fun onPacketChatMessage(packet: C01PacketChatMessage): Boolean { + val message = packet.message.lowercase() + if (message == "/warp dessert") { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp desert") + Utils.addChatMessage("§eDid someone say §d§lDessert§e? Sand is yummy!") + return true + } + return false + } +} -- cgit