From f55ee05b748e8ca13c27f42705ead21bbe3df707 Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 29 Jul 2021 19:44:40 +0200 Subject: Add a open in Skycrypt (sky.shiiyu.moe) button also added a generic playSound util --- .../java/io/github/moulberry/notenoughupdates/util/Utils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 37e9c600..c40101ca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -492,9 +492,12 @@ public class Utils { } public static void playPressSound() { - if(NotEnoughUpdates.INSTANCE.config.misc.guiButtonClicks) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create( - new ResourceLocation("gui.button.press"), 1.0F)); + playSound(new ResourceLocation("gui.button.press"), true); + } + + public static void playSound(ResourceLocation sound, boolean gui) { + if(NotEnoughUpdates.INSTANCE.config.misc.guiButtonClicks || !gui) { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(sound, 1.0F)); } } -- cgit From 841f23740c6e23a030a64286c5c3c4ee337700cf Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 31 Jul 2021 22:16:37 +0200 Subject: Remove description and tooltip from Backpack/personalvault in pv --- .../moulberry/notenoughupdates/util/Utils.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index c40101ca..a4af51ca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -610,6 +610,29 @@ public class Utils { return stack; } + public static ItemStack editItemStackInfo(ItemStack itemStack, String displayName, boolean disableNeuToolTips, String... lore){ + NBTTagCompound tag = itemStack.getTagCompound(); + NBTTagCompound display = tag.getCompoundTag("display"); + NBTTagList Lore = new NBTTagList(); + + for(String line : lore) { + Lore.appendTag(new NBTTagString(line)); + } + + display.setString("Name", displayName); + display.setTag("Lore", Lore); + + tag.setTag("display", display); + tag.setInteger("HideFlags", 254); + if(disableNeuToolTips){ + tag.setBoolean("disableNeuTooltip", true); + } + + itemStack.setTagCompound(tag); + + return itemStack; + } + public static void drawStringF(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) { fr.drawString(str, x, y, colour, shadow); } -- cgit From 3ccbd6bb51f781d8c18d0389e5d8e79391b7c56c Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 3 Aug 2021 21:10:22 +0200 Subject: Fix chroma speed being chroma duration instead --- src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index a4af51ca..fc8e2fa3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -234,7 +234,7 @@ public class Utils { long currentTimeMillis = System.currentTimeMillis(); if(startTime == 0) startTime = currentTimeMillis; - int chromaSpeed = NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed; + int chromaSpeed = 510 - NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed2; if(chromaSpeed < 10) chromaSpeed = 10; if(chromaSpeed > 5000) chromaSpeed = 5000; -- cgit From c4fb9b642b7c5281c008cb25f82a9332a95eb775 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 3 Aug 2021 21:10:22 +0200 Subject: Revert "Fix chroma speed being chroma duration instead" This reverts commit 3ccbd6bb51f781d8c18d0389e5d8e79391b7c56c. --- src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index fc8e2fa3..a4af51ca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -234,7 +234,7 @@ public class Utils { long currentTimeMillis = System.currentTimeMillis(); if(startTime == 0) startTime = currentTimeMillis; - int chromaSpeed = 510 - NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed2; + int chromaSpeed = NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed; if(chromaSpeed < 10) chromaSpeed = 10; if(chromaSpeed > 5000) chromaSpeed = 5000; -- cgit From 8f010423e71ff5017104762511ef08f67eb5a87a Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 9 Aug 2021 22:43:33 +0200 Subject: Fixed not being able to use keybinds while hovering over locked slots Took way longer than it could have cause i couldnt find out why something was null smh --- src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index a4af51ca..5ca9b316 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -8,6 +8,7 @@ import com.mojang.authlib.Agent; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.util.TexLoc; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -433,7 +434,11 @@ public class Utils { } public static Slot getSlotUnderMouse(GuiContainer container) { - return (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u"); + Slot slot = (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u"); + if(slot == null){ + slot = SlotLocking.getInstance().getRealSlot(); + } + return slot; } public static void drawTexturedRect(float x, float y, float width, float height) { -- cgit From f85740988b8fe5ae8255a97eca2333e63937f96c Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 23 Aug 2021 14:13:19 +0200 Subject: First working version --- .../moulberry/notenoughupdates/util/Utils.java | 81 ++++++++++++++++++---- 1 file changed, 67 insertions(+), 14 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 5ca9b316..8f373460 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -472,23 +472,74 @@ public class Utils { private static String[] rarityArr = new String[] { "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", }; + + public static String getRarityFromInt(int rarity){ + if(rarity < 0|| rarity >= rarityArr.length){ return rarityArr[0]; } + return rarityArr[rarity]; + } + + public static int checkItemTypePet(List lore){ + for(int i=lore.size()-1; i>=0; i--){ + String line = Utils.cleanColour(lore.get(i)); + for (int i1 = 0; i1 < rarityArr.length; i1++) { + if(line.equals(rarityArr[i1])){ + return i1; + } + } + } + return -1; + } + public static int checkItemType(JsonArray lore, boolean contains, String... typeMatches) { for(int i=lore.size()-1; i>=0; i--) { String line = lore.get(i).getAsString(); - for(String rarity : rarityArr) { - for(int j=0; j=0; i--) { + String line = lore[i]; + + int returnType = checkItemType(line, contains, typeMatches); + if(returnType != -1){ + return returnType; + } + } + return -1; + } + + public static int checkItemType(List lore, boolean contains, String... typeMatches) { + for(int i=lore.size()-1; i>=0; i--) { + String line = lore.get(i); + + int returnType = checkItemType(line, contains, typeMatches); + if(returnType != -1){ + return returnType; + } + } + return -1; + } + + private static int checkItemType(String line, boolean contains, String... typeMatches) { + for (String rarity : rarityArr) { + for (int j = 0; j < typeMatches.length; j++) { + if (contains) { + if (line.trim().contains(rarity + " " + typeMatches[j])) { + return j; + } else if (line.trim().contains(rarity + " DUNGEON " + typeMatches[j])) { + return j; + } + } else { + if (line.trim().endsWith(rarity + " " + typeMatches[j])) { + return j; + } else if (line.trim().endsWith(rarity + " DUNGEON " + typeMatches[j])) { + return j; } } } @@ -496,6 +547,8 @@ public class Utils { return -1; } + + public static void playPressSound() { playSound(new ResourceLocation("gui.button.press"), true); } -- cgit From 752e77d7407bfa7a0355677cd15d205fccf8d8f1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 23 Aug 2021 15:15:15 +0200 Subject: Fix some pet xp tooltip bugs --- src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 8f373460..3e84261c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -469,7 +469,7 @@ public class Utils { return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); } - private static String[] rarityArr = new String[] { + public static String[] rarityArr = new String[] { "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", }; @@ -547,6 +547,11 @@ public class Utils { return -1; } + public static float round (float value, int precision) { + int scale = (int) Math.pow(10, precision); + return (float) Math.round(value * scale) / scale; + } + public static void playPressSound() { -- cgit From 5ff913b685316c23317193cfeb30ae51f1a47f1d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 29 Aug 2021 16:13:49 +0200 Subject: Add Replace Social options chat with PV --- src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 3e84261c..7f1c20d3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -1045,6 +1045,11 @@ public class Utils { style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW+value))); return style; } + public static ChatStyle createClickStyle(ClickEvent.Action action, String value, String message) { + ChatStyle style = createClickStyle(action, value); + style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(message))); + return style; + } public static void recursiveDelete(File file) { if(file.isDirectory() && !Files.isSymbolicLink(file.toPath())) { -- cgit From 7dfb4153a98f903c5779f56df0c00774cf1dccd6 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 31 Aug 2021 15:47:31 +0200 Subject: Clean up some duplicate values etc. --- src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 7f1c20d3..b796fbe3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -470,7 +470,7 @@ public class Utils { } public static String[] rarityArr = new String[] { - "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", + "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME" }; public static String getRarityFromInt(int rarity){ -- cgit