From 1ae37ce75ad3a47c47482aff977fb4bb25660d3e Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 2 Sep 2021 21:57:08 +0200 Subject: Fix a nullpointer exception in dwarven textures (untested) but should do it --- .../moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java index 735243d3..b05c430d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesTextures.java @@ -160,6 +160,9 @@ public class DwarvenMinesTextures { } if(loadedChunkData.get(pair) != null) { HashMap map = loadedChunkData.get(pair); + if(map == null) { + return 0; + } int modX = pos.getX() % 16; int modZ = pos.getZ() % 16; -- cgit From e3fa70ec3bed0667187c44c62764fe04eb182395 Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 2 Sep 2021 21:57:34 +0200 Subject: Fix neuec not parsing correctly and 2 crashes when copying stuff --- .../github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java | 4 ++-- .../github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java index f9344a3a..4bbcdbdd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -67,7 +67,7 @@ public class GuiEnchantColour extends GuiScreen { public static int UNDERLINE_MODIFIER = 0b1000; public static int STRIKETHROUGH_MODIFIER = 0b10000; private Gson gson = new Gson(); - private static final Pattern settingPattern = Pattern.compile(".*:[>=<]:[0-9]:[a-zA-Z0-9]:[0-9][0-9]?"); + private static final Pattern settingPattern = Pattern.compile(".*:[>=<]:[0-9]+:[a-zA-Z0-9]+(:[a-zA-Z0-9])?"); private List getEnchantNamesPretty() { if(enchantNamesPretty == null) { @@ -318,7 +318,7 @@ public class GuiEnchantColour extends GuiScreen { } catch (IllegalArgumentException e){ return false; } - } catch (HeadlessException | IOException | UnsupportedFlavorException e) { + } catch (HeadlessException | IOException | UnsupportedFlavorException | IllegalStateException e) { return false; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java index cfc51708..22a17c9f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java @@ -495,7 +495,7 @@ public class GuiInvButtonEditor extends GuiScreen { } catch (IllegalArgumentException e){ return false; } - } catch (HeadlessException | IOException | UnsupportedFlavorException e) { + } catch (HeadlessException | IOException | UnsupportedFlavorException | IllegalStateException e) { return false; } } -- cgit From 3124dd9341b3437cf7284534cc8779fe13a2c904 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 3 Sep 2021 10:55:36 +0200 Subject: some small fixes --- .../io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java | 2 +- .../io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index d80a5daf..664d684b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -1968,7 +1968,7 @@ public class StorageOverlay extends GuiElement { } public void fastRenderCheck(){ - if(!OpenGlHelper.isFramebufferEnabled()) { + if(!OpenGlHelper.isFramebufferEnabled() && NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3) { this.fastRender = true; NEUEventListener.displayNotification(Lists.newArrayList( "\u00a74Fast Render Warning", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java index 56fa2e99..65c7d3f6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -213,7 +213,7 @@ public class TimersOverlay extends TextOverlay { return; } else if(containerName.equals("Superpairs Rewards") && lower.getSizeInventory() >= 27){ ItemStack stack = lower.getStackInSlot(13); - if(Utils.cleanColour(stack.getDisplayName()).equals("Superpairs")){ + if(stack != null && Utils.cleanColour(stack.getDisplayName()).equals("Superpairs")){ hidden.experimentsCompleted = currentTime; } } -- cgit From 794609ad1bc7953281aede7e095f04d399f4c25f Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 3 Sep 2021 21:51:48 +0200 Subject: Fix accessory bag overlay not counting stats with a % and golden goblin not having a icon --- .../miscgui/AccessoryBagOverlay.java | 57 ++++++++++++---------- .../notenoughupdates/overlays/MiningOverlay.java | 4 ++ 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index 1b04ca88..ec676ec5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -752,19 +752,21 @@ public class AccessoryBagOverlay { } }*/ - private static final Pattern HEALTH_PATTERN_BONUS = Pattern.compile("^Health: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern DEFENCE_PATTERN_BONUS = Pattern.compile("^Defense: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern STRENGTH_PATTERN_BONUS = Pattern.compile("^Strength: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern SPEED_PATTERN_BONUS = Pattern.compile("^Speed: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern CC_PATTERN_BONUS = Pattern.compile("^Crit Chance: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern CD_PATTERN_BONUS = Pattern.compile("^Crit Damage: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern ATKSPEED_PATTERN_BONUS = Pattern.compile("^Bonus Attack Speed: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern INTELLIGENCE_PATTERN_BONUS = Pattern.compile("^Intelligence: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern SCC_PATTERN_BONUS = Pattern.compile("^Sea Creature Chance: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern FEROCITY_PATTERN_BONUS = Pattern.compile("^Ferocity: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern MINING_FORTUNE_PATTERN_BONUS = Pattern.compile("^Mining Fortune: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern MINING_SPEED_PATTERN_BONUS = Pattern.compile("^Mining Speed: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); - private static final Pattern MAGIC_FIND_PATTERN_BONUS = Pattern.compile("^Magic Find: (?:\\+|-)[0-9]+(?:\\.[0-9]+)? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)"); + private static final String STAT_PATTERN_BONUS_END = ": (?:\\+|-)[0-9]+(?:\\.[0-9]+)?\\%? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)%?"; + + private static final Pattern HEALTH_PATTERN_BONUS = Pattern.compile("^Health"+STAT_PATTERN_BONUS_END); + private static final Pattern DEFENCE_PATTERN_BONUS = Pattern.compile("^Defense"+STAT_PATTERN_BONUS_END); + private static final Pattern STRENGTH_PATTERN_BONUS = Pattern.compile("^Strength"+STAT_PATTERN_BONUS_END); + private static final Pattern SPEED_PATTERN_BONUS = Pattern.compile("^Speed"+STAT_PATTERN_BONUS_END); + private static final Pattern CC_PATTERN_BONUS = Pattern.compile("^Crit Chance"+STAT_PATTERN_BONUS_END); + private static final Pattern CD_PATTERN_BONUS = Pattern.compile("^Crit Damage"+STAT_PATTERN_BONUS_END); + private static final Pattern ATKSPEED_PATTERN_BONUS = Pattern.compile("^Bonus Attack Speed"+STAT_PATTERN_BONUS_END); + private static final Pattern INTELLIGENCE_PATTERN_BONUS = Pattern.compile("^Intelligence"+STAT_PATTERN_BONUS_END); + private static final Pattern SCC_PATTERN_BONUS = Pattern.compile("^Sea Creature Chance"+STAT_PATTERN_BONUS_END); + private static final Pattern FEROCITY_PATTERN_BONUS = Pattern.compile("^Ferocity"+STAT_PATTERN_BONUS_END); + private static final Pattern MINING_FORTUNE_PATTERN_BONUS = Pattern.compile("^Mining Fortune"+STAT_PATTERN_BONUS_END); + private static final Pattern MINING_SPEED_PATTERN_BONUS = Pattern.compile("^Mining Speed"+STAT_PATTERN_BONUS_END); + private static final Pattern MAGIC_FIND_PATTERN_BONUS = Pattern.compile("^Magic Find"+STAT_PATTERN_BONUS_END); private static final HashMap STAT_PATTERN_MAP_BONUS = new HashMap<>(); static { STAT_PATTERN_MAP_BONUS.put("health", HEALTH_PATTERN_BONUS); @@ -782,19 +784,22 @@ public class AccessoryBagOverlay { STAT_PATTERN_MAP_BONUS.put("magic_find", MAGIC_FIND_PATTERN_BONUS); } - private static final Pattern HEALTH_PATTERN = Pattern.compile("^Health: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern DEFENCE_PATTERN = Pattern.compile("^Defense: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern STRENGTH_PATTERN = Pattern.compile("^Strength: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern SPEED_PATTERN = Pattern.compile("^Speed: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern CC_PATTERN = Pattern.compile("^Crit Chance: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern CD_PATTERN = Pattern.compile("^Crit Damage: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern ATKSPEED_PATTERN = Pattern.compile("^Bonus Attack Speed: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern INTELLIGENCE_PATTERN = Pattern.compile("^Intelligence: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern SCC_PATTERN = Pattern.compile("^Sea Creature Chance: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern FEROCITY_PATTERN = Pattern.compile("^Ferocity: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern MINING_FORTUNE_PATTERN = Pattern.compile("^Mining Fortune: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern MINING_SPEED_PATTERN = Pattern.compile("^Mining Speed: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); - private static final Pattern MAGIC_FIND_PATTERN = Pattern.compile("^Magic Find: ((?:\\+|-)([0-9]+(\\.[0-9]+)?))"); + + private static final String STAT_PATTERN_END = ": ((?:\\+|-)([0-9]+(\\.[0-9]+)?))%?"; + + private static final Pattern HEALTH_PATTERN = Pattern.compile("^Health"+STAT_PATTERN_END); + private static final Pattern DEFENCE_PATTERN = Pattern.compile("^Defense"+STAT_PATTERN_END); + private static final Pattern STRENGTH_PATTERN = Pattern.compile("^Strength"+STAT_PATTERN_END); + private static final Pattern SPEED_PATTERN = Pattern.compile("^Speed"+STAT_PATTERN_END); + private static final Pattern CC_PATTERN = Pattern.compile("^Crit Chance"+STAT_PATTERN_END); + private static final Pattern CD_PATTERN = Pattern.compile("^Crit Damage"+STAT_PATTERN_END); + private static final Pattern ATKSPEED_PATTERN = Pattern.compile("^Bonus Attack Speed"+STAT_PATTERN_END); + private static final Pattern INTELLIGENCE_PATTERN = Pattern.compile("^Intelligence"+STAT_PATTERN_END); + private static final Pattern SCC_PATTERN = Pattern.compile("^Sea Creature Chance"+STAT_PATTERN_END); + private static final Pattern FEROCITY_PATTERN = Pattern.compile("^Ferocity"+STAT_PATTERN_END); + private static final Pattern MINING_FORTUNE_PATTERN = Pattern.compile("^Mining Fortune"+STAT_PATTERN_END); + private static final Pattern MINING_SPEED_PATTERN = Pattern.compile("^Mining Speed"+STAT_PATTERN_END); + private static final Pattern MAGIC_FIND_PATTERN = Pattern.compile("^Magic Find"+STAT_PATTERN_END); private static final HashMap STAT_PATTERN_MAP = new HashMap<>(); static { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 8a4c697e..0beb8060 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -15,6 +15,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -606,6 +607,9 @@ public class MiningOverlay extends TextOverlay { case "Goblin Raid Slayer": icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ENCHANTED_GOLD")); break; + case "Golden Goblin Slayer": + icon = new ItemStack(Items.golden_helmet, 1, 0); + break; case "2x Mithril Powder Collector": icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ENCHANTED_GLOWSTONE_DUST")); break; -- cgit From 619129352be4a3aa4577060d49b2aa5cf162a432 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 3 Sep 2021 21:58:59 +0200 Subject: fix exp tweaks not working for the rat pet --- .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index e0a36686..38775ee7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2406,7 +2406,7 @@ public class NEUEventListener { } //7 is just a random number i chose, prob no pets with less lines than 7 if (event.toolTip.size() > 7) { - if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) { + if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)|(Morph)).*")) { GuiProfileViewer.PetLevel petlevel = null; -- cgit From 32b6f0d803190b0584ab12a4e1e5043882132b8b Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 7 Sep 2021 12:29:20 +0200 Subject: enable help button by default small change --- .../moulberry/notenoughupdates/options/seperateSections/Toolbar.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java index d45f6406..51092bbe 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java @@ -46,7 +46,7 @@ public class Toolbar { ) @ConfigEditorBoolean @ConfigAccordionId(id = 0) - public boolean enableHelpButton = false; + public boolean enableHelpButton = true; @Expose @ConfigOption( -- cgit From f47adcd23a55bc8e774d33f3725461599c3232c6 Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Tue, 7 Sep 2021 18:37:11 +0200 Subject: add toggle to disable showing the treecap cooldown in item durability --- .../moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java | 4 ++++ .../notenoughupdates/options/seperateSections/ItemOverlays.java | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java index 053910bc..e18c28be 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java @@ -65,6 +65,10 @@ public class ItemCooldowns { } public static long getTreecapCooldownWithPet(){ + if (!NotEnoughUpdates.INSTANCE.config.itemOverlays.enableCooldownInItemDurability){ + return 0; + } + PetInfoOverlay.Pet pet = PetInfoOverlay.getCurrentPet(); if (NotEnoughUpdates.INSTANCE.config.itemOverlays.enableMonkeyCheck && pet != null) { if (pet.petLevel != null && diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java index 4e4524e2..c8515ad1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java @@ -25,6 +25,15 @@ public class ItemOverlays { @ConfigAccordionId(id = 0) public boolean enableTreecapOverlay = true; + @Expose + @ConfigOption( + name = "Show in Item durability", + desc = "Show the cooldown of the Treecapitator in the item durability" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean enableCooldownInItemDurability = true; + @Expose @ConfigOption( name = "Overlay Colour", -- cgit From 5dff658657c24581a6dc30f2b5a4785bde96b8ac Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Tue, 7 Sep 2021 18:39:16 +0200 Subject: fix typo in config Description --- .../notenoughupdates/options/seperateSections/ItemOverlays.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java index c8515ad1..9d0814d5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java @@ -46,7 +46,7 @@ public class ItemOverlays { @Expose @ConfigOption( name = "Enable Monkey Pet Check", - desc = "Will check use the API to check what pet you're using\nto determine the cooldown based off of if you have monkey pet." + desc = "Will check using the API to check what pet you're using\nto determine the cooldown based off of if you have a monkey pet." ) @ConfigEditorBoolean @ConfigAccordionId(id = 0) -- cgit From a373c31ba136020d088c569c76008ecdc7744c3d Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Tue, 7 Sep 2021 21:19:58 +0200 Subject: ah search overlay tab completion --- .../notenoughupdates/overlays/AuctionSearchOverlay.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index 816a6c63..2cfe176b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -20,6 +20,7 @@ import net.minecraft.tileentity.TileEntitySign; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.text.WordUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -334,6 +335,17 @@ public class AuctionSearchOverlay { } else if(Keyboard.getEventKey() == Keyboard.KEY_RETURN) { searchStringExtra = ""; close(); + } else if(Keyboard.getEventKey() == Keyboard.KEY_TAB){ + searchString = autocompletedItems.iterator().next(); + JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next()); + String displayname = repoObject.get("displayname").getAsString(); + if (displayname.contains("Enchanted Book")){ + String lore = repoObject.get("lore").getAsJsonArray().iterator().next().getAsString(); + String name = lore.substring(0, lore.lastIndexOf(" ")); + searchString = Utils.cleanColour(name); + } else { + searchString = Utils.cleanColour(displayname); + } } else if(Keyboard.getEventKeyState()) { textField.setFocus(true); textField.setText(searchString); -- cgit From 4886341cbc1009c1f6a67807f6ed24c28a124884 Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Tue, 7 Sep 2021 21:21:31 +0200 Subject: unused import --- .../github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index 2cfe176b..641f8a93 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -20,7 +20,6 @@ import net.minecraft.tileentity.TileEntitySign; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.text.WordUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -- cgit From 818dc8f0d7711a4036d83db1304f7f776ce47f39 Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Wed, 8 Sep 2021 14:17:55 +0200 Subject: make sure there are autocompleted items --- .../overlays/AuctionSearchOverlay.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index 641f8a93..8b3b21f0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -335,15 +335,17 @@ public class AuctionSearchOverlay { searchStringExtra = ""; close(); } else if(Keyboard.getEventKey() == Keyboard.KEY_TAB){ - searchString = autocompletedItems.iterator().next(); - JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next()); - String displayname = repoObject.get("displayname").getAsString(); - if (displayname.contains("Enchanted Book")){ - String lore = repoObject.get("lore").getAsJsonArray().iterator().next().getAsString(); - String name = lore.substring(0, lore.lastIndexOf(" ")); - searchString = Utils.cleanColour(name); - } else { - searchString = Utils.cleanColour(displayname); + if (!autocompletedItems.isEmpty()) { + searchString = autocompletedItems.iterator().next(); + JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next()); + String displayname = repoObject.get("displayname").getAsString(); + if (displayname.contains("Enchanted Book")){ + String lore = repoObject.get("lore").getAsJsonArray().iterator().next().getAsString(); + String name = lore.substring(0, lore.lastIndexOf(" ")); + searchString = Utils.cleanColour(name); + } else { + searchString = Utils.cleanColour(displayname); + } } } else if(Keyboard.getEventKeyState()) { textField.setFocus(true); -- cgit From fdd335dbf42c792e95cb3cafc1b91821fa2ca00f Mon Sep 17 00:00:00 2001 From: David Mills <85420839+Keebler408@users.noreply.github.com> Date: Thu, 9 Sep 2021 03:48:32 -0500 Subject: Metal detector solver updates - Move beacon beam rendering related code into RenderUtils - Show beacons and labels for metal detector locations - Replace code that Hypixel would likely ban as X-Ray with code based on eliminating duplicate Y values. The number of unique locations for the new code to work is still 2-3, but results in odd locations being treated as valid (mid-air, outside Mines, blocks not exposed to air). This could be made better by detecting the NPCs coordinates to filter valid coordinates. - Add a TODO in reset to add a delay after a chest is found --- .../notenoughupdates/NEUEventListener.java | 4 +- .../core/util/render/RenderUtils.java | 105 +++++++++++++++++++++ .../miscfeatures/CrystalMetalDetectorSolver.java | 104 ++++++++++++++------ .../notenoughupdates/miscfeatures/FairySouls.java | 103 ++------------------ 4 files changed, 188 insertions(+), 128 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 38775ee7..d2603651 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -166,7 +166,7 @@ public class NEUEventListener { @SubscribeEvent public void onWorldLoad(WorldEvent.Unload event) { NotEnoughUpdates.INSTANCE.saveConfig(); - CrystalMetalDetectorSolver.reset(); + CrystalMetalDetectorSolver.reset(false); } private static long notificationDisplayMillis = 0; @@ -862,7 +862,7 @@ public class NEUEventListener { } } if (unformatted.startsWith("You found ") && SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")){ - CrystalMetalDetectorSolver.reset(); + CrystalMetalDetectorSolver.reset(true); } if(unformatted.startsWith("[NPC] Keeper of ") | unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ") || unformatted.startsWith("✦") || unformatted.equals(" You've earned a Crystal Loot Bundle!")) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java index b63831ac..75c4a35a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates.core.util.render; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; +import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -13,6 +14,8 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import org.lwjgl.util.vector.Vector3f; @@ -146,9 +149,111 @@ public class RenderUtils { GlStateManager.enableTexture2D(); } + public static BlockPos getCurrentViewer(float partialTicks) { + double viewerX; + double viewerY; + double viewerZ; + + Vector3f aoteInterpPos = CustomItemEffects.INSTANCE.getCurrentPosition(); + if(aoteInterpPos != null) { + viewerX = aoteInterpPos.x; + viewerY = aoteInterpPos.y; + viewerZ = aoteInterpPos.z; + } else { + Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); + viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; + viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; + viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; + } + + return new BlockPos(viewerX, viewerY, viewerZ); + } + + private static final ResourceLocation beaconBeam = new ResourceLocation("textures/entity/beacon_beam.png"); + + public static void renderBeaconBeam(double x, double y, double z, int rgb, float alphaMult, float partialTicks) { + int height = 300; + int bottomOffset = 0; + int topOffset = bottomOffset + height; + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + Minecraft.getMinecraft().getTextureManager().bindTexture(beaconBeam); + + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GlStateManager.disableLighting(); + GlStateManager.enableCull(); + GlStateManager.enableTexture2D(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); + + double time = Minecraft.getMinecraft().theWorld.getTotalWorldTime() + (double)partialTicks; + double d1 = MathHelper.func_181162_h(-time * 0.2D - (double)MathHelper.floor_double(-time * 0.1D)); + + float r = ((rgb >> 16) & 0xFF) / 255f; + float g = ((rgb >> 8) & 0xFF) / 255f; + float b = (rgb & 0xFF) / 255f; + double d2 = time * 0.025D * -1.5D; + double d4 = 0.5D + Math.cos(d2 + 2.356194490192345D) * 0.2D; + double d5 = 0.5D + Math.sin(d2 + 2.356194490192345D) * 0.2D; + double d6 = 0.5D + Math.cos(d2 + (Math.PI / 4D)) * 0.2D; + double d7 = 0.5D + Math.sin(d2 + (Math.PI / 4D)) * 0.2D; + double d8 = 0.5D + Math.cos(d2 + 3.9269908169872414D) * 0.2D; + double d9 = 0.5D + Math.sin(d2 + 3.9269908169872414D) * 0.2D; + double d10 = 0.5D + Math.cos(d2 + 5.497787143782138D) * 0.2D; + double d11 = 0.5D + Math.sin(d2 + 5.497787143782138D) * 0.2D; + double d14 = -1.0D + d1; + double d15 = (double)(height) * 2.5D + d14; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(1.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); + worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); + worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); + worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(0.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); + worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(1.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); + worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); + worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); + worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(0.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); + worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(1.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); + worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); + worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); + worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(0.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); + worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(1.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); + worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); + worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); + worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(0.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); + tessellator.draw(); + + GlStateManager.disableCull(); + double d12 = -1.0D + d1; + double d13 = height + d12; + + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); + worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); + worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); + worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); + worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); + worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.8D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); + worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.8D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); + worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); + worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); + worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.2D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); + worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.8D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); + worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); + worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); + worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.8D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); + worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); + worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); + tessellator.draw(); + } + public static void renderWayPoint(String str, BlockPos loc, float partialTicks) { renderWayPoint(str, new Vector3f(loc.getX(), loc.getY(), loc.getZ()), partialTicks); } + public static void renderWayPoint(String str, Vector3f loc, float partialTicks) { GlStateManager.alphaFunc(516, 0.1F); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 73e2b412..3fbff9c8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -11,82 +11,106 @@ import java.util.List; public class CrystalMetalDetectorSolver { private static final Minecraft mc = Minecraft.getMinecraft(); - private static BlockPos prevPos; - private static double prevDist = 0; + private static BlockPos prevPlayerPos; + private static double prevDistToTreasure = 0; private static List possibleBlocks = new ArrayList<>(); private static final List locations = new ArrayList<>(); public static void process(IChatComponent message) { if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && message.getUnformattedText().contains("TREASURE: ")) { - double dist = Double.parseDouble(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); - if (NotEnoughUpdates.INSTANCE.config.mining.metalDetectorEnabled && prevDist == dist && prevPos.getX() == mc.thePlayer.getPosition().getX() && - prevPos.getY() == mc.thePlayer.getPosition().getY() && - prevPos.getZ() == mc.thePlayer.getPosition().getZ() && !locations.contains(mc.thePlayer.getPosition())) { + double distToTreasure = Double.parseDouble(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); + if (NotEnoughUpdates.INSTANCE.config.mining.metalDetectorEnabled && prevDistToTreasure == distToTreasure && + prevPlayerPos.getX() == mc.thePlayer.getPosition().getX() && + prevPlayerPos.getY() == mc.thePlayer.getPosition().getY() && + prevPlayerPos.getZ() == mc.thePlayer.getPosition().getZ() && !locations.contains(mc.thePlayer.getPosition())) { if (possibleBlocks.size() == 0) { locations.add(mc.thePlayer.getPosition()); - for (int zOffset = (int) Math.floor(-dist); zOffset <= Math.ceil(dist); zOffset++) { + for (int zOffset = (int) Math.floor(-distToTreasure); zOffset <= Math.ceil(distToTreasure); zOffset++) { for (int y = 65; y <= 75; y++) { double calculatedDist = 0; int xOffset = 0; - while (calculatedDist < dist) { + while (calculatedDist < distToTreasure) { BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, y, Math.floor(mc.thePlayer.posZ) + zOffset); - BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, - y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); - if (round(calculatedDist, 1) == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && - mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { + if (round(calculatedDist, 1) == distToTreasure && !possibleBlocks.contains(pos)) { possibleBlocks.add(pos); } xOffset++; } xOffset = 0; calculatedDist = 0; - while (calculatedDist < dist) { + while (calculatedDist < distToTreasure) { BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, y, Math.floor(mc.thePlayer.posZ) + zOffset); - BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, - y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); - if (round(calculatedDist, 1) == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && - mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { + if (round(calculatedDist, 1) == distToTreasure && !possibleBlocks.contains(pos)) { possibleBlocks.add(pos); } xOffset++; } } } + removeDuplicates(); sendMessage(); } else if (possibleBlocks.size() != 1) { locations.add(mc.thePlayer.getPosition()); List temp = new ArrayList<>(); for (BlockPos pos : possibleBlocks) { - if (round(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)), 1) == dist) { + if (round(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)), 1) == distToTreasure) { temp.add(pos); } } possibleBlocks = temp; + removeDuplicates(); sendMessage(); + } else if (possibleBlocks.size() == 1) { + BlockPos pos = possibleBlocks.get(0); + if (distToTreasure > (5 + getPlayerPos().distanceTo(new Vec3(pos)))) { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Previous solution is invalid.")); + reset(false); + } } + } - prevPos = mc.thePlayer.getPosition(); - prevDist = dist; + + prevPlayerPos = mc.thePlayer.getPosition(); + prevDistToTreasure = distToTreasure; } } - public static void reset() { + public static void reset(Boolean chestFound) { + if (chestFound) { + // TODO: Add a delay to keep the old chest location from being treated as the new chest location + } + possibleBlocks.clear(); locations.clear(); } public static void render(float partialTicks) { + int beaconRGB = 0xa839ce; + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && SBInfo.getInstance().location.equals("Mines of Divan")) { + BlockPos viewer = RenderUtils.getCurrentViewer(partialTicks); + if (possibleBlocks.size() == 1) { + BlockPos block = possibleBlocks.get(0); + double x = block.getX() - viewer.getX(); + double y = block.getY() - viewer.getY(); + double z = block.getZ() - viewer.getZ(); + + RenderUtils.renderBeaconBeam(x, y, z, beaconRGB, 1.0f, partialTicks); RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); } else if (possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { for (BlockPos block : possibleBlocks) { + double x = block.getX() - viewer.getX(); + double y = block.getY() - viewer.getY();; + double z = block.getZ() - viewer.getZ();; + + RenderUtils.renderBeaconBeam(x, y, z, beaconRGB, 1.0f, partialTicks); RenderUtils.renderWayPoint("Possible Treasure Location", block.add(0, 2.5, 0), partialTicks); } } @@ -98,14 +122,34 @@ public class CrystalMetalDetectorSolver { return (double) Math.round(value * scale) / scale; } - private static boolean treasureAllowed(BlockPos pos) { - return mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:gold_block") || - mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:prismarine") || - mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:chest") || - mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_glass") || - mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_glass_pane") || - mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:wool") || - mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_hardened_clay"); + private static void removeDuplicates() { + if (possibleBlocks.size() > 1 && possibleBlocks.size() < 7) { + double firstX = possibleBlocks.get(0).getX(); + double firstZ = possibleBlocks.get(0).getZ(); + Boolean yOnlyDiffers = true; + + double lowestY = possibleBlocks.get(0).getY(); + int lowestYIndex = 0; + + for (int i = 1; i < possibleBlocks.size(); i++) { + BlockPos block = possibleBlocks.get(i); + if (block.getX() != firstX || block.getZ() != firstZ) { + yOnlyDiffers = false; + break; + } + + if (block.getY() < lowestY) { + lowestY = block.getY(); + lowestYIndex = i; + } + } + + if (yOnlyDiffers) { + List temp = new ArrayList<>(); + temp.add(possibleBlocks.get(lowestYIndex)); + possibleBlocks = temp; + } + } } private static void sendMessage() { @@ -114,7 +158,7 @@ public class CrystalMetalDetectorSolver { + possibleBlocks.size())); } else if (possibleBlocks.size() == 0) { mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Failed to find solution.")); - reset(); + reset(false); } else { mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Found solution.")); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java index 05591e81..260b94ae 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java @@ -5,6 +5,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.SBInfo; @@ -166,86 +167,6 @@ public class FairySouls { } } - private static final ResourceLocation beaconBeam = new ResourceLocation("textures/entity/beacon_beam.png"); - - private static void renderBeaconBeam(double x, double y, double z, int rgb, float alphaMult, float partialTicks) { - int height = 300; - int bottomOffset = 0; - int topOffset = bottomOffset + height; - - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - - Minecraft.getMinecraft().getTextureManager().bindTexture(beaconBeam); - GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); - GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); - GlStateManager.disableLighting(); - GlStateManager.enableCull(); - GlStateManager.enableTexture2D(); - GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - - double time = Minecraft.getMinecraft().theWorld.getTotalWorldTime() + (double)partialTicks; - double d1 = MathHelper.func_181162_h(-time * 0.2D - (double)MathHelper.floor_double(-time * 0.1D)); - - float r = ((rgb >> 16) & 0xFF) / 255f; - float g = ((rgb >> 8) & 0xFF) / 255f; - float b = (rgb & 0xFF) / 255f; - double d2 = time * 0.025D * -1.5D; - double d4 = 0.5D + Math.cos(d2 + 2.356194490192345D) * 0.2D; - double d5 = 0.5D + Math.sin(d2 + 2.356194490192345D) * 0.2D; - double d6 = 0.5D + Math.cos(d2 + (Math.PI / 4D)) * 0.2D; - double d7 = 0.5D + Math.sin(d2 + (Math.PI / 4D)) * 0.2D; - double d8 = 0.5D + Math.cos(d2 + 3.9269908169872414D) * 0.2D; - double d9 = 0.5D + Math.sin(d2 + 3.9269908169872414D) * 0.2D; - double d10 = 0.5D + Math.cos(d2 + 5.497787143782138D) * 0.2D; - double d11 = 0.5D + Math.sin(d2 + 5.497787143782138D) * 0.2D; - double d14 = -1.0D + d1; - double d15 = (double)(height) * 2.5D + d14; - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(1.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); - worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(0.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); - worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(1.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); - worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(0.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); - worldrenderer.pos(x + d6, y + topOffset, z + d7).tex(1.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); - worldrenderer.pos(x + d6, y + bottomOffset, z + d7).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d10, y + bottomOffset, z + d11).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d10, y + topOffset, z + d11).tex(0.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); - worldrenderer.pos(x + d8, y + topOffset, z + d9).tex(1.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); - worldrenderer.pos(x + d8, y + bottomOffset, z + d9).tex(1.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d4, y + bottomOffset, z + d5).tex(0.0D, d14).color(r, g, b, 1.0F).endVertex(); - worldrenderer.pos(x + d4, y + topOffset, z + d5).tex(0.0D, d15).color(r, g, b, 1.0F*alphaMult).endVertex(); - tessellator.draw(); - - GlStateManager.disableCull(); - double d12 = -1.0D + d1; - double d13 = height + d12; - - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); - worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); - worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.8D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.8D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.2D).tex(1.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); - worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.2D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + bottomOffset, z + 0.8D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.8D, y + topOffset, z + 0.8D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.8D).tex(1.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); - worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.8D).tex(1.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); - worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); - tessellator.draw(); - } - @SubscribeEvent public void onRenderLast(RenderWorldLastEvent event) { if(!enabled) return; @@ -254,26 +175,16 @@ public class FairySouls { if(location == null) return; if(currentSoulList == null || currentSoulList.isEmpty()) return; - Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); - double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * event.partialTicks; - double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * event.partialTicks; - double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * event.partialTicks; - - Vector3f aoteInterpPos = CustomItemEffects.INSTANCE.getCurrentPosition(); - if(aoteInterpPos != null) { - viewerX = aoteInterpPos.x; - viewerY = aoteInterpPos.y; - viewerZ = aoteInterpPos.z; - } - Set found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); + BlockPos viewer = RenderUtils.getCurrentViewer(event.partialTicks); + int rgb = 0xa839ce; for(int i=0; i 10*10) { - renderBeaconBeam(x, y, z, rgb, 1.0f, event.partialTicks); + RenderUtils.renderBeaconBeam(x, y, z, rgb, 1.0f, event.partialTicks); } } -- cgit From 935ecebae26a2551ab330e0f0e28c8233df852e8 Mon Sep 17 00:00:00 2001 From: David Mills <85420839+Keebler408@users.noreply.github.com> Date: Thu, 9 Sep 2021 11:21:08 -0500 Subject: Use proximity for dupes, delay after finding chest --- .../miscfeatures/CrystalMetalDetectorSolver.java | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 3fbff9c8..b457f274 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -16,7 +16,24 @@ public class CrystalMetalDetectorSolver { private static List possibleBlocks = new ArrayList<>(); private static final List locations = new ArrayList<>(); + private static Boolean chestRecentlyFound = false; + private static long chestLastFoundMillis = 0; + public static void process(IChatComponent message) { + // Delay to keep old chest location from being treated as the new chest location + if (chestRecentlyFound) { + long currentTimeMillis = System.currentTimeMillis(); + if (chestLastFoundMillis == 0) { + chestLastFoundMillis = currentTimeMillis; + return; + } else if(currentTimeMillis - chestLastFoundMillis < 1000) { + return; + } + + chestLastFoundMillis = 0; + chestRecentlyFound = false; + } + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && message.getUnformattedText().contains("TREASURE: ")) { double distToTreasure = Double.parseDouble(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); @@ -81,10 +98,7 @@ public class CrystalMetalDetectorSolver { } public static void reset(Boolean chestFound) { - if (chestFound) { - // TODO: Add a delay to keep the old chest location from being treated as the new chest location - } - + chestRecentlyFound = chestFound; possibleBlocks.clear(); locations.clear(); } @@ -124,27 +138,28 @@ public class CrystalMetalDetectorSolver { private static void removeDuplicates() { if (possibleBlocks.size() > 1 && possibleBlocks.size() < 7) { - double firstX = possibleBlocks.get(0).getX(); - double firstZ = possibleBlocks.get(0).getZ(); - Boolean yOnlyDiffers = true; + Vec3 firstBlockVec = new Vec3( possibleBlocks.get(0).getX(), 0, possibleBlocks.get(0).getZ()); + Boolean allBlocksAreClose = true; double lowestY = possibleBlocks.get(0).getY(); int lowestYIndex = 0; for (int i = 1; i < possibleBlocks.size(); i++) { - BlockPos block = possibleBlocks.get(i); - if (block.getX() != firstX || block.getZ() != firstZ) { - yOnlyDiffers = false; + BlockPos blockPos = possibleBlocks.get(i); + Vec3 blockVec = new Vec3(blockPos.getX(), 0, blockPos.getZ()); + + if (firstBlockVec.distanceTo(blockVec) > 3) { + allBlocksAreClose = false; break; } - if (block.getY() < lowestY) { - lowestY = block.getY(); + if (blockPos.getY() < lowestY) { + lowestY = blockPos.getY(); lowestYIndex = i; } } - if (yOnlyDiffers) { + if (allBlocksAreClose) { List temp = new ArrayList<>(); temp.add(possibleBlocks.get(lowestYIndex)); possibleBlocks = temp; -- cgit From 29cea4c4922443ae78c47cd49e4a74ab67eb15f2 Mon Sep 17 00:00:00 2001 From: David Mills <85420839+Keebler408@users.noreply.github.com> Date: Fri, 10 Sep 2021 08:11:15 -0500 Subject: Small tweaks based on more testing --- .../notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index b457f274..1172f1c5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -118,7 +118,8 @@ public class CrystalMetalDetectorSolver { RenderUtils.renderBeaconBeam(x, y, z, beaconRGB, 1.0f, partialTicks); RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); - } else if (possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { + } else if (possibleBlocks.size() > 1 && (locations.size() > 1 || possibleBlocks.size() < 10) && + NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { for (BlockPos block : possibleBlocks) { double x = block.getX() - viewer.getX(); double y = block.getY() - viewer.getY();; @@ -137,7 +138,7 @@ public class CrystalMetalDetectorSolver { } private static void removeDuplicates() { - if (possibleBlocks.size() > 1 && possibleBlocks.size() < 7) { + if (possibleBlocks.size() > 1 && possibleBlocks.size() < 10) { Vec3 firstBlockVec = new Vec3( possibleBlocks.get(0).getX(), 0, possibleBlocks.get(0).getZ()); Boolean allBlocksAreClose = true; -- cgit From e0a71fdc7a1bf466992fc6db96a15b778909cc18 Mon Sep 17 00:00:00 2001 From: David Mills <85420839+Keebler408@users.noreply.github.com> Date: Sat, 11 Sep 2021 10:35:55 -0500 Subject: Fix jitter, improve metal detector beacon - Fix jitter caused by location coord truncation from double to int - Move remaining fairy souls beacon rendering into RenderUtils.java - Add beacon option to enable depth testing when player is close by - Use new rendering for metal detector to make beacons more visible --- .../core/util/render/RenderUtils.java | 112 ++++++++++++++++----- .../miscfeatures/CrystalMetalDetectorSolver.java | 12 +-- .../notenoughupdates/miscfeatures/FairySouls.java | 32 +----- 3 files changed, 89 insertions(+), 67 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java index 75c4a35a..5f0ad94f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.core.util.render; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects; +import io.github.moulberry.notenoughupdates.util.SpecialColour; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -12,10 +13,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; +import net.minecraft.util.*; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; import org.lwjgl.util.vector.Vector3f; @@ -149,29 +147,10 @@ public class RenderUtils { GlStateManager.enableTexture2D(); } - public static BlockPos getCurrentViewer(float partialTicks) { - double viewerX; - double viewerY; - double viewerZ; - - Vector3f aoteInterpPos = CustomItemEffects.INSTANCE.getCurrentPosition(); - if(aoteInterpPos != null) { - viewerX = aoteInterpPos.x; - viewerY = aoteInterpPos.y; - viewerZ = aoteInterpPos.z; - } else { - Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); - viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; - viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; - viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; - } - - return new BlockPos(viewerX, viewerY, viewerZ); - } - private static final ResourceLocation beaconBeam = new ResourceLocation("textures/entity/beacon_beam.png"); - public static void renderBeaconBeam(double x, double y, double z, int rgb, float alphaMult, float partialTicks) { + private static void renderBeaconBeam(double x, double y, double z, int rgb, float alphaMult, + float partialTicks, Boolean disableDepth) { int height = 300; int bottomOffset = 0; int topOffset = bottomOffset + height; @@ -179,8 +158,11 @@ public class RenderUtils { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - Minecraft.getMinecraft().getTextureManager().bindTexture(beaconBeam); + if (disableDepth) { + GlStateManager.disableDepth(); + } + Minecraft.getMinecraft().getTextureManager().bindTexture(beaconBeam); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); GlStateManager.disableLighting(); @@ -248,6 +230,84 @@ public class RenderUtils { worldrenderer.pos(x + 0.2D, y + bottomOffset, z + 0.2D).tex(0.0D, d12).color(r, g, b, 0.25F).endVertex(); worldrenderer.pos(x + 0.2D, y + topOffset, z + 0.2D).tex(0.0D, d13).color(r, g, b, 0.25F*alphaMult).endVertex(); tessellator.draw(); + + GlStateManager.disableLighting(); + GlStateManager.enableTexture2D(); + if (disableDepth) { + GlStateManager.enableDepth(); + } + } + + private static void renderBoundingBox(double x, double y, double z, int rgb, float alphaMult, float partialTicks) { + AxisAlignedBB bb = new AxisAlignedBB(x, y, z, x+1, y+1, z+1); + + GlStateManager.disableDepth(); + GlStateManager.disableCull(); + GlStateManager.disableTexture2D(); + CustomItemEffects.drawFilledBoundingBox(bb, 1f, SpecialColour.special(0, 100, rgb)); + GlStateManager.enableTexture2D(); + GlStateManager.enableCull(); + GlStateManager.enableDepth(); + } + + public static void renderBeaconBeam(BlockPos block, int rgb, float alphaMult, float partialTicks) { + double viewerX; + double viewerY; + double viewerZ; + + Vector3f aoteInterpPos = CustomItemEffects.INSTANCE.getCurrentPosition(); + if(aoteInterpPos != null) { + viewerX = aoteInterpPos.x; + viewerY = aoteInterpPos.y; + viewerZ = aoteInterpPos.z; + } else { + Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); + viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; + viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; + viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; + } + + double x = block.getX() - viewerX; + double y = block.getY() - viewerY; + double z = block.getZ() - viewerZ; + + double distSq = x*x + y*y + z*z; + + if(distSq > 10*10) { + RenderUtils.renderBeaconBeam(x, y, z, rgb, 1.0f, partialTicks, true); + } else { + RenderUtils.renderBeaconBeam(x, y, z, rgb, 1.0f, partialTicks, false); + } + } + + public static void renderBeaconBeamOrBoundingBox(BlockPos block, int rgb, float alphaMult, float partialTicks) { + double viewerX; + double viewerY; + double viewerZ; + + Vector3f aoteInterpPos = CustomItemEffects.INSTANCE.getCurrentPosition(); + if(aoteInterpPos != null) { + viewerX = aoteInterpPos.x; + viewerY = aoteInterpPos.y; + viewerZ = aoteInterpPos.z; + } else { + Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); + viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; + viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; + viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; + } + + double x = block.getX() - viewerX; + double y = block.getY() - viewerY; + double z = block.getZ() - viewerZ; + + double distSq = x*x + y*y + z*z; + + if(distSq > 10*10) { + RenderUtils.renderBeaconBeam(x, y, z, rgb, 1.0f, partialTicks, true); + } else { + RenderUtils.renderBoundingBox(x, y, z, rgb, 1.0f, partialTicks); + } } public static void renderWayPoint(String str, BlockPos loc, float partialTicks) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 1172f1c5..5e9c59ac 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -108,24 +108,16 @@ public class CrystalMetalDetectorSolver { if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && SBInfo.getInstance().location.equals("Mines of Divan")) { - BlockPos viewer = RenderUtils.getCurrentViewer(partialTicks); if (possibleBlocks.size() == 1) { BlockPos block = possibleBlocks.get(0); - double x = block.getX() - viewer.getX(); - double y = block.getY() - viewer.getY(); - double z = block.getZ() - viewer.getZ(); - RenderUtils.renderBeaconBeam(x, y, z, beaconRGB, 1.0f, partialTicks); + RenderUtils.renderBeaconBeam(block, beaconRGB, 1.0f, partialTicks); RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); } else if (possibleBlocks.size() > 1 && (locations.size() > 1 || possibleBlocks.size() < 10) && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { for (BlockPos block : possibleBlocks) { - double x = block.getX() - viewer.getX(); - double y = block.getY() - viewer.getY();; - double z = block.getZ() - viewer.getZ();; - - RenderUtils.renderBeaconBeam(x, y, z, beaconRGB, 1.0f, partialTicks); + RenderUtils.renderBeaconBeam(block, beaconRGB, 1.0f, partialTicks); RenderUtils.renderWayPoint("Possible Treasure Location", block.add(0, 2.5, 0), partialTicks); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java index 260b94ae..ac1d2fd9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java @@ -6,26 +6,17 @@ import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; -import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.SpecialColour; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.command.ICommandSender; -import net.minecraft.entity.Entity; import net.minecraft.util.*; -import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import org.lwjgl.opengl.GL11; -import org.lwjgl.util.vector.Vector3f; import java.io.*; import java.nio.charset.StandardCharsets; @@ -177,32 +168,11 @@ public class FairySouls { Set found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); - BlockPos viewer = RenderUtils.getCurrentViewer(event.partialTicks); - int rgb = 0xa839ce; for(int i=0; i 10*10) { - RenderUtils.renderBeaconBeam(x, y, z, rgb, 1.0f, event.partialTicks); - } + RenderUtils.renderBeaconBeamOrBoundingBox(currentSoul, rgb, 1.0f, event.partialTicks); } - - GlStateManager.disableLighting(); - GlStateManager.enableTexture2D(); - GlStateManager.enableDepth(); } public static class FairySoulsCommandAlt extends SimpleCommand { -- cgit From f92d9b4d2371f430bbeb3d4d02ed7d00ad3bc3e5 Mon Sep 17 00:00:00 2001 From: DoKM <54663875+DoKM@users.noreply.github.com> Date: Sat, 11 Sep 2021 18:36:24 +0200 Subject: Create new patch notes --- Update Notes/2.0-Pre31-Release.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Update Notes/2.0-Pre31-Release.md diff --git a/Update Notes/2.0-Pre31-Release.md b/Update Notes/2.0-Pre31-Release.md new file mode 100644 index 00000000..2ebf1d8c --- /dev/null +++ b/Update Notes/2.0-Pre31-Release.md @@ -0,0 +1,30 @@ +# These are the change notes for PRE31-Release + +### **Major Changes** +- Changes to the metal detector (https://github.com/DoKM/NotEnoughUpdates/pull/32) (Keebler408) + + +### **Minor Changes:** +- Added a check to see if the storagegui is on before yelling at you for having fastrender on. +- Added toggle to disable showing the treecap cooldown in item durability. (Lulonaut) + + +### **Bug Fixes** +- Fixed a nullpointer exception in dwarven textures (not fully tested). +- Fixed neuec not parsing correctly. +- Fixed crashing when you copy text while in the neuec/neu buttons editor menu. +- Fixed crash when collecting supper pairs (nullpointer). +- Fixed accessory bag overlay not counting stats with a %. +- Fixed golden goblin not having a icon. + + +### **Other** +- Enabled help button by default + + +### **Notes for texturepack creators** + + +### **Previous change log** +https://github.com/DoKM/NotEnoughUpdates/blob/master/Update%20Notes/2.0-Pre31.md + -- cgit From 77e6ac2fa318dec4add929f85992ddff7201d486 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 11 Sep 2021 15:48:07 -0400 Subject: increase max string length for item editing --- .../moulberry/notenoughupdates/itemeditor/GuiElementTextField.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java index 7b279ac9..b460af36 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/GuiElementTextField.java @@ -42,7 +42,7 @@ public class GuiElementTextField extends GuiElement { public GuiElementTextField(String initialText, int options) { textField.setFocused(true); textField.setCanLoseFocus(false); - textField.setMaxStringLength(999); + textField.setMaxStringLength(9999); textField.setText(initialText); this.options = options; } -- cgit From eca2d88ab5f360bd9923879223d0d854a5fa78f2 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 12 Sep 2021 21:01:16 +0200 Subject: Add text to inform the user to /api new after waiting in the pv also call them a maniac for waiting too long --- .../profileviewer/GuiProfileViewer.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index d84038fa..c5bfc057 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -279,6 +279,40 @@ public class GuiProfileViewer extends GuiScreen { Utils.drawStringCentered(str, Minecraft.getMinecraft().fontRendererObj, guiLeft+sizeX/2f, guiTop+101, true, 0); + + //This is just here to inform the player what to do + //like typing /api new or telling them to go find a psychotherapist + long timeDiff = System.currentTimeMillis() - startTime; + if(timeDiff > 20000){ + Utils.drawStringCentered(EnumChatFormatting.YELLOW+"Its taking a while...", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+111, true, 0); + Utils.drawStringCentered(EnumChatFormatting.YELLOW+"Try \"/api new\".", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+121, true, 0); + if(timeDiff > 60000){ + Utils.drawStringCentered(EnumChatFormatting.YELLOW+"Might be hypixel's fault.", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+131, true, 0); + if(timeDiff > 180000){ + Utils.drawStringCentered(EnumChatFormatting.YELLOW+"Wow you're still here?", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+141, true, 0); + if(timeDiff > 360000){ + long second = (timeDiff / 1000) % 60; + long minute = (timeDiff / (1000 * 60)) % 60; + long hour = (timeDiff / (1000 * 60 * 60)) % 24; + + String time = String.format("%02d:%02d:%02d", hour, minute, second); + Utils.drawStringCentered(EnumChatFormatting.YELLOW+"You've wasted your time here for: "+time, Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+151, true, 0); + Utils.drawStringCentered(EnumChatFormatting.YELLOW+""+EnumChatFormatting.BOLD+"What are you doing with your life?", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+161, true, 0); + if(timeDiff > 600000){ + Utils.drawStringCentered(EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"Maniac", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+171, true, 0); + } + } + } + } + } + break; case INVALID_NAME: Utils.drawStringCentered(EnumChatFormatting.RED+"Invalid name or API is down!", Minecraft.getMinecraft().fontRendererObj, -- cgit From 8f7dd510c4245deae31c301660f6b55edab32ac3 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 13 Sep 2021 21:58:13 +0200 Subject: Fix accessory bag overlay's reforge stats detection --- .../github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index ec676ec5..ee83cb28 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -752,7 +752,7 @@ public class AccessoryBagOverlay { } }*/ - private static final String STAT_PATTERN_BONUS_END = ": (?:\\+|-)[0-9]+(?:\\.[0-9]+)?\\%? \\([a-zA-Z]+ ((?:\\+|-)[0-9]+)%?"; + private static final String STAT_PATTERN_BONUS_END = ": (?:\\+|-)[0-9]+(?:\\.[0-9]+)?\\%? \\(((?:\\+|-)[0-9]+)%?"; private static final Pattern HEALTH_PATTERN_BONUS = Pattern.compile("^Health"+STAT_PATTERN_BONUS_END); private static final Pattern DEFENCE_PATTERN_BONUS = Pattern.compile("^Defense"+STAT_PATTERN_BONUS_END); -- cgit From df79de1b28b31421a205624098d60bd07c358b51 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 14 Sep 2021 22:37:02 +0200 Subject: Fix hypixel breaking custom enchant colours and add counter enchant support --- .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index d2603651..716c62c1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2073,7 +2073,7 @@ public class NEUEventListener { Pattern pattern; try { pattern = Pattern.compile("(\\u00A79|\\u00A79\\u00A7d\\u00A7l)("+enchantName+") " + - "([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX))(,|$)"); + "(?[0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX))((\\u00A79)?,|( \\u00A78(?:,?[0-9]+)*)?$)"); } catch(Exception e) {continue;} //malformed regex Matcher matcher = pattern.matcher(line); int matchCount = 0; @@ -2082,7 +2082,7 @@ public class NEUEventListener { matchCount++; int level = -1; - String levelStr = matcher.group(matcher.groupCount()-2); + String levelStr = matcher.group("level"); if(levelStr == null) continue; try { level = Integer.parseInt(levelStr); -- cgit From 0757e5f0b482b8849b4b13338fd25e8d9755353f Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 15 Sep 2021 21:11:02 +0200 Subject: Add SecondPfirsisch's cape --- .../notenoughupdates/cosmetics/CapeManager.java | 2 ++ .../assets/notenoughupdates/capes/secondpfirsisch.png | Bin 0 -> 58167 bytes .../notenoughupdates/capes/secondpfirsisch_preview.png | Bin 0 -> 38433 bytes 3 files changed, 2 insertions(+) create mode 100644 src/main/resources/assets/notenoughupdates/capes/secondpfirsisch.png create mode 100644 src/main/resources/assets/notenoughupdates/capes/secondpfirsisch_preview.png diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 75a63644..68422f87 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -76,6 +76,8 @@ public class CapeManager { new CapeData("zera", false, true), new CapeData("soldier", false, true), new CapeData("alexxoffi", false, true), + new CapeData("secondpfirsisch", false, true), + //Patreon new CapeData("patreon1", false, false), diff --git a/src/main/resources/assets/notenoughupdates/capes/secondpfirsisch.png b/src/main/resources/assets/notenoughupdates/capes/secondpfirsisch.png new file mode 100644 index 00000000..66314629 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/capes/secondpfirsisch.png differ diff --git a/src/main/resources/assets/notenoughupdates/capes/secondpfirsisch_preview.png b/src/main/resources/assets/notenoughupdates/capes/secondpfirsisch_preview.png new file mode 100644 index 00000000..2be61fee Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/capes/secondpfirsisch_preview.png differ -- cgit From 2805a0f401e4276403151077e79b3b6df2f892ca Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 17 Sep 2021 18:36:40 +0200 Subject: Fix not being able to press repeat keys in chat --- .../io/github/moulberry/notenoughupdates/NEUEventListener.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 716c62c1..e18571c5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -19,10 +19,7 @@ import io.github.moulberry.notenoughupdates.overlays.*; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.util.*; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.*; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiEditSign; @@ -206,7 +203,9 @@ public class NEUEventListener { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - Keyboard.enableRepeatEvents(false); + if(Minecraft.getMinecraft().currentScreen == null || !(Minecraft.getMinecraft().currentScreen instanceof GuiChat)) { + Keyboard.enableRepeatEvents(false); + } if(event.phase != TickEvent.Phase.START) return; if(Minecraft.getMinecraft().theWorld == null) return; if(Minecraft.getMinecraft().thePlayer == null) return; -- cgit From 09a766bf5af91cb1842327adcc1894bb81c71054 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 19 Sep 2021 18:19:27 +0200 Subject: Add Stormy_LH cape --- .../notenoughupdates/cosmetics/CapeManager.java | 1 + .../assets/notenoughupdates/capes/stormy_lh.png | Bin 0 -> 56764 bytes .../assets/notenoughupdates/capes/stormy_lh_preview.png | Bin 0 -> 12899 bytes 3 files changed, 1 insertion(+) create mode 100644 src/main/resources/assets/notenoughupdates/capes/stormy_lh.png create mode 100644 src/main/resources/assets/notenoughupdates/capes/stormy_lh_preview.png diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 68422f87..cb5bd1e8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -77,6 +77,7 @@ public class CapeManager { new CapeData("soldier", false, true), new CapeData("alexxoffi", false, true), new CapeData("secondpfirsisch", false, true), + new CapeData("stormy_lh", false, true), //Patreon diff --git a/src/main/resources/assets/notenoughupdates/capes/stormy_lh.png b/src/main/resources/assets/notenoughupdates/capes/stormy_lh.png new file mode 100644 index 00000000..aba13112 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/capes/stormy_lh.png differ diff --git a/src/main/resources/assets/notenoughupdates/capes/stormy_lh_preview.png b/src/main/resources/assets/notenoughupdates/capes/stormy_lh_preview.png new file mode 100644 index 00000000..6a9b43d0 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/capes/stormy_lh_preview.png differ -- cgit From 2131cedf60e9dfcc5016141af8c936d3f627900c Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 19 Sep 2021 18:27:05 +0200 Subject: reorder the capes to from special to most wide spread --- .../notenoughupdates/cosmetics/CapeManager.java | 80 +++++++++++----------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index cb5bd1e8..66fb5637 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -67,50 +67,52 @@ public class CapeManager { } public CapeData[] capes = new CapeData[]{ - //Content Creator - new CapeData("jakethybro", false, true), - new CapeData("krusty", false, true), - new CapeData("krusty_day", false, true), - new CapeData("krusty_sunset", false, true), - new CapeData("krusty_night", false, true), - new CapeData("zera", false, true), - new CapeData("soldier", false, true), - new CapeData("alexxoffi", false, true), - new CapeData("secondpfirsisch", false, true), - new CapeData("stormy_lh", false, true), - - - //Patreon - new CapeData("patreon1", false, false), - new CapeData("patreon2", false, false), - new CapeData("fade", false, false), - new CapeData("space", false, false), - new CapeData("mcworld", false, false), - new CapeData("negative", false, false), - new CapeData("void", false, false), - new CapeData("lava", false, false), - new CapeData("tunnel", false, false), - new CapeData("planets", false, false), //Admins - new CapeData("nullzee", true, false), - new CapeData("ironmoon", true, false), - new CapeData("gravy", true, false), + new CapeData("nullzee", true, false), + new CapeData("ironmoon", true, false), + new CapeData("gravy", true, false), + + //Special Other + new CapeData("contrib", true, false), + new CapeData("mbstaff", true, false), //Partner - new CapeData("thebakery", true, false), - new CapeData("furf", true, false), - new CapeData("dsm", true, false), - new CapeData("skyclient", true, false), - new CapeData("subreddit_dark", true, false), - new CapeData("subreddit_light", true, false), - new CapeData("packshq", true, false), - new CapeData("skytils", true, false), - new CapeData("sbp", true, false), + new CapeData("thebakery", true, false), + new CapeData("furf", true, false), + new CapeData("dsm", true, false), + new CapeData("skyclient", true, false), + new CapeData("subreddit_dark", true, false), + new CapeData("subreddit_light", true, false), + new CapeData("packshq", true, false), + new CapeData("skytils", true, false), + new CapeData("sbp", true, false), + + //Content Creator + new CapeData("jakethybro", false, true), + new CapeData("krusty", false, true), + new CapeData("krusty_day", false, true), + new CapeData("krusty_sunset", false, true), + new CapeData("krusty_night", false, true), + new CapeData("zera", false, true), + new CapeData("soldier", false, true), + new CapeData("alexxoffi", false, true), + new CapeData("secondpfirsisch", false, true), + new CapeData("stormy_lh", false, true), + + //Patreon + new CapeData("patreon1", false, false), + new CapeData("patreon2", false, false), + new CapeData("fade", false, false), + new CapeData("space", false, false), + new CapeData("mcworld", false, false), + new CapeData("negative", false, false), + new CapeData("void", false, false), + new CapeData("lava", false, false), + new CapeData("tunnel", false, false), + new CapeData("planets", false, false) + - //Special Other - new CapeData("contrib", true, false), - new CapeData("mbstaff", true, false) }; /*private String[] capes = new String[]{"patreon1", "patreon2", "fade", "contrib", "nullzee", -- cgit From 54749d3855cfa5202e5d15363b44c7f4f121c4cf Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 19 Sep 2021 23:05:05 +0200 Subject: Change neu's crit commas to represent hypixel's crits --- .../moulberry/notenoughupdates/miscfeatures/DamageCommas.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java index a73320fc..aafcfb4d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DamageCommas.java @@ -18,7 +18,7 @@ public class DamageCommas { private static final WeakHashMap replacementMap = new WeakHashMap<>(); - private static final EnumChatFormatting[] colours = {EnumChatFormatting.RED, EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.WHITE}; + private static final EnumChatFormatting[] coloursHypixel = {EnumChatFormatting.WHITE, EnumChatFormatting.YELLOW, EnumChatFormatting.GOLD, EnumChatFormatting.RED, EnumChatFormatting.RED, EnumChatFormatting.WHITE}; private static final char STAR = '\u2727'; private static final Pattern PATTERN_CRIT = Pattern.compile("\u00a7f"+STAR+"((?:\u00a7.\\d)+)\u00a7."+STAR+"(.*)"); @@ -81,7 +81,11 @@ public class DamageCommas { int colourIndex = 0; for(char c : newFormatted.toString().toCharArray()) { - newFormattedCrit.append(colours[colourIndex++ % colours.length]); + if(c == ',') { + newFormattedCrit.append(EnumChatFormatting.GRAY); + } else { + newFormattedCrit.append(coloursHypixel[colourIndex++ % coloursHypixel.length]); + } newFormattedCrit.append(c); } -- cgit From 578cf3d6e3ac9cfa62e8ac9b2fc9a630f7951609 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 20 Sep 2021 21:30:24 +0200 Subject: Fix gemstone gauntlet/Divan Drill not being recognised as mining tools --- .../github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java index e18c28be..7a37c0ce 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java @@ -123,6 +123,10 @@ public class ItemCooldowns { if(lastChar >= '0' && lastChar <= '9') { return true; } + } else if(internalname.equals("DIVAN_DRILL")){ + return true; + } else if(internalname.equals("GEMSTONE_GAUNTLET")){ + return true; } return false; } -- cgit From 75f6f7ba851fb0f7645da41c26b9c0eb2286512b Mon Sep 17 00:00:00 2001 From: DoKM <54663875+DoKM@users.noreply.github.com> Date: Tue, 21 Sep 2021 13:45:00 +0200 Subject: Fix morph pets not working --- .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index e18571c5..212bb8a4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2405,7 +2405,7 @@ public class NEUEventListener { } //7 is just a random number i chose, prob no pets with less lines than 7 if (event.toolTip.size() > 7) { - if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)|(Morph)).*")) { + if (Utils.cleanColour(event.toolTip.get(1)).matches(petToolTipRegex)) { GuiProfileViewer.PetLevel petlevel = null; @@ -2441,12 +2441,14 @@ public class NEUEventListener { } return tooltipText; } + + private static final String petToolTipRegex = "((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)|(Morph)).*"; private void petToolTipXPExtendPetMenu(ItemTooltipEvent event) { if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { //7 is just a random number i chose, prob no pets with less lines than 7 if (event.toolTip.size() > 7) { - if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) { + if (Utils.cleanColour(event.toolTip.get(1)).matches(petToolTipRegex)) { GuiProfileViewer.PetLevel petlevel = null; int xpLine = -1; -- cgit From cf875e94e8eb0b827e1a7b6c8e24c3f562db3c0c Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 21 Sep 2021 22:01:25 +0200 Subject: Add support for the new arrows in neu pv --- .../notenoughupdates/profileviewer/GuiProfileViewer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index c5bfc057..a2f78e22 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1910,14 +1910,15 @@ public class GuiProfileViewer extends GuiScreen { } - public int countItemsInInventory(String internalname, JsonObject inventoryInfo, String... invsToSearch) { + public int countItemsInInventory(String internalname, JsonObject inventoryInfo, boolean specific, String... invsToSearch) { int count = 0; for(String inv : invsToSearch) { JsonArray invItems = inventoryInfo.get(inv).getAsJsonArray(); for(int i=0; i Date: Fri, 24 Sep 2021 17:27:39 +0200 Subject: revert some metal detector solver changes --- .../miscfeatures/CrystalMetalDetectorSolver.java | 66 ++++++++-------------- 1 file changed, 22 insertions(+), 44 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 5e9c59ac..b2cd7cb2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -26,7 +26,7 @@ public class CrystalMetalDetectorSolver { if (chestLastFoundMillis == 0) { chestLastFoundMillis = currentTimeMillis; return; - } else if(currentTimeMillis - chestLastFoundMillis < 1000) { + } else if (currentTimeMillis - chestLastFoundMillis < 1000) { return; } @@ -51,7 +51,8 @@ public class CrystalMetalDetectorSolver { BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, y, Math.floor(mc.thePlayer.posZ) + zOffset); calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); - if (round(calculatedDist, 1) == distToTreasure && !possibleBlocks.contains(pos)) { + if (round(calculatedDist, 1) == distToTreasure && !possibleBlocks.contains(pos) && treasureAllowed(pos) && mc.theWorld. + getBlockState(pos.add(0, 1, 0)).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); } xOffset++; @@ -62,14 +63,14 @@ public class CrystalMetalDetectorSolver { BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, y, Math.floor(mc.thePlayer.posZ) + zOffset); calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); - if (round(calculatedDist, 1) == distToTreasure && !possibleBlocks.contains(pos)) { + if (round(calculatedDist, 1) == distToTreasure && !possibleBlocks.contains(pos) && treasureAllowed(pos) && mc.theWorld. + getBlockState(pos.add(0, 1, 0)).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); } xOffset++; } } } - removeDuplicates(); sendMessage(); } else if (possibleBlocks.size() != 1) { locations.add(mc.thePlayer.getPosition()); @@ -80,11 +81,10 @@ public class CrystalMetalDetectorSolver { } } possibleBlocks = temp; - removeDuplicates(); sendMessage(); - } else if (possibleBlocks.size() == 1) { - BlockPos pos = possibleBlocks.get(0); - if (distToTreasure > (5 + getPlayerPos().distanceTo(new Vec3(pos)))) { + } else { + BlockPos pos = possibleBlocks.get(0); + if (Math.abs(distToTreasure - (getPlayerPos().distanceTo(new Vec3(pos)))) > 5) { mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Previous solution is invalid.")); reset(false); } @@ -104,7 +104,7 @@ public class CrystalMetalDetectorSolver { } public static void render(float partialTicks) { - int beaconRGB = 0xa839ce; + int beaconRGB = 0xffdf00; if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && SBInfo.getInstance().location.equals("Mines of Divan")) { @@ -112,12 +112,11 @@ public class CrystalMetalDetectorSolver { if (possibleBlocks.size() == 1) { BlockPos block = possibleBlocks.get(0); - RenderUtils.renderBeaconBeam(block, beaconRGB, 1.0f, partialTicks); + RenderUtils.renderBeaconBeam(block.add(0,1,0), beaconRGB, 1.0f, partialTicks); RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); - } else if (possibleBlocks.size() > 1 && (locations.size() > 1 || possibleBlocks.size() < 10) && - NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { + } else if (possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { for (BlockPos block : possibleBlocks) { - RenderUtils.renderBeaconBeam(block, beaconRGB, 1.0f, partialTicks); + RenderUtils.renderBeaconBeam(block.add(0,1,0), beaconRGB, 1.0f, partialTicks); RenderUtils.renderWayPoint("Possible Treasure Location", block.add(0, 2.5, 0), partialTicks); } } @@ -129,37 +128,6 @@ public class CrystalMetalDetectorSolver { return (double) Math.round(value * scale) / scale; } - private static void removeDuplicates() { - if (possibleBlocks.size() > 1 && possibleBlocks.size() < 10) { - Vec3 firstBlockVec = new Vec3( possibleBlocks.get(0).getX(), 0, possibleBlocks.get(0).getZ()); - Boolean allBlocksAreClose = true; - - double lowestY = possibleBlocks.get(0).getY(); - int lowestYIndex = 0; - - for (int i = 1; i < possibleBlocks.size(); i++) { - BlockPos blockPos = possibleBlocks.get(i); - Vec3 blockVec = new Vec3(blockPos.getX(), 0, blockPos.getZ()); - - if (firstBlockVec.distanceTo(blockVec) > 3) { - allBlocksAreClose = false; - break; - } - - if (blockPos.getY() < lowestY) { - lowestY = blockPos.getY(); - lowestYIndex = i; - } - } - - if (allBlocksAreClose) { - List temp = new ArrayList<>(); - temp.add(possibleBlocks.get(lowestYIndex)); - possibleBlocks = temp; - } - } - } - private static void sendMessage() { if (possibleBlocks.size() > 1) { mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Need another position to find solution. Possible blocks: " @@ -175,4 +143,14 @@ public class CrystalMetalDetectorSolver { private static Vec3 getPlayerPos() { return new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + (mc.thePlayer.getEyeHeight() - mc.thePlayer.getDefaultEyeHeight()), mc.thePlayer.posZ); } + + private static boolean treasureAllowed(BlockPos pos) { + return mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:gold_block") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:prismarine") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:chest") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_glass") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_glass_pane") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:wool") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_hardened_clay"); + } } -- cgit From 8ddbfb076daed44d9eac635882f9b7a0a0642e97 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 24 Sep 2021 19:34:54 +0200 Subject: Fix neuec v2 --- .../github/moulberry/notenoughupdates/NEUEventListener.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 212bb8a4..9344649f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2071,13 +2071,14 @@ public class NEUEventListener { //9([a-zA-Z ]+?) ([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X))(,|$) Pattern pattern; try { - pattern = Pattern.compile("(\\u00A79|\\u00A79\\u00A7d\\u00A7l)("+enchantName+") " + + pattern = Pattern.compile("(\\u00A79|\\u00A7(9|l)\\u00A7d\\u00A7l)(?"+enchantName+") " + "(?[0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX))((\\u00A79)?,|( \\u00A78(?:,?[0-9]+)*)?$)"); } catch(Exception e) {continue;} //malformed regex Matcher matcher = pattern.matcher(line); int matchCount = 0; while(matcher.find() && matchCount < 5) { - if(Utils.cleanColour(matcher.group(2)).startsWith(" ")) continue; + if(Utils.cleanColour(matcher.group("enchantName")).startsWith(" ")) continue; + matchCount++; int level = -1; @@ -2141,7 +2142,7 @@ public class NEUEventListener { } } if(matches) { - String enchantText = matcher.group(2); + String enchantText = matcher.group("enchantName"); StringBuilder extraModifiersBuilder = new StringBuilder(); if((modifierI & GuiEnchantColour.BOLD_MODIFIER) != 0) { @@ -2167,6 +2168,8 @@ public class NEUEventListener { "\u00A7"+colourCode+extraMods+enchantText); line = line.replace("\u00A79\u00A7d\u00A7l"+enchantText, "\u00A7"+colourCode+extraMods+enchantText); + line = line.replace("\u00A7l\u00A7d\u00A7l"+enchantText, + "\u00A7"+colourCode+extraMods+enchantText); } else { int offset = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line.replaceAll( "\\u00A79"+enchantText+".*", "")); @@ -2176,6 +2179,10 @@ public class NEUEventListener { "\\u00A79\\u00A7d\\u00A7l"+enchantText+".*", "")); line = line.replace("\u00A79\u00A7d\u00A7l"+enchantText, Utils.chromaString(enchantText, offset/12f+index, true)); + offset = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line.replaceAll( + "\\u00A7l\\u00A7d\\u00A7l"+enchantText+".*", "")); + line = line.replace("\u00A7l\u00A7d\u00A7l"+enchantText, Utils.chromaString(enchantText, + offset/12f+index, true)); } } } -- cgit From e174f60311fddde92e061ecffdca762343ababc6 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 24 Sep 2021 19:35:01 +0200 Subject: Change log update --- Update Notes/2.0-Pre31-Release.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Update Notes/2.0-Pre31-Release.md b/Update Notes/2.0-Pre31-Release.md index 2ebf1d8c..99ec9c9c 100644 --- a/Update Notes/2.0-Pre31-Release.md +++ b/Update Notes/2.0-Pre31-Release.md @@ -1,25 +1,36 @@ # These are the change notes for PRE31-Release ### **Major Changes** -- Changes to the metal detector (https://github.com/DoKM/NotEnoughUpdates/pull/32) (Keebler408) +- None yet. Prob not gonna happen this is mainly for small things. ### **Minor Changes:** - Added a check to see if the storagegui is on before yelling at you for having fastrender on. -- Added toggle to disable showing the treecap cooldown in item durability. (Lulonaut) +- Added toggle to disable showing the treecap cooldown in item durability. (Lulonaut)# +- Added text to inform the user to "/api new" when the /pv doesn't load. +- Added support for the new arrows to the PV. ### **Bug Fixes** -- Fixed a nullpointer exception in dwarven textures (not fully tested). +- Fixed a nullpointer exception in dwarven textures (got some confirmation that it fixed it). - Fixed neuec not parsing correctly. - Fixed crashing when you copy text while in the neuec/neu buttons editor menu. - Fixed crash when collecting supper pairs (nullpointer). - Fixed accessory bag overlay not counting stats with a %. - Fixed golden goblin not having a icon. +- Fixed accessory bag overlay's reforge stat detection as hypixel broke it with their tooltip changes. +- Fixed NeuEC as hypixel broke it with their tooltip changes. +- Fixed not being able to press repeat keys in chat. +- Fixed gemstone gauntlet/Divan Drill not being recognised as mining tools. +- Fixed morph pets not being recognized by the extended pet info tooltip tweak. + ### **Other** -- Enabled help button by default +- Enabled help button by default. +- Added SecondPfirsisch cape. +- Added Stormy_LH cape. +- Change cape order in /neucosmetics because ironmoon asked for it. ### **Notes for texturepack creators** -- cgit From 1e434a53201374f7e459c336c3459220cc9f104e Mon Sep 17 00:00:00 2001 From: David Mills <85420839+Keebler408@users.noreply.github.com> Date: Fri, 24 Sep 2021 16:02:27 -0500 Subject: Introduce location specific config, move commission maxes into it --- .../moulberry/notenoughupdates/options/NEUConfig.java | 18 +++++++++++++++--- .../notenoughupdates/overlays/MiningOverlay.java | 12 ++++++++---- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index a789acfd..d4a078a9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -264,6 +264,8 @@ public class NEUConfig extends Config { public static class Hidden { @Expose public HashMap profileSpecific = new HashMap<>(); + @Expose + public HashMap locationSpecific = new HashMap<>(); @Expose public List inventoryButtons = createDefaultInventoryButtons(); @Expose public boolean enableItemEditing = false; @@ -284,7 +286,6 @@ public class NEUConfig extends Config { @Expose public ArrayList enchantColours = createDefaultEnchantColours(); @Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip"; @Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master"; - @Expose public Map commissionMaxes = new HashMap<>(); @Expose public boolean firstTimeSearchFocus = true; @@ -361,9 +362,20 @@ public class NEUConfig extends Config { put("Sapphire", 0); put("Topaz", 0); }}; - } + } + + public HiddenLocationSpecific getLocationSpecific() { + if(SBInfo.getInstance().location == null) { + return null; + } + return hidden.locationSpecific.computeIfAbsent(SBInfo.getInstance().getLocation(), k-> new HiddenLocationSpecific()); + } + + public static class HiddenLocationSpecific { + @Expose public Map commissionMaxes = new HashMap<>(); + } - public static List createDefaultInventoryButtons() { + public static List createDefaultInventoryButtons() { List buttons = new ArrayList<>(); //Below crafting buttons.add(new InventoryButton(87, 63, null, true, false, false, 0, "")); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 0beb8060..7a888191 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -79,8 +79,10 @@ public class MiningOverlay extends TextOverlay { } } } + + NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific(); if(name != null && numberValue > 0) { - NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.put(name, numberValue); + locationSpecific.commissionMaxes.put(name, numberValue); } } } @@ -237,12 +239,13 @@ public class MiningOverlay extends TextOverlay { String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); if (name.contains("Mithril Powder:")) { mithrilPowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); + continue; } if (name.contains("Gemstone Powder:")) { gemstonePowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); + continue; } - if (name.matches("\\xa7r\\xa79\\xa7lForges \\xa7r(?:\\xa7f\\(\\+1 more\\)\\xa7r)?")) { commissions = false; forges = true; @@ -343,8 +346,9 @@ public class MiningOverlay extends TextOverlay { } else if (entry.getValue() >= 0.25) { col = GOLD; } - if (NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.containsKey(entry.getKey())) { - int max = NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.get(entry.getKey()); + NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific(); + int max; + if (-1 != (max = locationSpecific.commissionMaxes.getOrDefault(entry.getKey(), -1))) { commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max); } else { String valS = Utils.floatToString(entry.getValue() * 100, 1); -- cgit From 57591e02c221d4015cb562caa2e0365a965006d0 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 25 Sep 2021 17:01:15 +0200 Subject: Add divine support --- .../notenoughupdates/NEUEventListener.java | 29 +++------------------ .../miscgui/AccessoryBagOverlay.java | 28 ++++++++++---------- .../moulberry/notenoughupdates/util/Utils.java | 30 +++++++++++++++++++++- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 9344649f..9cb63a67 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1727,30 +1727,7 @@ public class NEUEventListener { } } - private static String[] rarityArrC = new String[] { - EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", - EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", - EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE", - EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC", - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY", - EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC", - EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL", - EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL", - EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME", - }; - private static final HashMap rarityArrMap = new HashMap<>(); - static { - rarityArrMap.put("COMMON", rarityArrC[0]); - rarityArrMap.put("UNCOMMON", rarityArrC[1]); - rarityArrMap.put("RARE", rarityArrC[2]); - rarityArrMap.put("EPIC", rarityArrC[3]); - rarityArrMap.put("LEGENDARY", rarityArrC[4]); - rarityArrMap.put("MYTHIC", rarityArrC[5]); - rarityArrMap.put("SPECIAL", rarityArrC[6]); - rarityArrMap.put("VERY SPECIAL", rarityArrC[7]); - rarityArrMap.put("SUPREME", rarityArrC[8]); - } private HashSet percentStats = new HashSet<>(); { @@ -1825,9 +1802,9 @@ public class NEUEventListener { out: for (int i = list.tagCount(); i >= 0; i--) { String line = list.getStringTagAt(i); - for(int j=0; j entry : enchantsObj.entrySet()) { - if(line.contains(rarityArrC[j] + " " + entry.getKey()) || line.contains(rarityArrC[j] + " DUNGEON " + entry.getKey())) { + if(line.contains(Utils.rarityArrC[j] + " " + entry.getKey()) || line.contains(Utils.rarityArrC[j] + " DUNGEON " + entry.getKey())) { allItemEnchs = entry.getValue().getAsJsonArray(); break out; } @@ -1906,7 +1883,7 @@ public class NEUEventListener { JsonElement statsE = reforgeInfo.get("reforgeStats"); - String rarityFormatted = rarityArrMap.getOrDefault(rarity, rarity); + String rarityFormatted = Utils.rarityArrMap.getOrDefault(rarity, rarity); JsonElement reforgeAbilityE = reforgeInfo.get("reforgeAbility"); String reforgeAbility = null; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index ee83cb28..f5e784a4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -172,7 +172,7 @@ public class AccessoryBagOverlay { int yIndex = 0; for(Map.Entry entry : talismanCountRarity.descendingMap().entrySet()) { - String rarityName = rarityArrC[entry.getKey()]; + String rarityName = Utils.rarityArrC[entry.getKey()]; Utils.renderAlignedString(rarityName, EnumChatFormatting.WHITE.toString()+entry.getValue(), x+5, y+20+11*yIndex, 70); yIndex++; } @@ -887,17 +887,17 @@ public class AccessoryBagOverlay { // private static String[] rarityArr = new String[] { // "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME" // }; - private static String[] rarityArrC = new String[] { - EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", - EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", - EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE", - EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC", - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY", - EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC", - EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL", - EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL", - EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME", - }; +// private static String[] rarityArrC = new String[] { +// EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", +// EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", +// EnumChatFormatting.BLUE+EnumChatFormatting.BOLD.toString()+"RARE", +// EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC", +// EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY", +// EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC", +// EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL", +// EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"VERY SPECIAL", +// EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD.toString()+"SUPREME", +// }; public static int checkItemType(ItemStack stack, boolean contains, String... typeMatches) { NBTTagCompound tag = stack.getTagCompound(); if(tag != null) { @@ -955,8 +955,8 @@ public class AccessoryBagOverlay { NBTTagList list = display.getTagList("Lore", 8); for (int i = list.tagCount(); i >= 0; i--) { String line = list.getStringTagAt(i); - for(int j=0; j rarityArrMap = new HashMap<>(); + static { + rarityArrMap.put("COMMON", rarityArrC[0]); + rarityArrMap.put("UNCOMMON", rarityArrC[1]); + rarityArrMap.put("RARE", rarityArrC[2]); + rarityArrMap.put("EPIC", rarityArrC[3]); + rarityArrMap.put("LEGENDARY", rarityArrC[4]); + rarityArrMap.put("MYTHIC", rarityArrC[5]); + rarityArrMap.put("SPECIAL", rarityArrC[6]); + rarityArrMap.put("VERY SPECIAL", rarityArrC[7]); + rarityArrMap.put("SUPREME", rarityArrC[8]); + rarityArrMap.put("DIVINE", rarityArrC[9]); + + } + public static String getRarityFromInt(int rarity){ if(rarity < 0|| rarity >= rarityArr.length){ return rarityArr[0]; } return rarityArr[rarity]; -- cgit From e011c9a92bb9a8e056adbf9a0d42315348e55210 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 25 Sep 2021 17:04:04 +0200 Subject: Update changelog --- Update Notes/2.0-Pre31-Release.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Update Notes/2.0-Pre31-Release.md b/Update Notes/2.0-Pre31-Release.md index 99ec9c9c..f0a1fc60 100644 --- a/Update Notes/2.0-Pre31-Release.md +++ b/Update Notes/2.0-Pre31-Release.md @@ -9,6 +9,9 @@ - Added toggle to disable showing the treecap cooldown in item durability. (Lulonaut)# - Added text to inform the user to "/api new" when the /pv doesn't load. - Added support for the new arrows to the PV. +- Improved metal detector location detection logic. (Keebler408) +- Improved metal detector wrong location handling. (Keebler408) +- Added Beacons waypoints for metal detector waypoint locations. (Keebler408) ### **Bug Fixes** -- cgit From 8450813a942016f4ce866490f4a4503158372f24 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 26 Sep 2021 20:53:29 +0200 Subject: better pv command block --- .../moulberry/notenoughupdates/NEUEventListener.java | 7 ++----- .../notenoughupdates/miscfeatures/BetterContainers.java | 10 ++++------ .../notenoughupdates/mixins/MixinGuiContainer.java | 15 ++++++++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 212bb8a4..2727c2fb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -27,12 +27,9 @@ import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -1428,8 +1425,8 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - if(containerName.contains(" Profile") && eventGui.isMouseOverSlot(cc.inventorySlots.get(42), mouseX, mouseY) - && Mouse.getEventButton() >= 0) { + if(containerName.contains(" Profile") && BetterContainers.profileViewerStackIndex != -1 && + eventGui.isMouseOverSlot(cc.inventorySlots.get(BetterContainers.profileViewerStackIndex), mouseX, mouseY) && Mouse.getEventButton() >= 0) { event.setCanceled(true); if(Mouse.getEventButtonState() && eventGui.inventorySlots.inventorySlots.get(22).getStack() != null && eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound() != null){ diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java index 65ccd73f..bc92df0e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java @@ -57,6 +57,8 @@ public class BetterContainers { public static HashMap itemCache = new HashMap<>(); + public static int profileViewerStackIndex = -1; + public static void clickSlot(int slot) { clickedSlotMillis = System.currentTimeMillis(); clickedSlot = slot; @@ -121,9 +123,7 @@ public class BetterContainers { } public static boolean isBlankStack(int index, ItemStack stack) { - if(index == 42 && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && - (SBInfo.getInstance().lastOpenContainerName.contains("'s Profile") || - SBInfo.getInstance().lastOpenContainerName.contains("s' Profile"))) { + if(index != -1 && index == profileViewerStackIndex) { return false; } @@ -137,9 +137,7 @@ public class BetterContainers { } public static boolean isButtonStack(int index, ItemStack stack) { - if(index == 42 && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && - (SBInfo.getInstance().lastOpenContainerName.contains("'s Profile") || - SBInfo.getInstance().lastOpenContainerName.contains("s' Profile"))) { + if(index == profileViewerStackIndex) { return true; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index 89d97dfa..db72f903 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -54,8 +54,10 @@ public abstract class MixinGuiContainer extends GuiScreen { GuiContainer $this = (GuiContainer)(Object)this; - if(slot.slotNumber == 42 && $this instanceof GuiChest) { - hasProfileViewerStack = false; + if(!hasProfileViewerStack && $this instanceof GuiChest && slot.getSlotIndex() > 9 && (slot.getSlotIndex() % 9 == 6 || slot.getSlotIndex() % 9 == 7) && + BetterContainers.isBlankStack(-1, slot.getStack())) { + BetterContainers.profileViewerStackIndex = -1; + hasProfileViewerStack = true; GuiChest eventGui = (GuiChest) $this; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; @@ -80,12 +82,15 @@ public abstract class MixinGuiContainer extends GuiScreen { this.itemRender.zLevel = 0.0F; this.zLevel = 0.0F; - hasProfileViewerStack = true; + BetterContainers.profileViewerStackIndex = slot.getSlotIndex(); } } } } - } + } else if (slot.getSlotIndex() == 0) + hasProfileViewerStack = false; + else if(!($this instanceof GuiChest)) + BetterContainers.profileViewerStackIndex = -1; if(slot.getStack() == null && NotEnoughUpdates.INSTANCE.overlay.searchMode && NEUEventListener.drawingGuiScreen) { GlStateManager.pushMatrix(); @@ -117,7 +122,7 @@ public abstract class MixinGuiContainer extends GuiScreen { value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;renderToolTip(Lnet/minecraft/item/ItemStack;II)V")) public void drawScreen_renderTooltip(GuiContainer guiContainer, ItemStack stack, int x, int y) { - if(hasProfileViewerStack && theSlot.slotNumber == 42) { + if(theSlot.slotNumber == BetterContainers.profileViewerStackIndex) { this.renderToolTip(profileViewerStack, x, y); } else { this.renderToolTip(stack, x, y); -- cgit From fc71a87b8d5a04e9252fede85cacb1de4ac92612 Mon Sep 17 00:00:00 2001 From: Lulonaut <67191924+Lulonaut@users.noreply.github.com> Date: Sun, 26 Sep 2021 21:02:18 +0200 Subject: Java not rust --- .../notenoughupdates/overlays/AuctionSearchOverlay.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index 8b3b21f0..dc31c686 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -334,17 +334,17 @@ public class AuctionSearchOverlay { } else if(Keyboard.getEventKey() == Keyboard.KEY_RETURN) { searchStringExtra = ""; close(); - } else if(Keyboard.getEventKey() == Keyboard.KEY_TAB){ + } else if(Keyboard.getEventKey() == Keyboard.KEY_TAB) { if (!autocompletedItems.isEmpty()) { - searchString = autocompletedItems.iterator().next(); + searchString = autocompletedItems.get(0); JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next()); - String displayname = repoObject.get("displayname").getAsString(); - if (displayname.contains("Enchanted Book")){ - String lore = repoObject.get("lore").getAsJsonArray().iterator().next().getAsString(); + String displayName = repoObject.get("displayname").getAsString(); + if (displayName.contains("Enchanted Book")){ + String lore = repoObject.get("lore").getAsJsonArray().get(0).getAsString(); String name = lore.substring(0, lore.lastIndexOf(" ")); searchString = Utils.cleanColour(name); } else { - searchString = Utils.cleanColour(displayname); + searchString = Utils.cleanColour(displayName); } } } else if(Keyboard.getEventKeyState()) { -- cgit From 60a33198da29aee56237853563860ff0320c6231 Mon Sep 17 00:00:00 2001 From: Lulonaut <67191924+Lulonaut@users.noreply.github.com> Date: Sun, 26 Sep 2021 21:06:37 +0200 Subject: Set still requires iterator --- .../moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index dc31c686..ca7abc01 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -336,10 +336,10 @@ public class AuctionSearchOverlay { close(); } else if(Keyboard.getEventKey() == Keyboard.KEY_TAB) { if (!autocompletedItems.isEmpty()) { - searchString = autocompletedItems.get(0); + searchString = autocompletedItems.iterator().next(); JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next()); - String displayName = repoObject.get("displayname").getAsString(); - if (displayName.contains("Enchanted Book")){ + String displayname = repoObject.get("displayname").getAsString(); + if (displayname.contains("Enchanted Book")){ String lore = repoObject.get("lore").getAsJsonArray().get(0).getAsString(); String name = lore.substring(0, lore.lastIndexOf(" ")); searchString = Utils.cleanColour(name); -- cgit From d1f07c3b8bed9d2809ddc2177be1bd7acb9157a1 Mon Sep 17 00:00:00 2001 From: Lulonaut <67191924+Lulonaut@users.noreply.github.com> Date: Sun, 26 Sep 2021 21:08:45 +0200 Subject: forgot to change one name back please work now --- .../moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index ca7abc01..f11c7974 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -344,7 +344,7 @@ public class AuctionSearchOverlay { String name = lore.substring(0, lore.lastIndexOf(" ")); searchString = Utils.cleanColour(name); } else { - searchString = Utils.cleanColour(displayName); + searchString = Utils.cleanColour(displayname); } } } else if(Keyboard.getEventKeyState()) { -- cgit From 6a61e4e97006c8fe85581bea9d5f3fc0409ecfac Mon Sep 17 00:00:00 2001 From: David Mills <85420839+Keebler408@users.noreply.github.com> Date: Mon, 27 Sep 2021 13:43:38 -0500 Subject: Update per-location commissions to read commission type stack, not current player location --- .../moulberry/notenoughupdates/NEUManager.java | 5 + .../notenoughupdates/options/NEUConfig.java | 16 +- .../notenoughupdates/overlays/MiningOverlay.java | 199 +++++++++++++-------- 3 files changed, 137 insertions(+), 83 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 5fef4c62..40ae9899 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -723,6 +723,11 @@ public class NEUManager { return lore; } + public String getNameFromNBT(NBTTagCompound tag) { + NBTTagCompound display = tag.getCompoundTag("display"); + return display.getString("Name"); + } + public JsonObject getJsonFromNBT(NBTTagCompound tag) { return getJsonFromNBTEntry(tag.getTagList("i", 10).getCompoundTagAt(0)); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index d4a078a9..06619ffd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -365,13 +365,19 @@ public class NEUConfig extends Config { } public HiddenLocationSpecific getLocationSpecific() { - if(SBInfo.getInstance().location == null) { - return null; - } - return hidden.locationSpecific.computeIfAbsent(SBInfo.getInstance().getLocation(), k-> new HiddenLocationSpecific()); + String location = SBInfo.getInstance().getLocation(); + if(location == null || location.isEmpty()) { + return null; } - public static class HiddenLocationSpecific { + return getLocationSpecific(location); + } + + public HiddenLocationSpecific getLocationSpecific(String location) { + return hidden.locationSpecific.computeIfAbsent(location, k-> new HiddenLocationSpecific()); + } + + public static class HiddenLocationSpecific { @Expose public Map commissionMaxes = new HashMap<>(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 7a888191..889647a8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -44,105 +44,148 @@ public class MiningOverlay extends TextOverlay { @Override public void updateFrequent() { - NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest container = (ContainerChest) chest.inventorySlots; IInventory lower = container.getLowerChestInventory(); String containerName = lower.getDisplayName().getUnformattedText(); - if(containerName.equals("Commissions") && lower.getSizeInventory() >= 18) { - for(int i=9; i<18; i++) { - ItemStack stack = lower.getStackInSlot(i); - if(stack != null && stack.hasTagCompound()) { - String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); - String name = null; - int numberValue = -1; - for(String line : lore) { - if(name != null) { - String clean = Utils.cleanColour(line).trim(); - if(clean.isEmpty()) { - break; - } else { - Matcher matcher = NUMBER_PATTERN.matcher(clean); - if(matcher.find()) { - try { - numberValue = Integer.parseInt(matcher.group("number").replace(",", "")); - } catch(NumberFormatException ignored) {} - } + if(containerName.equals("Commissions") && lower.getSizeInventory() >= 27) { + UpdateCommissions(lower); + } else if(containerName.equals("Forge") && lower.getSizeInventory() >= 36) { + updateForge(lower); + } + } + } + + private void updateForge(IInventory lower) { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) { + return; + } + + itemLoop: + for (int i = 0; i < 5; i++) { + ItemStack stack = lower.getStackInSlot(i + 11); + if (stack != null) { + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + + for (int i1 = 0; i1 < lore.length; i1++) { + String line = lore[i1]; + Matcher matcher = timeRemainingForge.matcher(line); + if (stack.getDisplayName().matches("\\xA7cSlot #([1-5])")) { + ForgeItem newForgeItem = new ForgeItem(i, 1, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + //empty Slot + } else if (stack.getDisplayName().matches("\\xA7aSlot #([1-5])")) { + ForgeItem newForgeItem = new ForgeItem(i, 0, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } else if (matcher.matches()) { + String timeremainingString = matcher.group(1); + + long duration = 0; + + if (matcher.group("Completed") != null && !matcher.group("Completed").equals("")) { + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } else { + + try { + if (matcher.group("days") != null && !matcher.group("days").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; } - } - if(line.startsWith("\u00a77\u00a79")) { - String textAfter = line.substring(4); - if(!textAfter.contains("\u00a7") && !textAfter.equals("Rewards") && !textAfter.equals("Progress")) { - name = textAfter; + if (matcher.group("hours") != null && !matcher.group("hours").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("hours")) * 60 * 60 * 1000; + } + if (matcher.group("minutes") != null && !matcher.group("minutes").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("minutes")) * 60 * 1000; } + if (matcher.group("seconds") != null && !matcher.group("seconds").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("seconds")) * 1000; + } + } catch (Exception ignored) { + } + if (duration > 0) { + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); } } - NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific(); - if(name != null && numberValue > 0) { - locationSpecific.commissionMaxes.put(name, numberValue); - } + continue itemLoop; } } - } else if(containerName.equals("Forge") && lower.getSizeInventory() >= 36 && hidden != null) { - - itemLoop: - for (int i = 0; i < 5; i++) { - ItemStack stack = lower.getStackInSlot(i + 11); - if (stack != null) { - - String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); - - for (int i1 = 0; i1 < lore.length; i1++) { - String line = lore[i1]; - Matcher matcher = timeRemainingForge.matcher(line); - if (stack.getDisplayName().matches("\\xA7cSlot #([1-5])")) { - ForgeItem newForgeItem = new ForgeItem(i, 1, false); - replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); - //empty Slot - } else if (stack.getDisplayName().matches("\\xA7aSlot #([1-5])")) { - ForgeItem newForgeItem = new ForgeItem(i, 0, false); - replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); - } else if (matcher.matches()) { - String timeremainingString = matcher.group(1); + //Locked Slot + } + } + } - long duration = 0; + private void UpdateCommissions(IInventory lower) { + // Get the location (type) of the currently shown commissions + ItemStack commTypeStack = lower.getStackInSlot(27); + if (commTypeStack == null || !commTypeStack.hasTagCompound()) + { + return; + } - if (matcher.group("Completed") != null && !matcher.group("Completed").equals("")) { - ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, i, false); - replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); - } else { + String name = Utils.cleanColour(NotEnoughUpdates.INSTANCE.manager.getNameFromNBT((commTypeStack.getTagCompound()))).trim(); + if (!name.equals("Switch Type")) + { + return; + } - try { - if (matcher.group("days") != null && !matcher.group("days").equals("")) { - duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; - } - if (matcher.group("hours") != null && !matcher.group("hours").equals("")) { - duration = duration + (long) Integer.parseInt(matcher.group("hours")) * 60 * 60 * 1000; - } - if (matcher.group("minutes") != null && !matcher.group("minutes").equals("")) { - duration = duration + (long) Integer.parseInt(matcher.group("minutes")) * 60 * 1000; - } - if (matcher.group("seconds") != null && !matcher.group("seconds").equals("")) { - duration = duration + (long) Integer.parseInt(matcher.group("seconds")) * 1000; - } - } catch (Exception ignored) { - } - if (duration > 0) { - ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, i, false); - replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); - } - } + String commLocation = null; + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(commTypeStack.getTagCompound()); + for(String line : lore) { + if (line == null) { + continue; + } + String cleanLine = Utils.cleanColour(line).trim(); + if (cleanLine.equals("Dwarven Mines")) { + commLocation = "mining_3"; + } else if (cleanLine.equals("Crystal Hollows")) { + commLocation = "crystal_hollows"; + } else { + continue; + } + break; + } + if (commLocation == null) { + return; + } - continue itemLoop; + // Now get the commission info + for(int i=9; i<18; i++) { + ItemStack stack = lower.getStackInSlot(i); + if(stack != null && stack.hasTagCompound()) { + lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + String commName = null; + int numberValue = -1; + for(String line : lore) { + if(commName != null) { + String clean = Utils.cleanColour(line).trim(); + if(clean.isEmpty()) { + break; + } else { + Matcher matcher = NUMBER_PATTERN.matcher(clean); + if(matcher.find()) { + try { + numberValue = Integer.parseInt(matcher.group("number").replace(",", "")); + } catch(NumberFormatException ignored) {} } } - //Locked Slot - } + if(line.startsWith("\u00a77\u00a79")) { + String textAfter = line.substring(4); + if(!textAfter.contains("\u00a7") && !textAfter.equals("Rewards") && !textAfter.equals("Progress")) { + commName = textAfter; + } + } + } + + NEUConfig.HiddenLocationSpecific locationSpecific = NotEnoughUpdates.INSTANCE.config.getLocationSpecific(commLocation); + if(commName != null && numberValue > 0) { + locationSpecific.commissionMaxes.put(commName, numberValue); } } } -- cgit From 4da2b758d13b8ae443f1b2b84ec39e123c3b29f1 Mon Sep 17 00:00:00 2001 From: David Mills <85420839+Keebler408@users.noreply.github.com> Date: Mon, 27 Sep 2021 14:02:50 -0500 Subject: Use built-in getDisplayName method --- src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java | 5 ----- .../io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 40ae9899..5fef4c62 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -723,11 +723,6 @@ public class NEUManager { return lore; } - public String getNameFromNBT(NBTTagCompound tag) { - NBTTagCompound display = tag.getCompoundTag("display"); - return display.getString("Name"); - } - public JsonObject getJsonFromNBT(NBTTagCompound tag) { return getJsonFromNBTEntry(tag.getTagList("i", 10).getCompoundTagAt(0)); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 889647a8..0943f120 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -128,7 +128,7 @@ public class MiningOverlay extends TextOverlay { return; } - String name = Utils.cleanColour(NotEnoughUpdates.INSTANCE.manager.getNameFromNBT((commTypeStack.getTagCompound()))).trim(); + String name = Utils.cleanColour(commTypeStack.getDisplayName()).trim(); if (!name.equals("Switch Type")) { return; -- cgit From 7e985dc228a0998cf35474b96c2244e16c8ca7a5 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 27 Sep 2021 21:09:41 +0200 Subject: Auto stash before checking out "HEAD" --- Update Notes/2.0-Pre31-Release.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Update Notes/2.0-Pre31-Release.md b/Update Notes/2.0-Pre31-Release.md index f0a1fc60..da4fa3f4 100644 --- a/Update Notes/2.0-Pre31-Release.md +++ b/Update Notes/2.0-Pre31-Release.md @@ -12,7 +12,8 @@ - Improved metal detector location detection logic. (Keebler408) - Improved metal detector wrong location handling. (Keebler408) - Added Beacons waypoints for metal detector waypoint locations. (Keebler408) - +- Made the PV command block in the right click player menu dynamically choose its position based on a empty slot. (DeDiamondPro) +- Added Tab auto completion to the AH search gui. (Lulonaut) ### **Bug Fixes** - Fixed a nullpointer exception in dwarven textures (got some confirmation that it fixed it). @@ -26,6 +27,8 @@ - Fixed not being able to press repeat keys in chat. - Fixed gemstone gauntlet/Divan Drill not being recognised as mining tools. - Fixed morph pets not being recognized by the extended pet info tooltip tweak. +- Fixed wrong commission maxes values for goblin in dwarven mines and the crystal hollows. (Keebler408) +- Fixed player right click menu command block text appearing on an inventory item. (DeDiamondPro) -- cgit From e598793adf941238928b69b0d7bcdb5a5e9c3a9c Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Wed, 29 Sep 2021 20:10:51 +0200 Subject: added ability to go through the results with arrow keys --- .../overlays/AuctionSearchOverlay.java | 88 ++++++++++++++++++---- 1 file changed, 74 insertions(+), 14 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index f11c7974..e900321d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -40,6 +40,8 @@ public class AuctionSearchOverlay { private static String searchString = ""; private static String searchStringExtra = ""; private static Splitter SPACE_SPLITTER = Splitter.on(" ").omitEmptyStrings().trimResults(); + private static boolean tabCompleted = false; + private static int tabCompletionIndex = 0; private static int selectedStars = 0; private static boolean atLeast = true; @@ -273,15 +275,35 @@ public class AuctionSearchOverlay { private static ExecutorService searchES = Executors.newSingleThreadExecutor(); private static AtomicInteger searchId = new AtomicInteger(0); + private static String getItemIdAtIndex(int i) { + if (!autocompletedItems.isEmpty()) { + if ((i > autocompletedItems.size() - 1) || i < 0) { + return ""; + } + String searchString = autocompletedItems.toArray()[i].toString(); + JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(searchString); + String displayname = repoObject.get("displayname").getAsString(); + if (displayname.contains("Enchanted Book")) { + String lore = repoObject.get("lore").getAsJsonArray().get(0).getAsString(); + String name = lore.substring(0, lore.lastIndexOf(" ")); + return Utils.cleanColour(name); + } else { + return Utils.cleanColour(displayname); + } + } else { + return null; + } + } + public static void search() { final int thisSearchId = searchId.incrementAndGet(); searchES.submit(() -> { - if(thisSearchId != searchId.get()) return; + if (thisSearchId != searchId.get()) return; - List title = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("title:"+searchString.trim())); + List title = new ArrayList<>(NotEnoughUpdates.INSTANCE.manager.search("title:" + searchString.trim())); - if(thisSearchId != searchId.get()) return; + if (thisSearchId != searchId.get()) return; if(!searchString.trim().contains(" ")) { StringBuilder sb = new StringBuilder(); @@ -335,19 +357,57 @@ public class AuctionSearchOverlay { searchStringExtra = ""; close(); } else if(Keyboard.getEventKey() == Keyboard.KEY_TAB) { - if (!autocompletedItems.isEmpty()) { - searchString = autocompletedItems.iterator().next(); - JsonObject repoObject = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(autocompletedItems.iterator().next()); - String displayname = repoObject.get("displayname").getAsString(); - if (displayname.contains("Enchanted Book")){ - String lore = repoObject.get("lore").getAsJsonArray().get(0).getAsString(); - String name = lore.substring(0, lore.lastIndexOf(" ")); - searchString = Utils.cleanColour(name); - } else { - searchString = Utils.cleanColour(displayname); - } + //autocomplete to first item in the list + tabCompleted = true; + String id = getItemIdAtIndex(0); + if (id == null) { + tabCompleted = false; + textField.setFocus(true); + textField.setText(searchString); + } else { + searchString = id; } } else if(Keyboard.getEventKeyState()) { + if (tabCompleted) { + String id; + switch (Keyboard.getEventKey()) { + case Keyboard.KEY_DOWN: + id = getItemIdAtIndex(tabCompletionIndex + 1); + if (id == null) { + textField.setFocus(true); + textField.setText(searchString); + tabCompleted = false; + tabCompletionIndex = 0; + } else if (id.equals("")) { + //At the end of the autocompletion List, do nothing + return; + } else { + searchString = id; + tabCompletionIndex += 1; + return; + } + break; + case Keyboard.KEY_UP: + id = getItemIdAtIndex(tabCompletionIndex - 1); + if (id == null) { + textField.setFocus(true); + textField.setText(searchString); + tabCompleted = false; + tabCompletionIndex = 0; + } else if (id.equals("")) { + //At the end of the autocompletion List, do nothing + return; + } else { + searchString = id; + tabCompletionIndex -= 1; + return; + } + break; + default: + tabCompletionIndex = 0; + tabCompleted = false; + } + } textField.setFocus(true); textField.setText(searchString); textField.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey()); -- cgit From 215e4a84802b9e02078ff0938cb1651bda673bc3 Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Thu, 30 Sep 2021 15:55:14 +0200 Subject: highlight selected item with texture --- .../overlays/AuctionSearchOverlay.java | 35 +++++++++++++-------- .../auc_search/ah_search_overlay_tab_completed.png | Bin 0 -> 6969 bytes 2 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 src/main/resources/assets/notenoughupdates/auc_search/ah_search_overlay_tab_completed.png diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index e900321d..016e638b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -32,6 +32,7 @@ import java.util.concurrent.atomic.AtomicInteger; public class AuctionSearchOverlay { private static final ResourceLocation SEARCH_OVERLAY_TEXTURE = new ResourceLocation("notenoughupdates:auc_search/ah_search_overlay.png"); + private static final ResourceLocation SEARCH_OVERLAY_TEXTURE_TAB_COMPLETED = new ResourceLocation("notenoughupdates:auc_search/ah_search_overlay_tab_completed.png"); private static final ResourceLocation STAR = new ResourceLocation("notenoughupdates:auc_search/star.png"); private static final ResourceLocation STAR_BOARD = new ResourceLocation("notenoughupdates:auc_search/star_board.png"); @@ -41,7 +42,7 @@ public class AuctionSearchOverlay { private static String searchStringExtra = ""; private static Splitter SPACE_SPLITTER = Splitter.on(" ").omitEmptyStrings().trimResults(); private static boolean tabCompleted = false; - private static int tabCompletionIndex = 0; + private static int tabCompletionIndex = -1; private static int selectedStars = 0; private static boolean atLeast = true; @@ -148,24 +149,31 @@ public class AuctionSearchOverlay { int num = 0; synchronized(autocompletedItems) { - for(String str : autocompletedItems) { + String[] autoCompletedItemsArray = autocompletedItems.toArray(new String[0]); + for (int i = 0; i < autocompletedItems.size(); i++) { + String str = autoCompletedItemsArray[i]; JsonObject obj = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(str); - if(obj != null) { + if (obj != null) { ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(obj); //Gui.drawRect(width/2-96, height/4+30+num*22, width/2+96, height/4+30+num*22+20, 0xff505050); + if (i == tabCompletionIndex) { + Minecraft.getMinecraft().getTextureManager().bindTexture(SEARCH_OVERLAY_TEXTURE_TAB_COMPLETED); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(width / 2 - 96 + 1, topY + 30 + num * 22 + 1, 193, 21, 0 / 512f, 193 / 512f, 0, 21 / 256f, GL11.GL_NEAREST); + } else { + Minecraft.getMinecraft().getTextureManager().bindTexture(SEARCH_OVERLAY_TEXTURE); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(width / 2 - 96 + 1, topY + 30 + num * 22 + 1, 193, 21, 214 / 512f, 407 / 512f, 0, 21 / 256f, GL11.GL_NEAREST); - Minecraft.getMinecraft().getTextureManager().bindTexture(SEARCH_OVERLAY_TEXTURE); - GlStateManager.color(1, 1, 1, 1); - Utils.drawTexturedRect(width/2-96+1, topY+30+num*22+1, 193, 21, 214/512f, 407/512f, 0, 21/256f, GL11.GL_NEAREST); - + } String itemName = Utils.trimIgnoreColour(stack.getDisplayName().replaceAll("\\[.+]", "")); - if(itemName.contains("Enchanted Book") && str.contains(";")) { + if (itemName.contains("Enchanted Book") && str.contains(";")) { String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); itemName = lore[0].trim(); } Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(itemName, 165), - width/2-74, topY+35+num*22+1, 0xdddddd, true); + width / 2 - 74, topY + 35 + num * 22 + 1, 0xdddddd, true); GlStateManager.enableDepth(); Utils.drawItemStack(stack, width/2-94+2, topY+32+num*22+1); @@ -277,7 +285,7 @@ public class AuctionSearchOverlay { private static String getItemIdAtIndex(int i) { if (!autocompletedItems.isEmpty()) { - if ((i > autocompletedItems.size() - 1) || i < 0) { + if ((i > autocompletedItems.size() - 1) || i < 0 || i > 4) { return ""; } String searchString = autocompletedItems.toArray()[i].toString(); @@ -365,6 +373,7 @@ public class AuctionSearchOverlay { textField.setFocus(true); textField.setText(searchString); } else { + tabCompletionIndex = 0; searchString = id; } } else if(Keyboard.getEventKeyState()) { @@ -377,7 +386,7 @@ public class AuctionSearchOverlay { textField.setFocus(true); textField.setText(searchString); tabCompleted = false; - tabCompletionIndex = 0; + tabCompletionIndex = -1; } else if (id.equals("")) { //At the end of the autocompletion List, do nothing return; @@ -393,7 +402,7 @@ public class AuctionSearchOverlay { textField.setFocus(true); textField.setText(searchString); tabCompleted = false; - tabCompletionIndex = 0; + tabCompletionIndex = -1; } else if (id.equals("")) { //At the end of the autocompletion List, do nothing return; @@ -404,7 +413,7 @@ public class AuctionSearchOverlay { } break; default: - tabCompletionIndex = 0; + tabCompletionIndex = -1; tabCompleted = false; } } diff --git a/src/main/resources/assets/notenoughupdates/auc_search/ah_search_overlay_tab_completed.png b/src/main/resources/assets/notenoughupdates/auc_search/ah_search_overlay_tab_completed.png new file mode 100644 index 00000000..b5cf62c0 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/auc_search/ah_search_overlay_tab_completed.png differ -- cgit From cdc452e0e0aed1c25e9f3044a7d68b3d4f41cdb1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 3 Oct 2021 22:56:18 +0200 Subject: Move the commands to a seperate class --- .../notenoughupdates/NEUEventListener.java | 2 +- .../notenoughupdates/NotEnoughUpdates.java | 1118 +------------------ .../notenoughupdates/commands/Commands.java | 1179 ++++++++++++++++++++ .../profileviewer/GuiProfileViewer.java | 25 + 4 files changed, 1219 insertions(+), 1105 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 09fa865f..42b53ef2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1434,7 +1434,7 @@ public class NEUEventListener { if(tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")){ String username = tag.getCompoundTag("SkullOwner").getString("Name"); Utils.playPressSound(); - NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{username}); + NotEnoughUpdates.INSTANCE.commands.viewProfileRunnable.processCommand(null, new String[]{username}); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 5eb0f861..6a0d3ab4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -8,6 +8,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; import io.github.moulberry.notenoughupdates.collectionlog.GuiCollectionLog; +import io.github.moulberry.notenoughupdates.commands.Commands; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; @@ -96,6 +97,13 @@ public class NotEnoughUpdates { private File configFile; + public File getConfigFile(){ + return this.configFile; + } + public void newConfigFile(){ + this.configFile = new File(NotEnoughUpdates.INSTANCE.getNeuDir(), "configNew.json"); + } + private static final long CHAT_MSG_COOLDOWN = 200; private long lastChatMessage = 0; private long secondLastChatMessage = 0; @@ -107,284 +115,11 @@ public class NotEnoughUpdates { public GuiScreen openGui = null; public long lastOpenedGui = 0; - SimpleCommand.ProcessCommandRunnable collectionLogRun = new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - openGui = new GuiCollectionLog(); - } - }; - - SimpleCommand collectionLogCommand = new SimpleCommand("neucl", collectionLogRun); - SimpleCommand collectionLogCommand2 = new SimpleCommand("collectionlog", collectionLogRun); - - SimpleCommand nullzeeSphereCommand = new SimpleCommand("neuzeesphere", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(args.length != 1) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Usage: /neuzeesphere [on/off] or /neuzeesphere (radius) or /neuzeesphere setCenter")); - return; - } - if(args[0].equalsIgnoreCase("on")) { - NullzeeSphere.enabled = true; - } else if(args[0].equalsIgnoreCase("off")) { - NullzeeSphere.enabled = false; - } else if(args[0].equalsIgnoreCase("setCenter")) { - EntityPlayerSP p = ((EntityPlayerSP)sender); - NullzeeSphere.centerPos = new BlockPos(p.posX, p.posY, p.posZ); - NullzeeSphere.overlayVBO = null; - } else { - try { - float radius = Float.parseFloat(args[0]); - NullzeeSphere.size = radius; - NullzeeSphere.overlayVBO = null; - } catch(Exception e) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Can't parse radius: " + args[0])); - } - } - } - }); - - /*SimpleCommand itemRenameCommand = new SimpleCommand("neurename", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(args.length == 0) { - args = new String[]{"help"}; - } - String heldUUID = manager.getUUIDForItem(Minecraft.getMinecraft().thePlayer.getHeldItem()); - switch(args[0].toLowerCase()) { - case "clearall": - manager.itemRenameJson = new JsonObject(); - manager.saveItemRenameConfig(); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] Cleared custom name for all items")); - break; - case "clear": - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't clear rename - no UUID")); - return; - } - manager.itemRenameJson.remove(heldUUID); - manager.saveItemRenameConfig(); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] Cleared custom name for held item")); - break; - case "copyuuid": - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't clear rename - no UUID")); - return; - } - StringSelection selection = new StringSelection(heldUUID); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] UUID copied to clipboard")); - break; - case "uuid": - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't get UUID - no UUID")); - return; - } - ChatStyle style = new ChatStyle(); - style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - new ChatComponentText(EnumChatFormatting.GRAY+"Click to copy to clipboard"))); - style.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/neurename copyuuid")); - - ChatComponentText text = new ChatComponentText(EnumChatFormatting.YELLOW+"[NEU] The UUID of your currently held item is: " + - EnumChatFormatting.GREEN + heldUUID); - text.setChatStyle(style); - sender.addChatMessage(text); - break; - case "set": - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't rename item - no UUID")); - return; - } - if(args.length == 1) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Usage: /neurename set [name...]")); - return; - } - StringBuilder sb = new StringBuilder(); - for(int i=1; i neuHelpMessages = Lists.newArrayList( - "\u00a75\u00a7lNotEnoughUpdates commands", - "\u00a76/neu \u00a77- Opens the main neu GUI.", - "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer", - "\u00a76/neusouls {on/off/clear/unclear} \u00a7r\u00a77- Shows waypoints to fairy souls.", - "\u00a76/neubuttons \u00a7r\u00a77- Opens a GUI which allows you to customize inventory buttons.", - "\u00a76/neuec \u00a7r\u00a77- Opens the enchant colour GUI.", - - "\u00a76/join {floor} \u00a7r\u00a77- Short Command to join a Dungeon. \u00a7lNeed a Party of 5 People\u00a7r\u00a77 {4/f7/m5}.", - "\u00a76/neucosmetics \u00a7r\u00a77- Opens the cosmetic GUI.", - "\u00a76/neurename \u00a7r\u00a77- Opens the NEU Item Customizer.", - "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer's catacombs page.", - "\u00a76/neulinks \u00a7r\u00a77- Shows links to neu/moulberry.", - "\u00a76/neuoverlay \u00a7r\u00a77- Opens GUI Editor for quickcommands and searchbar.", - "\u00a76/neuah \u00a7r\u00a77- Opens neu's custom ah GUI.", - "\u00a76/neumap \u00a7r\u00a77- Opens the dungeon map GUI.", - "\u00a76/neucalendar \u00a7r\u00a77- Opens neu's custom calendar GUI.", - "", - "\u00a76\u00a7lOld commands:", - "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- Shows quickly stats for a user.", - "", - "\u00a76\u00a7lDebug commands:", - "\u00a76/neustats \u00a7r\u00a77- Copies helpful info to the clipboard.", - "\u00a76/neustats modlist \u00a7r\u00a77- Copies modlist info to clipboard.", - "\u00a76/neuresetrepo \u00a7r\u00a77- Deletes all repo files.", - "\u00a76/neureloadrepo \u00a7r\u00a77- Debug command with repo.", - "", - "\u00a76\u00a7lDev commands:", - "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc"); - for (int i = 0; i < neuHelpMessages.size(); i++) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuHelpMessages.get(i) - )); - - } - if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { - ArrayList neuDevHelpMessages = Lists.newArrayList( - "\u00a76/neudevtest \u00a7r\u00a77- dev test command", - "\u00a76/neuzeephere \u00a7r\u00a77- sphere", - "\u00a76/neudungeonwintest \u00a7r\u00a77- displays the dungeon win screen"); - - for (int i = 0; i < neuDevHelpMessages.size(); i++) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuDevHelpMessages.get(i) - )); + public Commands commands; - } - } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Commands marked with a \u00a72\"\u2D35\"\u00a77 require are api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\"")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Arguments marked with a \u00a7b\"?\"\u00a77 are optional.")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a76\u00a7lScroll up to see everything")); - } - }); - - SimpleCommand neuFeatures = new SimpleCommand("neufeatures", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - if(Constants.MISC == null || !Constants.MISC.has("featureslist")){ - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"WARNING: "+EnumChatFormatting.RESET+EnumChatFormatting.RED+"Could not load URL from repo.")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.RED+ "Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - return; - } - String url = Constants.MISC.get("featureslist").getAsString(); - - Desktop desk = Desktop.getDesktop(); - try { - desk.browse(new URI(url)); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Opening Feature List in browser.")); - } catch (URISyntaxException | IOException ignored){ - - ChatComponentText clickTextFeatures = new ChatComponentText( - EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Click here to open the Feature List in your browser."); - clickTextFeatures.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url)); - Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextFeatures); - - } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - - } - }); - - - SimpleCommand stWhyCommand = new SimpleCommand("neustwhy", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - NEUEventListener.displayNotification(Lists.newArrayList( - "\u00a7eStorage Viewer", - "\u00a77Currently, the storage viewer requires you to click twice", - "\u00a77in order to switch between pages. This is because Hypixel", - "\u00a77has not yet added a shortcut command to go to any enderchest/", - "\u00a77storage page.", - "\u00a77While it is possible to send the second click", - "\u00a77automatically, doing so violates Hypixel's new mod rules."), true); - } - }); - - SimpleCommand gamemodesCommand = new SimpleCommand("neugamemodes", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - boolean upgradeOverride = args.length == 1 && args[0].equals("upgradeOverride"); - openGui = new GuiGamemodes(upgradeOverride); - } - }); - SimpleCommand buttonsCommand = new SimpleCommand("neubuttons", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - openGui = new GuiInvButtonEditor(); - } - }); - - SimpleCommand enchantColourCommand = new SimpleCommand("neuec", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - openGui = new GuiEnchantColour(); - } - }); - - SimpleCommand resetRepoCommand = new SimpleCommand("neuresetrepo", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - manager.resetRepo(); - } - }); - - SimpleCommand dungeonWinTest = new SimpleCommand("neudungeonwintest", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(args.length > 0) { - DungeonWin.TEAM_SCORE = new ResourceLocation("notenoughupdates:dungeon_win/"+args[0].toLowerCase()+".png"); - } - - DungeonWin.displayWin(); - } - }); - - SimpleCommand reloadRepoCommand = new SimpleCommand("neureloadrepo", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - File items = new File(manager.repoLocation, "items"); - if(items.exists()) { - File[] itemFiles = new File(manager.repoLocation, "items").listFiles(); - if(itemFiles != null) { - for(File f : itemFiles) { - String internalname = f.getName().substring(0, f.getName().length()-5); - manager.loadItem(internalname); - } - } - } - Constants.reload(); - - configFile = new File(neuDir, "configNew.json"); - if(configFile.exists()) { - try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) { - config = gson.fromJson(reader, NEUConfig.class); - } catch(Exception e) { } - } - } - }); - private static HashMap petRarityToColourMap = new HashMap<>(); + public static HashMap petRarityToColourMap = new HashMap<>(); static { petRarityToColourMap.put("UNKNOWN", EnumChatFormatting.RED.toString()); @@ -395,806 +130,17 @@ public class NotEnoughUpdates { petRarityToColourMap.put("LEGENDARY", EnumChatFormatting.GOLD.toString()); petRarityToColourMap.put("MYTHIC", EnumChatFormatting.LIGHT_PURPLE.toString()); } - ScheduledExecutorService peekCommandExecutorService = null; - SimpleCommand peekCommand = new SimpleCommand("peek", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - String name; - if(args.length == 0) { - name = Minecraft.getMinecraft().thePlayer.getName(); - } else { - name = args[0]; - } - int id = new Random().nextInt(Integer.MAX_VALUE/2)+Integer.MAX_VALUE/2; - - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( - EnumChatFormatting.YELLOW+"[PEEK] Getting player information..."), id); - profileViewer.getProfileByName(name, profile -> { - if (profile == null) { - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( - EnumChatFormatting.RED+"[PEEK] Unknown player or api is down."), id); - } else { - profile.resetCache(); - - if(peekCommandExecutorService == null || peekCommandExecutorService.isShutdown()) { - peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor(); - } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.RED+"[PEEK] New peek command run, cancelling old one.")); - peekCommandExecutorService.shutdownNow(); - peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor(); - } - - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( - EnumChatFormatting.YELLOW+"[PEEK] Getting player skyblock profiles..."), id); - - long startTime = System.currentTimeMillis(); - peekCommandExecutorService.schedule(new Runnable() { - public void run() { - if(System.currentTimeMillis() - startTime > 10*1000) { - - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( - EnumChatFormatting.RED+"[PEEK] Getting profile info took too long, aborting."), id); - return; - } - - String g = EnumChatFormatting.GRAY.toString(); - - JsonObject profileInfo = profile.getProfileInformation(null); - if(profileInfo != null) { - float overallScore = 0; - - boolean isMe = name.equalsIgnoreCase("moulberry"); - - PlayerStats.Stats stats = profile.getStats(null); - JsonObject skill = profile.getSkillInfo(null); - - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(EnumChatFormatting.GREEN+" "+ - EnumChatFormatting.STRIKETHROUGH+"-=-" +EnumChatFormatting.RESET+EnumChatFormatting.GREEN+" "+ - Utils.getElementAsString(profile.getHypixelProfile().get("displayname"), name) + "'s Info " + - EnumChatFormatting.STRIKETHROUGH+"-=-"), id); - - if(skill == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW+"Skills api disabled!")); - } else { - float totalSkillLVL = 0; - float totalSkillCount = 0; - - for(Map.Entry entry : skill.entrySet()) { - if(entry.getKey().startsWith("level_skill")) { - if(entry.getKey().contains("runecrafting")) continue; - if(entry.getKey().contains("carpentry")) continue; - totalSkillLVL += entry.getValue().getAsFloat(); - totalSkillCount++; - } - } - - float combat = Utils.getElementAsFloat(skill.get("level_skill_combat"), 0); - float zombie = Utils.getElementAsFloat(skill.get("level_slayer_zombie"), 0); - float spider = Utils.getElementAsFloat(skill.get("level_slayer_spider"), 0); - float wolf = Utils.getElementAsFloat(skill.get("level_slayer_wolf"), 0); - float enderman = Utils.getElementAsFloat(skill.get("level_slayer_enderman"), 0); - - float avgSkillLVL = totalSkillLVL/totalSkillCount; - - if(isMe) { - avgSkillLVL = 6; - combat = 4; - zombie = 2; - spider = 1; - wolf = 2; - enderman = 0; - } - - EnumChatFormatting combatPrefix = combat>20?(combat>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting zombiePrefix = zombie>3?(zombie>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting spiderPrefix = spider>3?(spider>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting wolfPrefix = wolf>3?(wolf>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting endermanPrefix = enderman>3?(enderman>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting avgPrefix = avgSkillLVL>20?(avgSkillLVL>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - - overallScore += zombie*zombie/81f; - overallScore += spider*spider/81f; - overallScore += wolf*wolf/81f; - overallScore += enderman*enderman/81f; - overallScore += avgSkillLVL/20f; - - int cata = (int)Utils.getElementAsFloat(skill.get("level_skill_catacombs"), 0); - EnumChatFormatting cataPrefix = cata>15?(cata>25?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - - overallScore += cata*cata/2000f; - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - g+"Combat: "+combatPrefix+(int)Math.floor(combat) + - (cata > 0 ? g+" - Cata: "+cataPrefix+cata : "")+ - g+" - AVG: " + avgPrefix+(int)Math.floor(avgSkillLVL))); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - g+"Slayer: "+zombiePrefix+(int)Math.floor(zombie)+g+"-"+ - spiderPrefix+(int)Math.floor(spider)+g+"-"+ - wolfPrefix+(int)Math.floor(wolf)+"-"+ - endermanPrefix+(int)Math.floor(enderman))); - } - if (stats == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.YELLOW+"Skills, collection and/or inventory apis disabled!")); - } else { - int health = (int)stats.get("health"); - int defence = (int)stats.get("defence"); - int strength = (int)stats.get("strength"); - int intelligence = (int)stats.get("intelligence"); - - EnumChatFormatting healthPrefix = health>800?(health>1600?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting defencePrefix = defence>200?(defence>600?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting strengthPrefix = strength>100?(strength>300?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - EnumChatFormatting intelligencePrefix = intelligence>300?(intelligence>900?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - g+"Stats : "+healthPrefix+health+EnumChatFormatting.RED+"\u2764 "+ - defencePrefix+defence+EnumChatFormatting.GREEN+"\u2748 "+ - strengthPrefix+strength+EnumChatFormatting.RED+"\u2741 "+ - intelligencePrefix+intelligence+EnumChatFormatting.AQUA+"\u270e ")); - } - float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), -1); - float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0); - - long networth = profile.getNetWorth(null); - float money = Math.max(bankBalance+purseBalance, networth); - EnumChatFormatting moneyPrefix = money>50*1000*1000? - (money>200*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - g+"Purse: "+moneyPrefix+Utils.shortNumberFormat(purseBalance, 0) + g+" - Bank: " + - (bankBalance == -1 ? EnumChatFormatting.YELLOW+"N/A" : moneyPrefix+ - (isMe?"4.8b":Utils.shortNumberFormat(bankBalance, 0))) + - (networth > 0 ? g+" - Net: "+moneyPrefix+Utils.shortNumberFormat(networth, 0) : ""))); - - overallScore += Math.min(2, money/(100f*1000*1000)); - - String activePet = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.type"), - "None Active"); - String activePetTier = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.tier"), "UNKNOWN"); - - String col = petRarityToColourMap.get(activePetTier); - if(col == null) col = EnumChatFormatting.LIGHT_PURPLE.toString(); - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(g+"Pet : " + - col + WordUtils.capitalizeFully(activePet.replace("_", " ")))); - - String overall = "Skywars Main"; - if(isMe) { - overall = Utils.chromaString("Literally the best player to exist"); // ego much - } else if(overallScore < 5 && (bankBalance+purseBalance) > 500*1000*1000) { - overall = EnumChatFormatting.GOLD+"Bill Gates"; - } else if(overallScore > 9) { - overall = Utils.chromaString("Didn't even think this score was possible"); - } else if(overallScore > 8) { - overall = Utils.chromaString("Mentally unstable"); - } else if(overallScore > 7) { - overall = EnumChatFormatting.GOLD+"Why though 0.0"; - } else if(overallScore > 5.5) { - overall = EnumChatFormatting.GOLD+"Bro stop playing"; - } else if(overallScore > 4) { - overall = EnumChatFormatting.GREEN+"Kinda sweaty"; - } else if(overallScore > 3) { - overall = EnumChatFormatting.YELLOW+"Alright I guess"; - } else if(overallScore > 2) { - overall = EnumChatFormatting.YELLOW+"Ender Non"; - } else if(overallScore > 1) { - overall = EnumChatFormatting.RED+"Played Skyblock"; - } - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(g+"Overall score: " + - overall + g + " (" + Math.round(overallScore*10)/10f + ")")); - - peekCommandExecutorService.shutdownNow(); - } else { - peekCommandExecutorService.schedule(this, 200, TimeUnit.MILLISECONDS); - } - } - }, 200, TimeUnit.MILLISECONDS); - } - }); - } - }, new SimpleCommand.TabCompleteRunnable() { - @Override - public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length != 1) return null; - - String lastArg = args[args.length - 1]; - List playerMatches = new ArrayList<>(); - for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { - String playerName = player.getName(); - if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { - playerMatches.add(playerName); - } - } - return playerMatches; - } - }); - - - SimpleCommand pcStatsCommand = new SimpleCommand("neustats", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - Minecraft mc = Minecraft.getMinecraft(); - StringBuilder builder = new StringBuilder(); - - if (args.length > 0 && args[0].toLowerCase().equals("modlist")){ - builder.append("```md\n"); - builder.append("# Mods Loaded").append("\n"); - for (ModContainer modContainer : Loader.instance().getActiveModList()) { - builder.append("[").append(modContainer.getName()).append("]") - .append("[").append(modContainer.getSource().getName()).append("]\n"); - } - builder.append("```"); - } else { - long memorySize = -1; - try { - memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); - } catch(Exception e){} - long maxMemory = Runtime.getRuntime().maxMemory(); - long totalMemory = Runtime.getRuntime().totalMemory(); - long freeMemory = Runtime.getRuntime().freeMemory(); - long currentMemory = totalMemory - freeMemory; - int modCount = Loader.instance().getModList().size(); - int activeModCount = Loader.instance().getActiveModList().size(); - - builder.append("```md\n"); - builder.append("# System Stats").append("\n"); - builder.append("[OS]").append("[").append(System.getProperty("os.name")).append("]").append("\n"); - builder.append("[CPU]").append("[").append(OpenGlHelper.getCpu()).append("]").append("\n"); - builder.append("[Display]").append("[").append(String.format("%dx%d (%s)", Display.getWidth(), Display.getHeight(), GL11.glGetString(GL11.GL_VENDOR))).append("]").append("\n"); - builder.append("[GPU]").append("[").append(GL11.glGetString(GL11.GL_RENDERER)).append("]").append("\n"); - builder.append("[GPU Driver]").append("[").append(GL11.glGetString(GL11.GL_VERSION)).append("]").append("\n"); - if(memorySize > 0) { - builder.append("[Maximum Memory]").append("[").append(memorySize / 1024L / 1024L).append("MB]").append("\n"); - } - builder.append("[Shaders]").append("[").append((""+OpenGlHelper.areShadersSupported()).toUpperCase()).append("]").append("\n"); - builder.append("[Framebuffers]").append("[").append((""+OpenGlHelper.isFramebufferEnabled()).toUpperCase()).append("]").append("\n"); - builder.append("# Java Stats").append("\n"); - builder.append("[Java]").append("[").append(String.format("%s %dbit", System.getProperty("java.version"), mc.isJava64bit() ? 64 : 32)).append("]").append("\n"); - builder.append("[Memory]").append("[").append(String.format("% 2d%% %03d/%03dMB", currentMemory * 100L / maxMemory, currentMemory / 1024L / 1024L, maxMemory / 1024L / 1024L)).append("]").append("\n"); - builder.append("[Memory Allocated]").append("[").append(String.format("% 2d%% %03dMB", totalMemory * 100L / maxMemory, totalMemory / 1024L / 1024L)).append("]").append("\n"); - builder.append("# Game Stats").append("\n"); - builder.append("[Current FPS]").append("[").append(Minecraft.getDebugFPS()).append("]").append("\n"); - builder.append("[Loaded Mods]").append("[").append(activeModCount).append("/").append(modCount).append("]").append("\n"); - builder.append("[Forge]").append("[").append(ForgeVersion.getVersion()).append("]").append("\n"); - builder.append("# Neu Settings").append("\n"); - builder.append("[API Key]").append("[").append(!config.apiKey.apiKey.isEmpty()).append("]").append("\n"); - builder.append("[On Skyblock]").append("[").append(hasSkyblockScoreboard).append("]").append("\n"); - builder.append("[Mod Version]").append("[").append(Loader.instance().getIndexedModList().get(MODID).getSource().getName()).append("]").append("\n"); - builder.append("[SB Profile]").append("[").append(SBInfo.getInstance().currentProfile).append("]").append("\n"); - builder.append("# Repo Stats").append("\n"); - builder.append("[Last Commit]").append("[").append(manager.latestRepoCommit).append("]").append("\n"); - builder.append("[Loaded Items]").append("[").append(manager.getItemInformation().size()).append("]").append("\n"); - if (activeModCount <= 15) { - builder.append("# Mods Loaded").append("\n"); - for (ModContainer modContainer : Loader.instance().getActiveModList()) { - builder.append("[").append(modContainer.getName()).append("]") - .append("[").append(modContainer.getSource().getName()).append("]\n"); - } - builder.append("```"); - } else { - builder.append("```"); - } - } - try { - StringSelection clipboard = new StringSelection(builder.toString()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "[" + EnumChatFormatting.RED + "NotEnoughUpdates" + EnumChatFormatting.GOLD + "]: " + EnumChatFormatting.GREEN + "Dev info copied to clipboard.")); - } catch (Exception ignored) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "[" + EnumChatFormatting.RED + "NotEnoughUpdates" + EnumChatFormatting.GOLD + "]: " + EnumChatFormatting.DARK_RED + "Could not copy to clipboard.")); - } - } - }); public static ProfileViewer profileViewer; - SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(!OpenGlHelper.isFramebufferEnabled()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Some parts of the profile viewer do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); - - } - if (config.apiKey.apiKey == null || config.apiKey.apiKey.trim().isEmpty()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Can't view profile, apikey is not set. Run /api new and put the result in settings.")); - } else if (args.length == 0) { - profileViewer.getProfileByName(Minecraft.getMinecraft().thePlayer.getName(), profile -> { - if(profile == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Invalid player name/api key. Maybe api is down? Try /api new.")); - } else { - profile.resetCache(); - openGui = new GuiProfileViewer(profile); - } - }); - } else if (args.length > 1) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Too many arguments. Usage: /neuprofile [name]")); - } else { - profileViewer.getProfileByName(args[0], profile -> { - if(profile == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Invalid player name/api key. Maybe api is down? Try /api new.")); - } else { - profile.resetCache(); - openGui = new GuiProfileViewer(profile); - } - }); - } - } - }; - - - SimpleCommand joinDungeonCommand = new SimpleCommand("join", new SimpleCommand.ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if (!hasSkyblockScoreboard()) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/join " + StringUtils.join(args, " ")); - } else { - if(args.length != 1) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.RED+"Example Usage: /join f7, /join m6 or /join 7")); - } else { - String cataPrefix = "catacombs"; - if(args[0].startsWith("m")){ - cataPrefix = "master_catacombs"; - } - String cmd = "/joindungeon "+cataPrefix+" " + args[0].charAt(args[0].length()-1); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.YELLOW+"Running command: "+cmd)); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.YELLOW+"The dungeon should start soon. If it doesn't, make sure you have a party of 5 people")); - Minecraft.getMinecraft().thePlayer.sendChatMessage(cmd); - } - } - } - }); - - SimpleCommand viewProfileCommand = new SimpleCommand("neuprofile", viewProfileRunnable, new SimpleCommand.TabCompleteRunnable() { - @Override - public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if(args.length != 1) return null; - - String lastArg = args[args.length-1]; - List playerMatches = new ArrayList<>(); - for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { - String playerName = player.getName(); - if(playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { - playerMatches.add(playerName); - } - } - return playerMatches; - } - }); - - SimpleCommand viewProfileShortCommand = new SimpleCommand("pv", new SimpleCommand.ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if(!isOnSkyblock()) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/pv " + StringUtils.join(args, " ")); - } else { - viewProfileRunnable.processCommand(sender, args); - } - } - }, new SimpleCommand.TabCompleteRunnable() { - @Override - public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length != 1) return null; - - String lastArg = args[args.length - 1]; - List playerMatches = new ArrayList<>(); - for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { - String playerName = player.getName(); - if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { - playerMatches.add(playerName); - } - } - return playerMatches; - } - }); - - SimpleCommand dhCommand = new SimpleCommand("dh", new SimpleCommand.ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub"); - } - }); - - private ScheduledExecutorService devES = Executors.newSingleThreadScheduledExecutor(); - private static final String[] devFailStrings = {"No.", "I said no.", "You aren't allowed to use this.", - "Are you sure you want to use this? Type 'Yes' in chat.", "Are you sure you want to use this? Type 'Yes' in chat.", - "Lmao you thought", "Ok please stop", "What do you want from me?", - "This command almost certainly does nothing useful for you", - "Ok, this is the last message, after this it will repeat", "No.", "I said no.", "Dammit. I thought that would work. Uhh...", - "\u00a7dFrom \u00a7c[ADMIN] Minikloon\u00a77: If you use that command again, I'll have to ban you", "", - "Ok, this is actually the last message, use the command again and you'll crash I promise"}; - private int devFailIndex = 0; - - private static final List devTestUsers = new ArrayList<>(Arrays.asList("moulberry", "lucycoconut", "ironm00n", "ariyio")); - SimpleCommand devTestCommand = new SimpleCommand("neudevtest", new SimpleCommand.ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if(!devTestUsers.contains(Minecraft.getMinecraft().thePlayer.getName().toLowerCase())) { - if(devFailIndex >= devFailStrings.length) { - throw new Error("L") { - @Override - public void printStackTrace() { - throw new Error("L"); - } - }; - } - if(devFailIndex == devFailStrings.length-2) { - devFailIndex++; - - ChatComponentText component = new ChatComponentText("\u00a7cYou are permanently banned from this server!"); - component.appendText("\n"); - component.appendText("\n\u00a77Reason: \u00a7rI told you not to run the command - Moulberry"); - component.appendText("\n\u00a77Find out more: \u00a7b\u00a7nhttps://www.hypixel.net/appeal"); - component.appendText("\n"); - component.appendText("\n\u00a77Ban ID: \u00a7r#49871982"); - component.appendText("\n\u00a77Sharing your Ban ID may affect the processing of your appeal!"); - Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(component); - return; - } - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+devFailStrings[devFailIndex++])); - return; - } - /*if(args.length == 1) { - DupePOC.doDupe(args[0]); - return; - }*/ - if(args.length == 1 && args[0].equalsIgnoreCase("positiontest")) { - openGui = new GuiPositionEditor(); - return; - } - - if(args.length == 2 && args[0].equalsIgnoreCase("pt")) { - EnumParticleTypes t = EnumParticleTypes.valueOf(args[1]); - FishingHelper.type = t; - return; - } - if(args.length == 1 && args[0].equalsIgnoreCase("dev")) { - NotEnoughUpdates.INSTANCE.config.hidden.dev = true; - return; - } - if(args.length == 1 && args[0].equalsIgnoreCase("saveconfig")) { - saveConfig(); - return; - } - if(args.length == 1 && args[0].equalsIgnoreCase("center")) { - double x = Math.floor(Minecraft.getMinecraft().thePlayer.posX) + 0.5f; - double z = Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + 0.5f; - Minecraft.getMinecraft().thePlayer.setPosition(x, Minecraft.getMinecraft().thePlayer.posY, z); - return; - } - if(args.length == 1 && args[0].equalsIgnoreCase("pansc")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Taking panorama screenshot")); - - AtomicInteger perspective = new AtomicInteger(0); - FancyPortals.perspectiveId = 0; - - EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; - p.prevRotationYaw = p.rotationYaw = 0; - p.prevRotationPitch = p.rotationPitch = 90; - devES.schedule(new Runnable() { - @Override - public void run() { - Minecraft.getMinecraft().addScheduledTask(() -> { - ScreenShotHelper.saveScreenshot(new File("C:/Users/James/Desktop/"), "pansc-"+perspective.get()+".png", - Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, - Minecraft.getMinecraft().getFramebuffer()); - }); - if(perspective.incrementAndGet() >= 6) { - FancyPortals.perspectiveId = -1; - return; - } - devES.schedule(() -> { - FancyPortals.perspectiveId = perspective.get(); - if(FancyPortals.perspectiveId == 5) { - p.prevRotationYaw = p.rotationYaw = 0; - p.prevRotationPitch = p.rotationPitch = -90; - } else if(FancyPortals.perspectiveId >= 1 && FancyPortals.perspectiveId <= 4) { - float yaw = 90*FancyPortals.perspectiveId-180; - if(yaw > 180) yaw -= 360; - p.prevRotationYaw = p.rotationYaw = yaw; - p.prevRotationPitch = p.rotationPitch = 0; - } - devES.schedule(this, 3000L, TimeUnit.MILLISECONDS); - }, 100L, TimeUnit.MILLISECONDS); - } - }, 3000L, TimeUnit.MILLISECONDS); - - return; - } - - /* if(args.length == 1 && args[0].equalsIgnoreCase("update")) { - NEUEventListener.displayUpdateMessageIfOutOfDate(); - } */ - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Executing dubious code")); - /*Minecraft.getMinecraft().thePlayer.rotationYaw = 0; - Minecraft.getMinecraft().thePlayer.rotationPitch = 0; - Minecraft.getMinecraft().thePlayer.setPosition( - Math.floor(Minecraft.getMinecraft().thePlayer.posX) + Float.parseFloat(args[0]), - Minecraft.getMinecraft().thePlayer.posY, - Minecraft.getMinecraft().thePlayer.posZ);*/ - //Hot reload me yay! - } - }); - public boolean packDevEnabled = false; - SimpleCommand packDevCommand = new SimpleCommand("neupackdev", new SimpleCommand.ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if(args.length == 1 && args[0].equalsIgnoreCase("getnpc")) { - double distSq = 25; - EntityPlayer closestNPC = null; - EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; - for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { - if(player instanceof AbstractClientPlayer && p != player && player.getUniqueID().version() != 4) { - double dSq = player.getDistanceSq(p.posX, p.posY, p.posZ); - if(dSq < distSq) { - distSq = dSq; - closestNPC = player; - } - } - } - - if(closestNPC == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"No NPCs found within 5 blocks :(")); - } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Copied entity texture id to clipboard")); - MiscUtils.copyToClipboard(((AbstractClientPlayer)closestNPC).getLocationSkin().getResourcePath().replace("skins/", "")); - } - return; - } - packDevEnabled = !packDevEnabled; - if(packDevEnabled) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Enabled pack developer mode.")); - } else { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Disabled pack developer mode.")); - } - } - }); - - SimpleCommand dnCommand = new SimpleCommand("dn", new SimpleCommand.ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub"); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA+"Warping to:"+EnumChatFormatting.YELLOW+" Deez Nuts lmao")); - } - }); - - SimpleCommand viewCataCommand = new SimpleCommand("cata", new SimpleCommand.ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - GuiProfileViewer.currentPage = GuiProfileViewer.ProfileViewerPage.DUNG; - viewProfileRunnable.processCommand(sender, args); - } - }, new SimpleCommand.TabCompleteRunnable() { - @Override - public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { - if (args.length != 1) return null; - String lastArg = args[args.length - 1]; - List playerMatches = new ArrayList<>(); - for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { - String playerName = player.getName(); - if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { - playerMatches.add(playerName); - } - } - return playerMatches; - } - }); - - SimpleCommand linksCommand = new SimpleCommand("neulinks", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - File repo = manager.repoLocation; - if(repo.exists()) { - File updateJson = new File(repo, "update.json"); - try { - JsonObject update = manager.getJsonFromFile(updateJson); - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - displayLinks(update); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - } catch (Exception ignored) { - } - } - } - }); - - SimpleCommand overlayPlacementsCommand = new SimpleCommand("neuoverlay", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - openGui = new NEUOverlayPlacements(); - } - }); + private Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); + private File neuDir; - SimpleCommand tutorialCommand = new SimpleCommand("neututorial", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - openGui = new NeuTutorial(); - } - }); + public File getNeuDir(){ return this.neuDir;} public Color[][] colourMap = null; - SimpleCommand neumapCommand = new SimpleCommand("neumap", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(colourMap == null) { - try(BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource( - new ResourceLocation("notenoughupdates:maps/F1Full.json")).getInputStream(), StandardCharsets.UTF_8))) { - JsonObject json = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, JsonObject.class); - - colourMap = new Color[128][128]; - for(int x=0; x<128; x++) { - for(int y=0; y<128; y++) { - colourMap[x][y] = new Color(0, 0, 0, 0); - } - } - for(Map.Entry entry : json.entrySet()) { - int x = Integer.parseInt(entry.getKey().split(":")[0]); - int y = Integer.parseInt(entry.getKey().split(":")[1]); - - colourMap[x][y] = new Color(entry.getValue().getAsInt(), true); - } - } catch(Exception ignored) { } - } - - if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { - openGui = new GuiDungeonMapEditor(); - return; - } - - if(args.length == 1 && args[0].equals("reset")) { - colourMap = null; - return; - } - - if(args.length != 2) { - openGui = new GuiDungeonMapEditor(); - return; - } - - if(args[0].equals("save")) { - ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem(); - if(stack != null && stack.getItem() instanceof ItemMap) { - ItemMap map = (ItemMap) stack.getItem(); - MapData mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld); - - if (mapData == null) return; - - JsonObject json = new JsonObject(); - for (int i = 0; i < 16384; ++i) { - int x = i % 128; - int y = i / 128; - - int j = mapData.colors[i] & 255; - - Color c; - if (j / 4 == 0) { - c = new Color((i + i / 128 & 1) * 8 + 16 << 24, true); - } else { - c = new Color(MapColor.mapColorArray[j / 4].getMapColor(j & 3), true); - } - - json.addProperty(x+":"+y, c.getRGB()); - } - - try { - new File(manager.configLocation, "maps").mkdirs(); - manager.writeJson(json, new File(manager.configLocation, "maps/"+args[1]+".json")); - } catch(Exception e) { - e.printStackTrace(); - } - - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+ - "Saved to file.")); - } - - return; - } - - if(args[0].equals("load")) { - JsonObject json = manager.getJsonFromFile(new File(manager.configLocation, "maps/"+args[1]+".json")); - - colourMap = new Color[128][128]; - for(int x=0; x<128; x++) { - for(int y=0; y<128; y++) { - colourMap[x][y] = new Color(0, 0, 0, 0); - } - } - for(Map.Entry entry : json.entrySet()) { - int x = Integer.parseInt(entry.getKey().split(":")[0]); - int y = Integer.parseInt(entry.getKey().split(":")[1]); - - colourMap[x][y] = new Color(entry.getValue().getAsInt(), true); - } - - return; - } - - openGui = new GuiDungeonMapEditor(); - } - }); - - SimpleCommand cosmeticsCommand = new SimpleCommand("neucosmetics", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(!OpenGlHelper.isFramebufferEnabled()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "NEU cosmetics do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); - - } - - openGui = new GuiCosmetics(); - } - }); - - SimpleCommand.ProcessCommandRunnable customizeRunnable = new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); - - if(held == null) { - sender.addChatMessage(new ChatComponentText("\u00a7cYou can't customize your hand...")); - return; - } - - String heldUUID = manager.getUUIDForItem(held); - - if(heldUUID == null) { - sender.addChatMessage(new ChatComponentText("\u00a7cHeld item does not have UUID, cannot be customized")); - return; - } - - openGui = new GuiItemCustomize(held, heldUUID); - } - }; - - SimpleCommand customizeCommand = new SimpleCommand("neucustomize", customizeRunnable); - SimpleCommand customizeCommand2 = new SimpleCommand("neurename", customizeRunnable); - - SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(args.length > 0) { - openGui = new GuiScreenElementWrapper(new NEUConfigEditor(config, StringUtils.join(args, " "))); - } else { - openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor); - } - } - }; - - SimpleCommand settingsCommand = new SimpleCommand("neu", settingsRunnable); - SimpleCommand settingsCommand2 = new SimpleCommand("neusettings", settingsRunnable); - SimpleCommand settingsCommand3 = new SimpleCommand("neuconfig", settingsRunnable); - - SimpleCommand calendarCommand = new SimpleCommand("neucalendar", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - Minecraft.getMinecraft().thePlayer.closeScreen(); - CalendarOverlay.setEnabled(true); - sendChatMessage("/calendar"); - } - }); - - SimpleCommand neuAhCommand = new SimpleCommand("neuah", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - if(!hasSkyblockScoreboard()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ - "You must be on Skyblock to use this feature.")); - } else if(config.apiKey.apiKey == null || config.apiKey.apiKey.trim().isEmpty()) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ - "Can't open NeuAH, apikey is not set. Run /api new and put the result in settings.")); - } else { - openGui = new CustomAHGui(); - manager.auctionManager.customAH.lastOpen = System.currentTimeMillis(); - manager.auctionManager.customAH.clearSearch(); - manager.auctionManager.customAH.updateSearch(); - - if(args.length > 0) manager.auctionManager.customAH.setSearch(StringUtils.join(args, " ")); - } - } - }); - - private Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); - private File neuDir; /** * Instantiates NEUIo, NEUManager and NEUOverlay instances. Registers keybinds and adds a shutdown hook to clear tmp folder. @@ -1258,43 +204,7 @@ public class NotEnoughUpdates { ((IReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new ItemCustomizeManager.ReloadListener()); } - //ClientCommandHandler.instance.registerCommand(collectionLogCommand); - //ClientCommandHandler.instance.registerCommand(collectionLogCommand2); - ClientCommandHandler.instance.registerCommand(nullzeeSphereCommand); - ClientCommandHandler.instance.registerCommand(cosmeticsCommand); - ClientCommandHandler.instance.registerCommand(linksCommand); - //ClientCommandHandler.instance.registerCommand(gamemodesCommand); - ClientCommandHandler.instance.registerCommand(stWhyCommand); - ClientCommandHandler.instance.registerCommand(buttonsCommand); - ClientCommandHandler.instance.registerCommand(resetRepoCommand); - ClientCommandHandler.instance.registerCommand(reloadRepoCommand); - //ClientCommandHandler.instance.registerCommand(itemRenameCommand); - ClientCommandHandler.instance.registerCommand(joinDungeonCommand); - ClientCommandHandler.instance.registerCommand(viewProfileCommand); - ClientCommandHandler.instance.registerCommand(viewProfileShortCommand); - ClientCommandHandler.instance.registerCommand(dhCommand); - ClientCommandHandler.instance.registerCommand(dnCommand); - ClientCommandHandler.instance.registerCommand(customizeCommand); - ClientCommandHandler.instance.registerCommand(customizeCommand2); - ClientCommandHandler.instance.registerCommand(devTestCommand); - ClientCommandHandler.instance.registerCommand(packDevCommand); - if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); - ClientCommandHandler.instance.registerCommand(peekCommand); -// ClientCommandHandler.instance.registerCommand(tutorialCommand); - ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); - ClientCommandHandler.instance.registerCommand(enchantColourCommand); - ClientCommandHandler.instance.registerCommand(neuAhCommand); - ClientCommandHandler.instance.registerCommand(pcStatsCommand); - ClientCommandHandler.instance.registerCommand(neumapCommand); - ClientCommandHandler.instance.registerCommand(settingsCommand); - ClientCommandHandler.instance.registerCommand(settingsCommand2); - ClientCommandHandler.instance.registerCommand(settingsCommand3); - ClientCommandHandler.instance.registerCommand(dungeonWinTest); - ClientCommandHandler.instance.registerCommand(calendarCommand); - ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand()); - ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommandAlt()); - ClientCommandHandler.instance.registerCommand(neuHelp); - ClientCommandHandler.instance.registerCommand(neuFeatures); + this.commands = new Commands(); BackgroundBlur.registerListener(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java new file mode 100644 index 00000000..a63f3fde --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java @@ -0,0 +1,1179 @@ +package io.github.moulberry.notenoughupdates.commands; + +import com.google.common.collect.Lists; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NEUEventListener; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.auction.CustomAHGui; +import io.github.moulberry.notenoughupdates.collectionlog.GuiCollectionLog; +import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; +import io.github.moulberry.notenoughupdates.core.config.GuiPositionEditor; +import io.github.moulberry.notenoughupdates.core.util.MiscUtils; +import io.github.moulberry.notenoughupdates.cosmetics.GuiCosmetics; +import io.github.moulberry.notenoughupdates.dungeons.DungeonWin; +import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor; +import io.github.moulberry.notenoughupdates.gamemodes.GuiGamemodes; +import io.github.moulberry.notenoughupdates.miscfeatures.FairySouls; +import io.github.moulberry.notenoughupdates.miscfeatures.FancyPortals; +import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper; +import io.github.moulberry.notenoughupdates.miscfeatures.NullzeeSphere; +import io.github.moulberry.notenoughupdates.miscgui.*; +import io.github.moulberry.notenoughupdates.miscgui.tutorials.NeuTutorial; +import io.github.moulberry.notenoughupdates.options.NEUConfig; +import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; +import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; +import io.github.moulberry.notenoughupdates.profileviewer.PlayerStats; +import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.block.material.MapColor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.ClickEvent; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; +import net.minecraft.util.*; +import net.minecraft.world.storage.MapData; +import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.common.ForgeVersion; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.text.WordUtils; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.awt.datatransfer.StringSelection; +import java.io.*; +import java.lang.management.ManagementFactory; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +public class Commands { + + public Commands(){ + //ClientCommandHandler.instance.registerCommand(collectionLogCommand); + //ClientCommandHandler.instance.registerCommand(collectionLogCommand2); + ClientCommandHandler.instance.registerCommand(nullzeeSphereCommand); + ClientCommandHandler.instance.registerCommand(cosmeticsCommand); + ClientCommandHandler.instance.registerCommand(linksCommand); + //ClientCommandHandler.instance.registerCommand(gamemodesCommand); + ClientCommandHandler.instance.registerCommand(stWhyCommand); + ClientCommandHandler.instance.registerCommand(buttonsCommand); + ClientCommandHandler.instance.registerCommand(resetRepoCommand); + ClientCommandHandler.instance.registerCommand(reloadRepoCommand); + //ClientCommandHandler.instance.registerCommand(itemRenameCommand); + ClientCommandHandler.instance.registerCommand(joinDungeonCommand); + ClientCommandHandler.instance.registerCommand(viewProfileCommand); + ClientCommandHandler.instance.registerCommand(viewProfileShortCommand); + ClientCommandHandler.instance.registerCommand(dhCommand); + ClientCommandHandler.instance.registerCommand(dnCommand); + ClientCommandHandler.instance.registerCommand(customizeCommand); + ClientCommandHandler.instance.registerCommand(customizeCommand2); + ClientCommandHandler.instance.registerCommand(devTestCommand); + ClientCommandHandler.instance.registerCommand(packDevCommand); + if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); + ClientCommandHandler.instance.registerCommand(peekCommand); +// ClientCommandHandler.instance.registerCommand(tutorialCommand); + ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); + ClientCommandHandler.instance.registerCommand(enchantColourCommand); + ClientCommandHandler.instance.registerCommand(neuAhCommand); + ClientCommandHandler.instance.registerCommand(pcStatsCommand); + ClientCommandHandler.instance.registerCommand(neumapCommand); + ClientCommandHandler.instance.registerCommand(settingsCommand); + ClientCommandHandler.instance.registerCommand(settingsCommand2); + ClientCommandHandler.instance.registerCommand(settingsCommand3); + ClientCommandHandler.instance.registerCommand(dungeonWinTest); + ClientCommandHandler.instance.registerCommand(calendarCommand); + ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand()); + ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommandAlt()); + ClientCommandHandler.instance.registerCommand(neuHelp); + ClientCommandHandler.instance.registerCommand(neuFeatures); + } + + SimpleCommand.ProcessCommandRunnable collectionLogRun = new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + NotEnoughUpdates.INSTANCE.openGui = new GuiCollectionLog(); + } + }; + + SimpleCommand collectionLogCommand = new SimpleCommand("neucl", collectionLogRun); + SimpleCommand collectionLogCommand2 = new SimpleCommand("collectionlog", collectionLogRun); + + SimpleCommand nullzeeSphereCommand = new SimpleCommand("neuzeesphere", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(args.length != 1) { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Usage: /neuzeesphere [on/off] or /neuzeesphere (radius) or /neuzeesphere setCenter")); + return; + } + if(args[0].equalsIgnoreCase("on")) { + NullzeeSphere.enabled = true; + } else if(args[0].equalsIgnoreCase("off")) { + NullzeeSphere.enabled = false; + } else if(args[0].equalsIgnoreCase("setCenter")) { + EntityPlayerSP p = ((EntityPlayerSP)sender); + NullzeeSphere.centerPos = new BlockPos(p.posX, p.posY, p.posZ); + NullzeeSphere.overlayVBO = null; + } else { + try { + float radius = Float.parseFloat(args[0]); + NullzeeSphere.size = radius; + NullzeeSphere.overlayVBO = null; + } catch(Exception e) { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Can't parse radius: " + args[0])); + } + } + } + }); + + /*SimpleCommand itemRenameCommand = new SimpleCommand("neurename", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(args.length == 0) { + args = new String[]{"help"}; + } + String heldUUID = NotEnoughUpdates.INSTANCE.manager.getUUIDForItem(Minecraft.getMinecraft().thePlayer.getHeldItem()); + switch(args[0].toLowerCase()) { + case "clearall": + NotEnoughUpdates.INSTANCE.manager.itemRenameJson = new JsonObject(); + NotEnoughUpdates.INSTANCE.manager.saveItemRenameConfig(); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] Cleared custom name for all items")); + break; + case "clear": + if(heldUUID == null) { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't clear rename - no UUID")); + return; + } + NotEnoughUpdates.INSTANCE.manager.itemRenameJson.remove(heldUUID); + NotEnoughUpdates.INSTANCE.manager.saveItemRenameConfig(); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] Cleared custom name for held item")); + break; + case "copyuuid": + if(heldUUID == null) { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't clear rename - no UUID")); + return; + } + StringSelection selection = new StringSelection(heldUUID); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "[NEU] UUID copied to clipboard")); + break; + case "uuid": + if(heldUUID == null) { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't get UUID - no UUID")); + return; + } + ChatStyle style = new ChatStyle(); + style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new ChatComponentText(EnumChatFormatting.GRAY+"Click to copy to clipboard"))); + style.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/neurename copyuuid")); + + ChatComponentText text = new ChatComponentText(EnumChatFormatting.YELLOW+"[NEU] The UUID of your currently held item is: " + + EnumChatFormatting.GREEN + heldUUID); + text.setChatStyle(style); + sender.addChatMessage(text); + break; + case "set": + if(heldUUID == null) { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Can't rename item - no UUID")); + return; + } + if(args.length == 1) { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Usage: /neurename set [name...]")); + return; + } + StringBuilder sb = new StringBuilder(); + for(int i=1; i neuHelpMessages = Lists.newArrayList( + "\u00a75\u00a7lNotEnoughUpdates commands", + "\u00a76/neu \u00a77- Opens the main neu GUI.", + "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer", + "\u00a76/neusouls {on/off/clear/unclear} \u00a7r\u00a77- Shows waypoints to fairy souls.", + "\u00a76/neubuttons \u00a7r\u00a77- Opens a GUI which allows you to customize inventory buttons.", + "\u00a76/neuec \u00a7r\u00a77- Opens the enchant colour GUI.", + + "\u00a76/join {floor} \u00a7r\u00a77- Short Command to join a Dungeon. \u00a7lNeed a Party of 5 People\u00a7r\u00a77 {4/f7/m5}.", + "\u00a76/neucosmetics \u00a7r\u00a77- Opens the cosmetic GUI.", + "\u00a76/neurename \u00a7r\u00a77- Opens the NEU Item Customizer.", + "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer's catacombs page.", + "\u00a76/neulinks \u00a7r\u00a77- Shows links to neu/moulberry.", + "\u00a76/neuoverlay \u00a7r\u00a77- Opens GUI Editor for quickcommands and searchbar.", + "\u00a76/neuah \u00a7r\u00a77- Opens neu's custom ah GUI.", + "\u00a76/neumap \u00a7r\u00a77- Opens the dungeon map GUI.", + "\u00a76/neucalendar \u00a7r\u00a77- Opens neu's custom calendar GUI.", + "", + "\u00a76\u00a7lOld commands:", + "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- Shows quickly stats for a user.", + "", + "\u00a76\u00a7lDebug commands:", + "\u00a76/neustats \u00a7r\u00a77- Copies helpful info to the clipboard.", + "\u00a76/neustats modlist \u00a7r\u00a77- Copies modlist info to clipboard.", + "\u00a76/neuresetrepo \u00a7r\u00a77- Deletes all repo files.", + "\u00a76/neureloadrepo \u00a7r\u00a77- Debug command with repo.", + "", + "\u00a76\u00a7lDev commands:", + "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc"); + for (int i = 0; i < neuHelpMessages.size(); i++) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuHelpMessages.get(i) + )); + + } + if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { + ArrayList neuDevHelpMessages = Lists.newArrayList( + "\u00a76/neudevtest \u00a7r\u00a77- dev test command", + "\u00a76/neuzeephere \u00a7r\u00a77- sphere", + "\u00a76/neudungeonwintest \u00a7r\u00a77- displays the dungeon win screen"); + + for (int i = 0; i < neuDevHelpMessages.size(); i++) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuDevHelpMessages.get(i) + )); + + } + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Commands marked with a \u00a72\"\u2D35\"\u00a77 require are api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\"")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Arguments marked with a \u00a7b\"?\"\u00a77 are optional.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a76\u00a7lScroll up to see everything")); + } + }); + + SimpleCommand neuFeatures = new SimpleCommand("neufeatures", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + if(Constants.MISC == null || !Constants.MISC.has("featureslist")){ + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"WARNING: "+EnumChatFormatting.RESET+EnumChatFormatting.RED+"Could not load URL from repo.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.RED+ "Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + return; + } + String url = Constants.MISC.get("featureslist").getAsString(); + + Desktop desk = Desktop.getDesktop(); + try { + desk.browse(new URI(url)); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Opening Feature List in browser.")); + } catch (URISyntaxException | IOException ignored){ + + ChatComponentText clickTextFeatures = new ChatComponentText( + EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Click here to open the Feature List in your browser."); + clickTextFeatures.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url)); + Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextFeatures); + + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + + } + }); + + + SimpleCommand stWhyCommand = new SimpleCommand("neustwhy", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + NEUEventListener.displayNotification(Lists.newArrayList( + "\u00a7eStorage Viewer", + "\u00a77Currently, the storage viewer requires you to click twice", + "\u00a77in order to switch between pages. This is because Hypixel", + "\u00a77has not yet added a shortcut command to go to any enderchest/", + "\u00a77storage page.", + "\u00a77While it is possible to send the second click", + "\u00a77automatically, doing so violates Hypixel's new mod rules."), true); + } + }); + + SimpleCommand gamemodesCommand = new SimpleCommand("neugamemodes", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + boolean upgradeOverride = args.length == 1 && args[0].equals("upgradeOverride"); + NotEnoughUpdates.INSTANCE.openGui = new GuiGamemodes(upgradeOverride); + } + }); + + SimpleCommand buttonsCommand = new SimpleCommand("neubuttons", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + NotEnoughUpdates.INSTANCE.openGui = new GuiInvButtonEditor(); + } + }); + + SimpleCommand enchantColourCommand = new SimpleCommand("neuec", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + NotEnoughUpdates.INSTANCE.openGui = new GuiEnchantColour(); + } + }); + + SimpleCommand resetRepoCommand = new SimpleCommand("neuresetrepo", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + NotEnoughUpdates.INSTANCE.manager.resetRepo(); + } + }); + + SimpleCommand dungeonWinTest = new SimpleCommand("neudungeonwintest", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(args.length > 0) { + DungeonWin.TEAM_SCORE = new ResourceLocation("notenoughupdates:dungeon_win/"+args[0].toLowerCase()+".png"); + } + + DungeonWin.displayWin(); + } + }); + + SimpleCommand reloadRepoCommand = new SimpleCommand("neureloadrepo", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + File items = new File(NotEnoughUpdates.INSTANCE.manager.repoLocation, "items"); + if(items.exists()) { + File[] itemFiles = new File(NotEnoughUpdates.INSTANCE.manager.repoLocation, "items").listFiles(); + if(itemFiles != null) { + for(File f : itemFiles) { + String internalname = f.getName().substring(0, f.getName().length()-5); + NotEnoughUpdates.INSTANCE.manager.loadItem(internalname); + } + } + } + Constants.reload(); + + NotEnoughUpdates.INSTANCE.newConfigFile(); + if(NotEnoughUpdates.INSTANCE.getConfigFile().exists()) { + try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(NotEnoughUpdates.INSTANCE.getConfigFile()), StandardCharsets.UTF_8))) { + NotEnoughUpdates.INSTANCE.config = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, NEUConfig.class); + } catch(Exception e) { } + } + } + }); + + ScheduledExecutorService peekCommandExecutorService = null; + + SimpleCommand peekCommand = new SimpleCommand("peek", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + String name; + if(args.length == 0) { + name = Minecraft.getMinecraft().thePlayer.getName(); + } else { + name = args[0]; + } + int id = new Random().nextInt(Integer.MAX_VALUE/2)+Integer.MAX_VALUE/2; + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( + EnumChatFormatting.YELLOW+"[PEEK] Getting player information..."), id); + NotEnoughUpdates.INSTANCE.profileViewer.getProfileByName(name, profile -> { + if (profile == null) { + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( + EnumChatFormatting.RED+"[PEEK] Unknown player or api is down."), id); + } else { + profile.resetCache(); + + if(peekCommandExecutorService == null || peekCommandExecutorService.isShutdown()) { + peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor(); + } else { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.RED+"[PEEK] New peek command run, cancelling old one.")); + peekCommandExecutorService.shutdownNow(); + peekCommandExecutorService = Executors.newSingleThreadScheduledExecutor(); + } + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( + EnumChatFormatting.YELLOW+"[PEEK] Getting player skyblock profiles..."), id); + + long startTime = System.currentTimeMillis(); + peekCommandExecutorService.schedule(new Runnable() { + public void run() { + if(System.currentTimeMillis() - startTime > 10*1000) { + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText( + EnumChatFormatting.RED+"[PEEK] Getting profile info took too long, aborting."), id); + return; + } + + String g = EnumChatFormatting.GRAY.toString(); + + JsonObject profileInfo = profile.getProfileInformation(null); + if(profileInfo != null) { + float overallScore = 0; + + boolean isMe = name.equalsIgnoreCase("moulberry"); + + PlayerStats.Stats stats = profile.getStats(null); + JsonObject skill = profile.getSkillInfo(null); + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(EnumChatFormatting.GREEN+" "+ + EnumChatFormatting.STRIKETHROUGH+"-=-" +EnumChatFormatting.RESET+EnumChatFormatting.GREEN+" "+ + Utils.getElementAsString(profile.getHypixelProfile().get("displayname"), name) + "'s Info " + + EnumChatFormatting.STRIKETHROUGH+"-=-"), id); + + if(skill == null) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW+"Skills api disabled!")); + } else { + float totalSkillLVL = 0; + float totalSkillCount = 0; + + for(Map.Entry entry : skill.entrySet()) { + if(entry.getKey().startsWith("level_skill")) { + if(entry.getKey().contains("runecrafting")) continue; + if(entry.getKey().contains("carpentry")) continue; + totalSkillLVL += entry.getValue().getAsFloat(); + totalSkillCount++; + } + } + + float combat = Utils.getElementAsFloat(skill.get("level_skill_combat"), 0); + float zombie = Utils.getElementAsFloat(skill.get("level_slayer_zombie"), 0); + float spider = Utils.getElementAsFloat(skill.get("level_slayer_spider"), 0); + float wolf = Utils.getElementAsFloat(skill.get("level_slayer_wolf"), 0); + float enderman = Utils.getElementAsFloat(skill.get("level_slayer_enderman"), 0); + + float avgSkillLVL = totalSkillLVL/totalSkillCount; + + if(isMe) { + avgSkillLVL = 6; + combat = 4; + zombie = 2; + spider = 1; + wolf = 2; + enderman = 0; + } + + EnumChatFormatting combatPrefix = combat>20?(combat>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting zombiePrefix = zombie>3?(zombie>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting spiderPrefix = spider>3?(spider>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting wolfPrefix = wolf>3?(wolf>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting endermanPrefix = enderman>3?(enderman>6?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting avgPrefix = avgSkillLVL>20?(avgSkillLVL>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + + overallScore += zombie*zombie/81f; + overallScore += spider*spider/81f; + overallScore += wolf*wolf/81f; + overallScore += enderman*enderman/81f; + overallScore += avgSkillLVL/20f; + + int cata = (int)Utils.getElementAsFloat(skill.get("level_skill_catacombs"), 0); + EnumChatFormatting cataPrefix = cata>15?(cata>25?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + + overallScore += cata*cata/2000f; + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + g+"Combat: "+combatPrefix+(int)Math.floor(combat) + + (cata > 0 ? g+" - Cata: "+cataPrefix+cata : "")+ + g+" - AVG: " + avgPrefix+(int)Math.floor(avgSkillLVL))); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + g+"Slayer: "+zombiePrefix+(int)Math.floor(zombie)+g+"-"+ + spiderPrefix+(int)Math.floor(spider)+g+"-"+ + wolfPrefix+(int)Math.floor(wolf)+"-"+ + endermanPrefix+(int)Math.floor(enderman))); + } + if (stats == null) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.YELLOW+"Skills, collection and/or inventory apis disabled!")); + } else { + int health = (int)stats.get("health"); + int defence = (int)stats.get("defence"); + int strength = (int)stats.get("strength"); + int intelligence = (int)stats.get("intelligence"); + + EnumChatFormatting healthPrefix = health>800?(health>1600?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting defencePrefix = defence>200?(defence>600?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting strengthPrefix = strength>100?(strength>300?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + EnumChatFormatting intelligencePrefix = intelligence>300?(intelligence>900?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + g+"Stats : "+healthPrefix+health+EnumChatFormatting.RED+"\u2764 "+ + defencePrefix+defence+EnumChatFormatting.GREEN+"\u2748 "+ + strengthPrefix+strength+EnumChatFormatting.RED+"\u2741 "+ + intelligencePrefix+intelligence+EnumChatFormatting.AQUA+"\u270e ")); + } + float bankBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "banking.balance"), -1); + float purseBalance = Utils.getElementAsFloat(Utils.getElement(profileInfo, "coin_purse"), 0); + + long networth = profile.getNetWorth(null); + float money = Math.max(bankBalance+purseBalance, networth); + EnumChatFormatting moneyPrefix = money>50*1000*1000? + (money>200*1000*1000?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED; + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + g+"Purse: "+moneyPrefix+Utils.shortNumberFormat(purseBalance, 0) + g+" - Bank: " + + (bankBalance == -1 ? EnumChatFormatting.YELLOW+"N/A" : moneyPrefix+ + (isMe?"4.8b":Utils.shortNumberFormat(bankBalance, 0))) + + (networth > 0 ? g+" - Net: "+moneyPrefix+Utils.shortNumberFormat(networth, 0) : ""))); + + overallScore += Math.min(2, money/(100f*1000*1000)); + + String activePet = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.type"), + "None Active"); + String activePetTier = Utils.getElementAsString(Utils.getElement(profile.getPetsInfo(null), "active_pet.tier"), "UNKNOWN"); + + String col = NotEnoughUpdates.petRarityToColourMap.get(activePetTier); + if(col == null) col = EnumChatFormatting.LIGHT_PURPLE.toString(); + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(g+"Pet : " + + col + WordUtils.capitalizeFully(activePet.replace("_", " ")))); + + String overall = "Skywars Main"; + if(isMe) { + overall = Utils.chromaString("Literally the best player to exist"); // ego much + } else if(overallScore < 5 && (bankBalance+purseBalance) > 500*1000*1000) { + overall = EnumChatFormatting.GOLD+"Bill Gates"; + } else if(overallScore > 9) { + overall = Utils.chromaString("Didn't even think this score was possible"); + } else if(overallScore > 8) { + overall = Utils.chromaString("Mentally unstable"); + } else if(overallScore > 7) { + overall = EnumChatFormatting.GOLD+"Why though 0.0"; + } else if(overallScore > 5.5) { + overall = EnumChatFormatting.GOLD+"Bro stop playing"; + } else if(overallScore > 4) { + overall = EnumChatFormatting.GREEN+"Kinda sweaty"; + } else if(overallScore > 3) { + overall = EnumChatFormatting.YELLOW+"Alright I guess"; + } else if(overallScore > 2) { + overall = EnumChatFormatting.YELLOW+"Ender Non"; + } else if(overallScore > 1) { + overall = EnumChatFormatting.RED+"Played Skyblock"; + } + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(g+"Overall score: " + + overall + g + " (" + Math.round(overallScore*10)/10f + ")")); + + peekCommandExecutorService.shutdownNow(); + } else { + peekCommandExecutorService.schedule(this, 200, TimeUnit.MILLISECONDS); + } + } + }, 200, TimeUnit.MILLISECONDS); + } + }); + } + }, new SimpleCommand.TabCompleteRunnable() { + @Override + public java.util.List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length != 1) return null; + + String lastArg = args[args.length - 1]; + List playerMatches = new ArrayList<>(); + for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + String playerName = player.getName(); + if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + playerMatches.add(playerName); + } + } + return playerMatches; + } + }); + + + SimpleCommand pcStatsCommand = new SimpleCommand("neustats", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + Minecraft mc = Minecraft.getMinecraft(); + StringBuilder builder = new StringBuilder(); + + if (args.length > 0 && args[0].toLowerCase().equals("modlist")){ + builder.append("```md\n"); + builder.append("# Mods Loaded").append("\n"); + for (ModContainer modContainer : Loader.instance().getActiveModList()) { + builder.append("[").append(modContainer.getName()).append("]") + .append("[").append(modContainer.getSource().getName()).append("]\n"); + } + builder.append("```"); + } else { + long memorySize = -1; + try { + memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); + } catch(Exception e){} + long maxMemory = Runtime.getRuntime().maxMemory(); + long totalMemory = Runtime.getRuntime().totalMemory(); + long freeMemory = Runtime.getRuntime().freeMemory(); + long currentMemory = totalMemory - freeMemory; + int modCount = Loader.instance().getModList().size(); + int activeModCount = Loader.instance().getActiveModList().size(); + + builder.append("```md\n"); + builder.append("# System Stats").append("\n"); + builder.append("[OS]").append("[").append(System.getProperty("os.name")).append("]").append("\n"); + builder.append("[CPU]").append("[").append(OpenGlHelper.getCpu()).append("]").append("\n"); + builder.append("[Display]").append("[").append(String.format("%dx%d (%s)", Display.getWidth(), Display.getHeight(), GL11.glGetString(GL11.GL_VENDOR))).append("]").append("\n"); + builder.append("[GPU]").append("[").append(GL11.glGetString(GL11.GL_RENDERER)).append("]").append("\n"); + builder.append("[GPU Driver]").append("[").append(GL11.glGetString(GL11.GL_VERSION)).append("]").append("\n"); + if(memorySize > 0) { + builder.append("[Maximum Memory]").append("[").append(memorySize / 1024L / 1024L).append("MB]").append("\n"); + } + builder.append("[Shaders]").append("[").append((""+OpenGlHelper.areShadersSupported()).toUpperCase()).append("]").append("\n"); + builder.append("[Framebuffers]").append("[").append((""+OpenGlHelper.isFramebufferEnabled()).toUpperCase()).append("]").append("\n"); + builder.append("# Java Stats").append("\n"); + builder.append("[Java]").append("[").append(String.format("%s %dbit", System.getProperty("java.version"), mc.isJava64bit() ? 64 : 32)).append("]").append("\n"); + builder.append("[Memory]").append("[").append(String.format("% 2d%% %03d/%03dMB", currentMemory * 100L / maxMemory, currentMemory / 1024L / 1024L, maxMemory / 1024L / 1024L)).append("]").append("\n"); + builder.append("[Memory Allocated]").append("[").append(String.format("% 2d%% %03dMB", totalMemory * 100L / maxMemory, totalMemory / 1024L / 1024L)).append("]").append("\n"); + builder.append("# Game Stats").append("\n"); + builder.append("[Current FPS]").append("[").append(Minecraft.getDebugFPS()).append("]").append("\n"); + builder.append("[Loaded Mods]").append("[").append(activeModCount).append("/").append(modCount).append("]").append("\n"); + builder.append("[Forge]").append("[").append(ForgeVersion.getVersion()).append("]").append("\n"); + builder.append("# Neu Settings").append("\n"); + builder.append("[API Key]").append("[").append(!NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.isEmpty()).append("]").append("\n"); + builder.append("[On Skyblock]").append("[").append(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()).append("]").append("\n"); + builder.append("[Mod Version]").append("[").append(Loader.instance().getIndexedModList().get(NotEnoughUpdates.INSTANCE.MODID).getSource().getName()).append("]").append("\n"); + builder.append("[SB Profile]").append("[").append(SBInfo.getInstance().currentProfile).append("]").append("\n"); + builder.append("# Repo Stats").append("\n"); + builder.append("[Last Commit]").append("[").append(NotEnoughUpdates.INSTANCE.manager.latestRepoCommit).append("]").append("\n"); + builder.append("[Loaded Items]").append("[").append(NotEnoughUpdates.INSTANCE.manager.getItemInformation().size()).append("]").append("\n"); + if (activeModCount <= 15) { + builder.append("# Mods Loaded").append("\n"); + for (ModContainer modContainer : Loader.instance().getActiveModList()) { + builder.append("[").append(modContainer.getName()).append("]") + .append("[").append(modContainer.getSource().getName()).append("]\n"); + } + builder.append("```"); + } else { + builder.append("```"); + } + } + try { + StringSelection clipboard = new StringSelection(builder.toString()); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "[" + EnumChatFormatting.RED + "NotEnoughUpdates" + EnumChatFormatting.GOLD + "]: " + EnumChatFormatting.GREEN + "Dev info copied to clipboard.")); + } catch (Exception ignored) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "[" + EnumChatFormatting.RED + "NotEnoughUpdates" + EnumChatFormatting.GOLD + "]: " + EnumChatFormatting.DARK_RED + "Could not copy to clipboard.")); + } + } + }); + + public SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Some parts of the profile viewer do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); + + } + if (NotEnoughUpdates.INSTANCE.config.apiKey.apiKey == null || NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.trim().isEmpty()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Can't view profile, apikey is not set. Run /api new and put the result in settings.")); + } else if (args.length == 0) { + NotEnoughUpdates.INSTANCE.profileViewer.getProfileByName(Minecraft.getMinecraft().thePlayer.getName(), profile -> { + if(profile == null) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Invalid player name/api key. Maybe api is down? Try /api new.")); + } else { + profile.resetCache(); + NotEnoughUpdates.INSTANCE.openGui = new GuiProfileViewer(profile); + } + }); + } else if (args.length > 1) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Too many arguments. Usage: /neuprofile [name]")); + } else { + NotEnoughUpdates.INSTANCE.profileViewer.getProfileByName(args[0], profile -> { + if(profile == null) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Invalid player name/api key. Maybe api is down? Try /api new.")); + } else { + profile.resetCache(); + NotEnoughUpdates.INSTANCE.openGui = new GuiProfileViewer(profile); + } + }); + } + } + }; + + + SimpleCommand joinDungeonCommand = new SimpleCommand("join", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/join " + StringUtils.join(args, " ")); + } else { + if(args.length != 1) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.RED+"Example Usage: /join f7, /join m6 or /join 7")); + } else { + String cataPrefix = "catacombs"; + if(args[0].startsWith("m")){ + cataPrefix = "master_catacombs"; + } + String cmd = "/joindungeon "+cataPrefix+" " + args[0].charAt(args[0].length()-1); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.YELLOW+"Running command: "+cmd)); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.YELLOW+"The dungeon should start soon. If it doesn't, make sure you have a party of 5 people")); + Minecraft.getMinecraft().thePlayer.sendChatMessage(cmd); + } + } + } + }); + + SimpleCommand viewProfileCommand = new SimpleCommand("neuprofile", viewProfileRunnable, new SimpleCommand.TabCompleteRunnable() { + @Override + public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + if(args.length != 1) return null; + + String lastArg = args[args.length-1]; + List playerMatches = new ArrayList<>(); + for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + String playerName = player.getName(); + if(playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + playerMatches.add(playerName); + } + } + return playerMatches; + } + }); + + SimpleCommand viewProfileShortCommand = new SimpleCommand("pv", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(!NotEnoughUpdates.INSTANCE.isOnSkyblock()) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pv " + StringUtils.join(args, " ")); + } else { + viewProfileRunnable.processCommand(sender, args); + } + } + }, new SimpleCommand.TabCompleteRunnable() { + @Override + public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length != 1) return null; + + String lastArg = args[args.length - 1]; + List playerMatches = new ArrayList<>(); + for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + String playerName = player.getName(); + if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + playerMatches.add(playerName); + } + } + return playerMatches; + } + }); + + SimpleCommand dhCommand = new SimpleCommand("dh", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub"); + } + }); + + private ScheduledExecutorService devES = Executors.newSingleThreadScheduledExecutor(); + private static final String[] devFailStrings = {"No.", "I said no.", "You aren't allowed to use this.", + "Are you sure you want to use this? Type 'Yes' in chat.", "Are you sure you want to use this? Type 'Yes' in chat.", + "Lmao you thought", "Ok please stop", "What do you want from me?", + "This command almost certainly does nothing useful for you", + "Ok, this is the last message, after this it will repeat", "No.", "I said no.", "Dammit. I thought that would work. Uhh...", + "\u00a7dFrom \u00a7c[ADMIN] Minikloon\u00a77: If you use that command again, I'll have to ban you", "", + "Ok, this is actually the last message, use the command again and you'll crash I promise"}; + private int devFailIndex = 0; + + private static final List devTestUsers = new ArrayList<>(Arrays.asList("moulberry", "lucycoconut", "ironm00n", "ariyio")); + SimpleCommand devTestCommand = new SimpleCommand("neudevtest", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(!devTestUsers.contains(Minecraft.getMinecraft().thePlayer.getName().toLowerCase())) { + if(devFailIndex >= devFailStrings.length) { + throw new Error("L") { + @Override + public void printStackTrace() { + throw new Error("L"); + } + }; + } + if(devFailIndex == devFailStrings.length-2) { + devFailIndex++; + + ChatComponentText component = new ChatComponentText("\u00a7cYou are permanently banned from this server!"); + component.appendText("\n"); + component.appendText("\n\u00a77Reason: \u00a7rI told you not to run the command - Moulberry"); + component.appendText("\n\u00a77Find out more: \u00a7b\u00a7nhttps://www.hypixel.net/appeal"); + component.appendText("\n"); + component.appendText("\n\u00a77Ban ID: \u00a7r#49871982"); + component.appendText("\n\u00a77Sharing your Ban ID may affect the processing of your appeal!"); + Minecraft.getMinecraft().getNetHandler().getNetworkManager().closeChannel(component); + return; + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+devFailStrings[devFailIndex++])); + return; + } + /*if(args.length == 1) { + DupePOC.doDupe(args[0]); + return; + }*/ + if(args.length == 1 && args[0].equalsIgnoreCase("positiontest")) { + NotEnoughUpdates.INSTANCE.openGui = new GuiPositionEditor(); + return; + } + + if(args.length == 2 && args[0].equalsIgnoreCase("pt")) { + EnumParticleTypes t = EnumParticleTypes.valueOf(args[1]); + FishingHelper.type = t; + return; + } + if(args.length == 1 && args[0].equalsIgnoreCase("dev")) { + NotEnoughUpdates.INSTANCE.config.hidden.dev = true; + return; + } + if(args.length == 1 && args[0].equalsIgnoreCase("saveconfig")) { + NotEnoughUpdates.INSTANCE.saveConfig(); + return; + } + if(args.length == 1 && args[0].equalsIgnoreCase("center")) { + double x = Math.floor(Minecraft.getMinecraft().thePlayer.posX) + 0.5f; + double z = Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + 0.5f; + Minecraft.getMinecraft().thePlayer.setPosition(x, Minecraft.getMinecraft().thePlayer.posY, z); + return; + } + if(args.length == 1 && args[0].equalsIgnoreCase("pansc")) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Taking panorama screenshot")); + + AtomicInteger perspective = new AtomicInteger(0); + FancyPortals.perspectiveId = 0; + + EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; + p.prevRotationYaw = p.rotationYaw = 0; + p.prevRotationPitch = p.rotationPitch = 90; + devES.schedule(new Runnable() { + @Override + public void run() { + Minecraft.getMinecraft().addScheduledTask(() -> { + ScreenShotHelper.saveScreenshot(new File("C:/Users/James/Desktop/"), "pansc-"+perspective.get()+".png", + Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, + Minecraft.getMinecraft().getFramebuffer()); + }); + if(perspective.incrementAndGet() >= 6) { + FancyPortals.perspectiveId = -1; + return; + } + devES.schedule(() -> { + FancyPortals.perspectiveId = perspective.get(); + if(FancyPortals.perspectiveId == 5) { + p.prevRotationYaw = p.rotationYaw = 0; + p.prevRotationPitch = p.rotationPitch = -90; + } else if(FancyPortals.perspectiveId >= 1 && FancyPortals.perspectiveId <= 4) { + float yaw = 90*FancyPortals.perspectiveId-180; + if(yaw > 180) yaw -= 360; + p.prevRotationYaw = p.rotationYaw = yaw; + p.prevRotationPitch = p.rotationPitch = 0; + } + devES.schedule(this, 3000L, TimeUnit.MILLISECONDS); + }, 100L, TimeUnit.MILLISECONDS); + } + }, 3000L, TimeUnit.MILLISECONDS); + + return; + } + + /* if(args.length == 1 && args[0].equalsIgnoreCase("update")) { + NEUEventListener.displayUpdateMessageIfOutOfDate(); + } */ + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Executing dubious code")); + /*Minecraft.getMinecraft().thePlayer.rotationYaw = 0; + Minecraft.getMinecraft().thePlayer.rotationPitch = 0; + Minecraft.getMinecraft().thePlayer.setPosition( + Math.floor(Minecraft.getMinecraft().thePlayer.posX) + Float.parseFloat(args[0]), + Minecraft.getMinecraft().thePlayer.posY, + Minecraft.getMinecraft().thePlayer.posZ);*/ + //Hot reload me yay! + } + }); + + SimpleCommand packDevCommand = new SimpleCommand("neupackdev", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(args.length == 1 && args[0].equalsIgnoreCase("getnpc")) { + double distSq = 25; + EntityPlayer closestNPC = null; + EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; + for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + if(player instanceof AbstractClientPlayer && p != player && player.getUniqueID().version() != 4) { + double dSq = player.getDistanceSq(p.posX, p.posY, p.posZ); + if(dSq < distSq) { + distSq = dSq; + closestNPC = player; + } + } + } + + if(closestNPC == null) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"No NPCs found within 5 blocks :(")); + } else { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Copied entity texture id to clipboard")); + MiscUtils.copyToClipboard(((AbstractClientPlayer)closestNPC).getLocationSkin().getResourcePath().replace("skins/", "")); + } + return; + } + NotEnoughUpdates.INSTANCE.packDevEnabled = !NotEnoughUpdates.INSTANCE.packDevEnabled; + if(NotEnoughUpdates.INSTANCE.packDevEnabled) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Enabled pack developer mode.")); + } else { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+"Disabled pack developer mode.")); + } + } + }); + + SimpleCommand dnCommand = new SimpleCommand("dn", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp dungeon_hub"); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA+"Warping to:"+EnumChatFormatting.YELLOW+" Deez Nuts lmao")); + } + }); + + SimpleCommand viewCataCommand = new SimpleCommand("cata", new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + GuiProfileViewer.currentPage = GuiProfileViewer.ProfileViewerPage.DUNG; + viewProfileRunnable.processCommand(sender, args); + } + }, new SimpleCommand.TabCompleteRunnable() { + @Override + public List tabComplete(ICommandSender sender, String[] args, BlockPos pos) { + if (args.length != 1) return null; + + String lastArg = args[args.length - 1]; + List playerMatches = new ArrayList<>(); + for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + String playerName = player.getName(); + if (playerName.toLowerCase().startsWith(lastArg.toLowerCase())) { + playerMatches.add(playerName); + } + } + return playerMatches; + } + }); + + SimpleCommand linksCommand = new SimpleCommand("neulinks", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + File repo = NotEnoughUpdates.INSTANCE.manager.repoLocation; + if(repo.exists()) { + File updateJson = new File(repo, "update.json"); + try { + JsonObject update = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(updateJson); + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + NotEnoughUpdates.INSTANCE.displayLinks(update); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + } catch (Exception ignored) { + } + } + } + }); + + SimpleCommand overlayPlacementsCommand = new SimpleCommand("neuoverlay", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + NotEnoughUpdates.INSTANCE.openGui = new NEUOverlayPlacements(); + } + }); + + SimpleCommand tutorialCommand = new SimpleCommand("neututorial", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + NotEnoughUpdates.INSTANCE.openGui = new NeuTutorial(); + } + }); + + + SimpleCommand neumapCommand = new SimpleCommand("neumap", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(NotEnoughUpdates.INSTANCE.colourMap == null) { + try(BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource( + new ResourceLocation("notenoughupdates:maps/F1Full.json")).getInputStream(), StandardCharsets.UTF_8))) { + JsonObject json = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, JsonObject.class); + + NotEnoughUpdates.INSTANCE.colourMap = new Color[128][128]; + for(int x=0; x<128; x++) { + for(int y=0; y<128; y++) { + NotEnoughUpdates.INSTANCE.colourMap[x][y] = new Color(0, 0, 0, 0); + } + } + for(Map.Entry entry : json.entrySet()) { + int x = Integer.parseInt(entry.getKey().split(":")[0]); + int y = Integer.parseInt(entry.getKey().split(":")[1]); + + NotEnoughUpdates.INSTANCE.colourMap[x][y] = new Color(entry.getValue().getAsInt(), true); + } + } catch(Exception ignored) { } + } + + if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { + NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(); + return; + } + + if(args.length == 1 && args[0].equals("reset")) { + NotEnoughUpdates.INSTANCE.colourMap = null; + return; + } + + if(args.length != 2) { + NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(); + return; + } + + if(args[0].equals("save")) { + ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItem(); + if(stack != null && stack.getItem() instanceof ItemMap) { + ItemMap map = (ItemMap) stack.getItem(); + MapData mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld); + + if (mapData == null) return; + + JsonObject json = new JsonObject(); + for (int i = 0; i < 16384; ++i) { + int x = i % 128; + int y = i / 128; + + int j = mapData.colors[i] & 255; + + Color c; + if (j / 4 == 0) { + c = new Color((i + i / 128 & 1) * 8 + 16 << 24, true); + } else { + c = new Color(MapColor.mapColorArray[j / 4].getMapColor(j & 3), true); + } + + json.addProperty(x+":"+y, c.getRGB()); + } + + try { + new File(NotEnoughUpdates.INSTANCE.manager.configLocation, "maps").mkdirs(); + NotEnoughUpdates.INSTANCE.manager.writeJson(json, new File(NotEnoughUpdates.INSTANCE.manager.configLocation, "maps/"+args[1]+".json")); + } catch(Exception e) { + e.printStackTrace(); + } + + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+ + "Saved to file.")); + } + + return; + } + + if(args[0].equals("load")) { + JsonObject json = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(new File(NotEnoughUpdates.INSTANCE.manager.configLocation, "maps/"+args[1]+".json")); + + NotEnoughUpdates.INSTANCE.colourMap = new Color[128][128]; + for(int x=0; x<128; x++) { + for(int y=0; y<128; y++) { + NotEnoughUpdates.INSTANCE.colourMap[x][y] = new Color(0, 0, 0, 0); + } + } + for(Map.Entry entry : json.entrySet()) { + int x = Integer.parseInt(entry.getKey().split(":")[0]); + int y = Integer.parseInt(entry.getKey().split(":")[1]); + + NotEnoughUpdates.INSTANCE.colourMap[x][y] = new Color(entry.getValue().getAsInt(), true); + } + + return; + } + + NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(); + } + }); + + SimpleCommand cosmeticsCommand = new SimpleCommand("neucosmetics", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "NEU cosmetics do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); + + } + + NotEnoughUpdates.INSTANCE.openGui = new GuiCosmetics(); + } + }); + + SimpleCommand.ProcessCommandRunnable customizeRunnable = new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); + + if(held == null) { + sender.addChatMessage(new ChatComponentText("\u00a7cYou can't customize your hand...")); + return; + } + + String heldUUID = NotEnoughUpdates.INSTANCE.manager.getUUIDForItem(held); + + if(heldUUID == null) { + sender.addChatMessage(new ChatComponentText("\u00a7cHeld item does not have UUID, cannot be customized")); + return; + } + + NotEnoughUpdates.INSTANCE.openGui = new GuiItemCustomize(held, heldUUID); + } + }; + + SimpleCommand customizeCommand = new SimpleCommand("neucustomize", customizeRunnable); + SimpleCommand customizeCommand2 = new SimpleCommand("neurename", customizeRunnable); + + SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(args.length > 0) { + NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config, StringUtils.join(args, " "))); + } else { + NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor); + } + } + }; + + SimpleCommand settingsCommand = new SimpleCommand("neu", settingsRunnable); + SimpleCommand settingsCommand2 = new SimpleCommand("neusettings", settingsRunnable); + SimpleCommand settingsCommand3 = new SimpleCommand("neuconfig", settingsRunnable); + + SimpleCommand calendarCommand = new SimpleCommand("neucalendar", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + Minecraft.getMinecraft().thePlayer.closeScreen(); + CalendarOverlay.setEnabled(true); + NotEnoughUpdates.INSTANCE.sendChatMessage("/calendar"); + } + }); + + SimpleCommand neuAhCommand = new SimpleCommand("neuah", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ + "You must be on Skyblock to use this feature.")); + } else if(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey == null || NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.trim().isEmpty()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ + "Can't open NeuAH, apikey is not set. Run /api new and put the result in settings.")); + } else { + NotEnoughUpdates.INSTANCE.openGui = new CustomAHGui(); + NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.lastOpen = System.currentTimeMillis(); + NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.clearSearch(); + NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.updateSearch(); + + if(args.length > 0) NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.setSearch(StringUtils.join(args, " ")); + } + } + }); +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index a2f78e22..bf305b51 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -283,6 +283,7 @@ public class GuiProfileViewer extends GuiScreen { //This is just here to inform the player what to do //like typing /api new or telling them to go find a psychotherapist long timeDiff = System.currentTimeMillis() - startTime; + if(timeDiff > 20000){ Utils.drawStringCentered(EnumChatFormatting.YELLOW+"Its taking a while...", Minecraft.getMinecraft().fontRendererObj, guiLeft+sizeX/2f, guiTop+111, true, 0); @@ -307,6 +308,30 @@ public class GuiProfileViewer extends GuiScreen { if(timeDiff > 600000){ Utils.drawStringCentered(EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"Maniac", Minecraft.getMinecraft().fontRendererObj, guiLeft+sizeX/2f, guiTop+171, true, 0); + if(timeDiff > 1200000){ + Utils.drawStringCentered(EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"You're a menace to society", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+181, true, 0); + if(timeDiff > 1800000){ + Utils.drawStringCentered(EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"You dont know whats gonna happen to you", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+191, true, 0); + if(timeDiff > 3000000){ + Utils.drawStringCentered(EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"You really want this?", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+91, true, 0); + if(timeDiff > 3300000){ + Utils.drawStringCentered(EnumChatFormatting.DARK_RED+""+EnumChatFormatting.BOLD+"OW LORD FORGIVE ME FOR THIS", Minecraft.getMinecraft().fontRendererObj, + guiLeft+sizeX/2f, guiTop+71, true, 0); + if(timeDiff > 3600000){ + throw new Error("Go do something productive") { + @Override + public void printStackTrace() { + throw new Error("Go do something productive"); + } + }; + } + } + } + } + } } } } -- cgit From aea2087a9cc6ec153d22e5064ee49f264aff4d75 Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Sun, 3 Oct 2021 21:13:15 -0230 Subject: Updated /neustats to have a dump subcommand. Moved the stats command to its own class. Added HastebinUploader and DiscordMarkdownBuilder Added ClientCommandBase --- .../commands/ClientCommandBase.java | 28 ++++ .../notenoughupdates/commands/Commands.java | 77 +---------- .../notenoughupdates/commands/StatsCommand.java | 146 +++++++++++++++++++++ .../util/DiscordMarkdownBuilder.java | 26 ++++ .../notenoughupdates/util/HastebinUploader.java | 59 +++++++++ 5 files changed, 260 insertions(+), 76 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/util/DiscordMarkdownBuilder.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/util/HastebinUploader.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java new file mode 100644 index 00000000..47174f32 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/ClientCommandBase.java @@ -0,0 +1,28 @@ +package io.github.moulberry.notenoughupdates.commands; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; + +public abstract class ClientCommandBase extends CommandBase { + + private final String name; + + protected ClientCommandBase(String name) { + this.name = name; + } + + @Override + public String getCommandName() { + return name; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/"+name; + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java index a63f3fde..9fbe27dd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java @@ -91,7 +91,7 @@ public class Commands { ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); - ClientCommandHandler.instance.registerCommand(pcStatsCommand); + ClientCommandHandler.instance.registerCommand(new StatsCommand()); ClientCommandHandler.instance.registerCommand(neumapCommand); ClientCommandHandler.instance.registerCommand(settingsCommand); ClientCommandHandler.instance.registerCommand(settingsCommand2); @@ -597,81 +597,6 @@ public class Commands { } }); - - SimpleCommand pcStatsCommand = new SimpleCommand("neustats", new SimpleCommand.ProcessCommandRunnable() { - public void processCommand(ICommandSender sender, String[] args) { - Minecraft mc = Minecraft.getMinecraft(); - StringBuilder builder = new StringBuilder(); - - if (args.length > 0 && args[0].toLowerCase().equals("modlist")){ - builder.append("```md\n"); - builder.append("# Mods Loaded").append("\n"); - for (ModContainer modContainer : Loader.instance().getActiveModList()) { - builder.append("[").append(modContainer.getName()).append("]") - .append("[").append(modContainer.getSource().getName()).append("]\n"); - } - builder.append("```"); - } else { - long memorySize = -1; - try { - memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); - } catch(Exception e){} - long maxMemory = Runtime.getRuntime().maxMemory(); - long totalMemory = Runtime.getRuntime().totalMemory(); - long freeMemory = Runtime.getRuntime().freeMemory(); - long currentMemory = totalMemory - freeMemory; - int modCount = Loader.instance().getModList().size(); - int activeModCount = Loader.instance().getActiveModList().size(); - - builder.append("```md\n"); - builder.append("# System Stats").append("\n"); - builder.append("[OS]").append("[").append(System.getProperty("os.name")).append("]").append("\n"); - builder.append("[CPU]").append("[").append(OpenGlHelper.getCpu()).append("]").append("\n"); - builder.append("[Display]").append("[").append(String.format("%dx%d (%s)", Display.getWidth(), Display.getHeight(), GL11.glGetString(GL11.GL_VENDOR))).append("]").append("\n"); - builder.append("[GPU]").append("[").append(GL11.glGetString(GL11.GL_RENDERER)).append("]").append("\n"); - builder.append("[GPU Driver]").append("[").append(GL11.glGetString(GL11.GL_VERSION)).append("]").append("\n"); - if(memorySize > 0) { - builder.append("[Maximum Memory]").append("[").append(memorySize / 1024L / 1024L).append("MB]").append("\n"); - } - builder.append("[Shaders]").append("[").append((""+OpenGlHelper.areShadersSupported()).toUpperCase()).append("]").append("\n"); - builder.append("[Framebuffers]").append("[").append((""+OpenGlHelper.isFramebufferEnabled()).toUpperCase()).append("]").append("\n"); - builder.append("# Java Stats").append("\n"); - builder.append("[Java]").append("[").append(String.format("%s %dbit", System.getProperty("java.version"), mc.isJava64bit() ? 64 : 32)).append("]").append("\n"); - builder.append("[Memory]").append("[").append(String.format("% 2d%% %03d/%03dMB", currentMemory * 100L / maxMemory, currentMemory / 1024L / 1024L, maxMemory / 1024L / 1024L)).append("]").append("\n"); - builder.append("[Memory Allocated]").append("[").append(String.format("% 2d%% %03dMB", totalMemory * 100L / maxMemory, totalMemory / 1024L / 1024L)).append("]").append("\n"); - builder.append("# Game Stats").append("\n"); - builder.append("[Current FPS]").append("[").append(Minecraft.getDebugFPS()).append("]").append("\n"); - builder.append("[Loaded Mods]").append("[").append(activeModCount).append("/").append(modCount).append("]").append("\n"); - builder.append("[Forge]").append("[").append(ForgeVersion.getVersion()).append("]").append("\n"); - builder.append("# Neu Settings").append("\n"); - builder.append("[API Key]").append("[").append(!NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.isEmpty()).append("]").append("\n"); - builder.append("[On Skyblock]").append("[").append(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()).append("]").append("\n"); - builder.append("[Mod Version]").append("[").append(Loader.instance().getIndexedModList().get(NotEnoughUpdates.INSTANCE.MODID).getSource().getName()).append("]").append("\n"); - builder.append("[SB Profile]").append("[").append(SBInfo.getInstance().currentProfile).append("]").append("\n"); - builder.append("# Repo Stats").append("\n"); - builder.append("[Last Commit]").append("[").append(NotEnoughUpdates.INSTANCE.manager.latestRepoCommit).append("]").append("\n"); - builder.append("[Loaded Items]").append("[").append(NotEnoughUpdates.INSTANCE.manager.getItemInformation().size()).append("]").append("\n"); - if (activeModCount <= 15) { - builder.append("# Mods Loaded").append("\n"); - for (ModContainer modContainer : Loader.instance().getActiveModList()) { - builder.append("[").append(modContainer.getName()).append("]") - .append("[").append(modContainer.getSource().getName()).append("]\n"); - } - builder.append("```"); - } else { - builder.append("```"); - } - } - try { - StringSelection clipboard = new StringSelection(builder.toString()); - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "[" + EnumChatFormatting.RED + "NotEnoughUpdates" + EnumChatFormatting.GOLD + "]: " + EnumChatFormatting.GREEN + "Dev info copied to clipboard.")); - } catch (Exception ignored) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "[" + EnumChatFormatting.RED + "NotEnoughUpdates" + EnumChatFormatting.GOLD + "]: " + EnumChatFormatting.DARK_RED + "Could not copy to clipboard.")); - } - } - }); - public SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { if(!OpenGlHelper.isFramebufferEnabled()) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java new file mode 100644 index 00000000..b61c58ed --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java @@ -0,0 +1,146 @@ +package io.github.moulberry.notenoughupdates.commands; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.DiscordMarkdownBuilder; +import io.github.moulberry.notenoughupdates.util.HastebinUploader; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.ForgeVersion; +import net.minecraftforge.fml.common.Loader; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +import javax.management.JMX; +import javax.management.MBeanServer; +import javax.management.ObjectName; +import java.awt.*; +import java.awt.datatransfer.StringSelection; +import java.lang.management.ManagementFactory; +import java.util.List; +import java.util.Locale; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class StatsCommand extends ClientCommandBase { + + private final ExecutorService threadPool = Executors.newFixedThreadPool(1); + + public StatsCommand() { + super("neustats"); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + if (args.length > 0){ + switch (args[0].toLowerCase(Locale.ROOT)) { + case "modlist": + clipboardAndSendMessage(createModList(new DiscordMarkdownBuilder()).toString()); + break; + case "dump": + modPrefixedMessage(EnumChatFormatting.GREEN + "This will upload a dump of the java classes your game has loaded how big they are and how many there are. This can take a few seconds as it is uploading to HasteBin."); + threadPool.submit(() -> { + try { + final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + final ObjectName objectName = ObjectName.getInstance("com.sun.management:type=DiagnosticCommand"); + final DiagnosticCommandMXBean proxy = JMX.newMXBeanProxy(server, objectName, DiagnosticCommandMXBean.class); + clipboardAndSendMessage(HastebinUploader.upload(proxy.gcClassHistogram(new String[0]).replace("[", "[]"), HastebinUploader.Mode.NORMAL)); + }catch (Exception e){ + clipboardAndSendMessage(null); + } + }); + break; + } + } else { + clipboardAndSendMessage(createStats()); + } + + } + + @Override + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, "modlist", "dump") : null; + } + + public interface DiagnosticCommandMXBean { + String gcClassHistogram(String[] array); + } + + private static void clipboardAndSendMessage(String data) { + if (data == null) { + modPrefixedMessage(EnumChatFormatting.DARK_RED + "Error occurred trying to perform command."); + return; + } + try { + StringSelection clipboard = new StringSelection(data); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard); + modPrefixedMessage(EnumChatFormatting.GREEN + "Dev info copied to clipboard."); + } catch (Exception ignored) { + modPrefixedMessage(EnumChatFormatting.DARK_RED + "Could not copy to clipboard."); + } + } + + private static void modPrefixedMessage(String message) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GOLD + "[" + EnumChatFormatting.RED + "NotEnoughUpdates" + EnumChatFormatting.GOLD + "]: " + message)); + + } + + private static String createStats() { + DiscordMarkdownBuilder builder = new DiscordMarkdownBuilder(); + long maxMemory = Runtime.getRuntime().maxMemory(); + long totalMemory = Runtime.getRuntime().totalMemory(); + long freeMemory = Runtime.getRuntime().freeMemory(); + long currentMemory = totalMemory - freeMemory; + int activeModCount = Loader.instance().getActiveModList().size(); + + builder.category("System Stats"); + builder.append("OS", System.getProperty("os.name")); + builder.append("CPU", OpenGlHelper.getCpu()); + builder.append("Display", String.format("%dx%d (%s)", Display.getWidth(), Display.getHeight(), GL11.glGetString(GL11.GL_VENDOR))); + builder.append("GPU", GL11.glGetString(GL11.GL_RENDERER)); + builder.append("GPU Driver", GL11.glGetString(GL11.GL_VERSION)); + if(getMemorySize() > 0) builder.append("Maximum Memory", (getMemorySize() / 1024L / 1024L) + "MB"); + builder.append("Shaders", (""+OpenGlHelper.isFramebufferEnabled()).toUpperCase()); + builder.category("Java Stats"); + builder.append("Java", String.format("%s %dbit", System.getProperty("java.version"), Minecraft.getMinecraft().isJava64bit() ? 64 : 32)); + builder.append("Memory", String.format("% 2d%% %03d/%03dMB", currentMemory * 100L / maxMemory, currentMemory / 1024L / 1024L, maxMemory / 1024L / 1024L)); + builder.append("Memory Allocated", String.format("% 2d%% %03dMB", totalMemory * 100L / maxMemory, totalMemory / 1024L / 1024L)); + builder.category("Game Stats"); + builder.append("FPS", String.valueOf(Minecraft.getDebugFPS())); + builder.append("Loaded Mods", String.valueOf(activeModCount)); + builder.append("Forge", ForgeVersion.getVersion()); + builder.category("Neu Settings"); + builder.append("API Key", NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.isEmpty() ? "FALSE" : "TRUE"); + builder.append("On Skyblock", NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() ? "TRUE" : "FALSE"); + builder.append("Mod Version", Loader.instance().getIndexedModList().get(NotEnoughUpdates.MODID).getSource().getName()); + builder.append("SB Profile", SBInfo.getInstance().currentProfile); + builder.category("Repo Stats"); + builder.append("Last Commit", NotEnoughUpdates.INSTANCE.manager.latestRepoCommit); + builder.append("Loaded Items", String.valueOf(NotEnoughUpdates.INSTANCE.manager.getItemInformation().size())); + if (activeModCount <= 15) createModList(builder); + + return builder.toString(); + } + + private static DiscordMarkdownBuilder createModList(DiscordMarkdownBuilder builder) { + builder.category("Mods Loaded"); + Loader.instance().getActiveModList().forEach(mod -> builder.append(mod.getName(), mod.getSource().getName())); + return builder; + } + + private static long getMemorySize(){ + try { + return ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); + } catch(Exception e){ + try { + return ((com.sun.management.UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); + } catch(Exception ignored){/*IGNORE*/} + } + return -1; + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/DiscordMarkdownBuilder.java b/src/main/java/io/github/moulberry/notenoughupdates/util/DiscordMarkdownBuilder.java new file mode 100644 index 00000000..ccffa313 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/DiscordMarkdownBuilder.java @@ -0,0 +1,26 @@ +package io.github.moulberry.notenoughupdates.util; + +public class DiscordMarkdownBuilder { + + private final StringBuilder builder; + + public DiscordMarkdownBuilder() { + this.builder = new StringBuilder(); + this.builder.append("```md\n"); + } + + public DiscordMarkdownBuilder category(String name) { + builder.append("# ").append(name).append("\n"); + return this; + } + + public DiscordMarkdownBuilder append(String key, Object value) { + builder.append("[").append(key).append("]").append("[").append(value).append("]").append("\n"); + return this; + } + + @Override + public String toString() { + return builder.append("```").toString(); + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HastebinUploader.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HastebinUploader.java new file mode 100644 index 00000000..70753e10 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/HastebinUploader.java @@ -0,0 +1,59 @@ +package io.github.moulberry.notenoughupdates.util; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import org.apache.commons.io.Charsets; +import org.apache.commons.io.IOUtils; + +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; + +/** + * @author ThatGravyBoat + */ +public class HastebinUploader { + + private static final String UPLOAD_URL = "https://hst.sh/documents"; + private static final String RETURN_URL = "https://hst.sh/"; + private static final String RAW_RETURN_URL = "https://hst.sh/raw/"; + + private static final Gson GSON = new Gson(); + + /** + * @param data the data you want to upload + * @param mode the mode in which the thing should return NORMAL = returns the url, RAW = returns the raw url, NO_URL = returns the slug. + * @return The url if mode is NORMAL OR RAW, the slug if mode is NO_URL, and null if an error occurred. + */ + public static String upload(String data, Mode mode){ + try { + byte[] bytes = data.getBytes(StandardCharsets.UTF_8); + HttpURLConnection connection = (HttpURLConnection)new URL(UPLOAD_URL).openConnection(); + connection.setRequestMethod("POST"); + connection.addRequestProperty("User-Agent", "Minecraft Mod ("+ NotEnoughUpdates.MODID +"/"+NotEnoughUpdates.VERSION+")"); + connection.addRequestProperty("Content-Length", String.valueOf(bytes.length)); + connection.setReadTimeout(15000); + connection.setConnectTimeout(15000); + connection.setDoOutput(true); + connection.getOutputStream().write(bytes); + final JsonObject json = GSON.fromJson(IOUtils.toString(connection.getInputStream(), Charsets.UTF_8), JsonObject.class); + if (!json.has("key")) return null; + final String key = json.get("key").getAsString(); + switch (mode) { + case RAW: return RAW_RETURN_URL + key; + case NORMAL: return RETURN_URL + key; + case NO_URL: return key; + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public enum Mode { + NORMAL, + RAW, + NO_URL + } +} -- cgit From bc8ca92f9f91995aa9141b843488d07202ed900c Mon Sep 17 00:00:00 2001 From: Jaex Date: Sun, 10 Oct 2021 17:48:36 +0300 Subject: Add ShareX cape --- .../notenoughupdates/cosmetics/CapeManager.java | 2 ++ .../resources/assets/notenoughupdates/capes/sharex.png | Bin 0 -> 40721 bytes .../assets/notenoughupdates/capes/sharex_preview.png | Bin 0 -> 36610 bytes .../assets/notenoughupdates/capes/sharex_white.png | Bin 0 -> 27251 bytes .../notenoughupdates/capes/sharex_white_preview.png | Bin 0 -> 21698 bytes 5 files changed, 2 insertions(+) create mode 100644 src/main/resources/assets/notenoughupdates/capes/sharex.png create mode 100644 src/main/resources/assets/notenoughupdates/capes/sharex_preview.png create mode 100644 src/main/resources/assets/notenoughupdates/capes/sharex_white.png create mode 100644 src/main/resources/assets/notenoughupdates/capes/sharex_white_preview.png diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 75a63644..2f50be4e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -104,6 +104,8 @@ public class CapeManager { new CapeData("packshq", true, false), new CapeData("skytils", true, false), new CapeData("sbp", true, false), + new CapeData("sharex", true, false), + new CapeData("sharex_white", true, false), //Special Other new CapeData("contrib", true, false), diff --git a/src/main/resources/assets/notenoughupdates/capes/sharex.png b/src/main/resources/assets/notenoughupdates/capes/sharex.png new file mode 100644 index 00000000..0a18410d Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/capes/sharex.png differ diff --git a/src/main/resources/assets/notenoughupdates/capes/sharex_preview.png b/src/main/resources/assets/notenoughupdates/capes/sharex_preview.png new file mode 100644 index 00000000..77039e96 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/capes/sharex_preview.png differ diff --git a/src/main/resources/assets/notenoughupdates/capes/sharex_white.png b/src/main/resources/assets/notenoughupdates/capes/sharex_white.png new file mode 100644 index 00000000..c7457897 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/capes/sharex_white.png differ diff --git a/src/main/resources/assets/notenoughupdates/capes/sharex_white_preview.png b/src/main/resources/assets/notenoughupdates/capes/sharex_white_preview.png new file mode 100644 index 00000000..6ed14bd8 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/capes/sharex_white_preview.png differ -- cgit