From 7c00af18febf6c0b833c7633b4fb60a9a1bb93af Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 16 Oct 2021 15:50:41 -0400 Subject: Code Clean Up (#2) * intellij code clean up * optimize imports * format * intellij suggestions * fix empty catch issues --- src/main/java/NotSkyblockAddonsInstallerFrame.java | 25 +- .../moulberry/notenoughupdates/CustomItems.java | 38 +- .../notenoughupdates/ItemPriceInformation.java | 169 +- .../github/moulberry/notenoughupdates/NEUApi.java | 3 +- .../notenoughupdates/NEUEventListener.java | 1117 +++++------ .../moulberry/notenoughupdates/NEUManager.java | 541 ++--- .../moulberry/notenoughupdates/NEUOverlay.java | 1136 +++++------ .../notenoughupdates/NotEnoughUpdates.java | 141 +- .../notenoughupdates/auction/APIManager.java | 398 ++-- .../notenoughupdates/auction/CustomAH.java | 82 +- .../notenoughupdates/auction/CustomAHGui.java | 1 - .../collectionlog/GuiCollectionLog.java | 50 +- .../commands/ClientCommandBase.java | 2 +- .../notenoughupdates/commands/Commands.java | 427 ++-- .../notenoughupdates/commands/SimpleCommand.java | 7 +- .../notenoughupdates/commands/StatsCommand.java | 16 +- .../notenoughupdates/core/BackgroundBlur.java | 95 +- .../notenoughupdates/core/ChromaColour.java | 19 +- .../notenoughupdates/core/GlScissorStack.java | 20 +- .../notenoughupdates/core/GuiElement.java | 4 +- .../notenoughupdates/core/GuiElementBoolean.java | 48 +- .../notenoughupdates/core/GuiElementColour.java | 245 ++- .../notenoughupdates/core/GuiElementTextField.java | 317 +-- .../notenoughupdates/core/config/Config.java | 3 +- .../core/config/GuiPositionEditor.java | 18 +- .../core/config/KeybindHelper.java | 25 +- .../notenoughupdates/core/config/Position.java | 108 +- .../notenoughupdates/core/config/PositionNew.java | 36 +- .../core/config/annotations/Category.java | 1 + .../config/annotations/ConfigEditorButton.java | 1 + .../config/annotations/ConfigEditorColour.java | 1 - .../config/annotations/ConfigEditorDropdown.java | 2 +- .../config/annotations/ConfigEditorSlider.java | 2 +- .../core/config/annotations/ConfigEditorText.java | 1 - .../core/config/annotations/ConfigOption.java | 3 +- .../core/config/gui/GuiOptionEditor.java | 22 +- .../core/config/gui/GuiOptionEditorAccordion.java | 26 +- .../core/config/gui/GuiOptionEditorBoolean.java | 10 +- .../core/config/gui/GuiOptionEditorButton.java | 21 +- .../core/config/gui/GuiOptionEditorColour.java | 30 +- .../config/gui/GuiOptionEditorDraggableList.java | 152 +- .../core/config/gui/GuiOptionEditorDropdown.java | 85 +- .../core/config/gui/GuiOptionEditorKeybind.java | 33 +- .../core/config/gui/GuiOptionEditorSlider.java | 60 +- .../core/config/gui/GuiOptionEditorText.java | 35 +- .../core/config/gui/GuiPositionEditor.java | 56 +- .../core/config/struct/ConfigProcessor.java | 63 +- .../core/util/GuiElementSlider.java | 58 +- .../notenoughupdates/core/util/MiscUtils.java | 31 +- .../notenoughupdates/core/util/Splitters.java | 1 - .../notenoughupdates/core/util/StringUtils.java | 10 +- .../notenoughupdates/core/util/lerp/LerpUtils.java | 10 +- .../core/util/lerp/LerpingFloat.java | 18 +- .../core/util/lerp/LerpingInteger.java | 16 +- .../core/util/render/RenderUtils.java | 146 +- .../core/util/render/TextRenderUtils.java | 32 +- .../notenoughupdates/cosmetics/CapeManager.java | 130 +- .../notenoughupdates/cosmetics/CapeNode.java | 112 +- .../notenoughupdates/cosmetics/GuiCosmetics.java | 282 ++- .../notenoughupdates/cosmetics/NEUCape.java | 356 ++-- .../notenoughupdates/cosmetics/ShaderManager.java | 53 +- .../notenoughupdates/dungeons/DungeonBlocks.java | 59 +- .../notenoughupdates/dungeons/DungeonMap.java | 747 +++---- .../notenoughupdates/dungeons/DungeonWin.java | 277 +-- .../dungeons/GuiDungeonMapEditor.java | 480 ++--- .../notenoughupdates/gamemodes/GuiGamemodes.java | 208 +- .../notenoughupdates/gamemodes/SBGamemodes.java | 163 +- .../infopanes/CollectionLogInfoPane.java | 208 +- .../notenoughupdates/infopanes/DevInfoPane.java | 322 +-- .../infopanes/FlipperInfoPane.java | 41 +- .../notenoughupdates/infopanes/HTMLInfoPane.java | 165 +- .../notenoughupdates/infopanes/InfoPane.java | 15 +- .../infopanes/ScrollableInfoPane.java | 10 +- .../notenoughupdates/infopanes/TextInfoPane.java | 26 +- .../notenoughupdates/itemeditor/GuiElement.java | 6 + .../itemeditor/GuiElementButton.java | 8 +- .../itemeditor/GuiElementText.java | 4 +- .../itemeditor/GuiElementTextField.java | 288 ++- .../notenoughupdates/itemeditor/NEUItemEditor.java | 173 +- .../notenoughupdates/mbgui/MBAnchorPoint.java | 6 +- .../notenoughupdates/mbgui/MBGuiElement.java | 5 + .../notenoughupdates/mbgui/MBGuiGroup.java | 19 +- .../notenoughupdates/mbgui/MBGuiGroupAligned.java | 24 +- .../notenoughupdates/mbgui/MBGuiGroupFloating.java | 50 +- .../miscfeatures/AuctionBINWarning.java | 102 +- .../miscfeatures/AuctionSortModeWarning.java | 26 +- .../miscfeatures/BetterContainers.java | 27 +- .../miscfeatures/CollectionLogManager.java | 20 +- .../miscfeatures/CrystalMetalDetectorSolver.java | 4 +- .../miscfeatures/CrystalOverlay.java | 161 +- .../miscfeatures/CustomItemEffects.java | 457 +++-- .../miscfeatures/CustomSkulls.java | 91 +- .../miscfeatures/DamageCommas.java | 80 +- .../miscfeatures/DwarvenMinesTextures.java | 232 ++- .../miscfeatures/DwarvenMinesWaypoints.java | 144 +- .../miscfeatures/EnchantingSolvers.java | 230 +-- .../notenoughupdates/miscfeatures/FairySouls.java | 114 +- .../miscfeatures/FancyPortals.java | 110 +- .../miscfeatures/FishingHelper.java | 228 +-- .../miscfeatures/ItemCooldowns.java | 100 +- .../miscfeatures/ItemCustomizeManager.java | 49 +- .../miscfeatures/ItemRarityHalo.java | 76 +- .../notenoughupdates/miscfeatures/MiningStuff.java | 98 +- .../miscfeatures/NPCRetexturing.java | 28 +- .../miscfeatures/NullzeeSphere.java | 98 +- .../miscfeatures/PetInfoOverlay.java | 487 ++--- .../notenoughupdates/miscfeatures/SlotLocking.java | 261 ++- .../miscfeatures/StorageManager.java | 285 +-- .../miscfeatures/StreamerMode.java | 13 +- .../notenoughupdates/miscfeatures/SunTzu.java | 25 +- .../miscgui/AccessoryBagOverlay.java | 549 +++--- .../notenoughupdates/miscgui/CalendarOverlay.java | 761 ++++---- .../notenoughupdates/miscgui/GuiCustomEnchant.java | 961 +++++---- .../notenoughupdates/miscgui/GuiEnchantColour.java | 243 ++- .../miscgui/GuiInvButtonEditor.java | 399 ++-- .../notenoughupdates/miscgui/GuiItemCustomize.java | 5 +- .../notenoughupdates/miscgui/GuiItemRecipe.java | 15 +- .../miscgui/InventoryStorageSelector.java | 249 +-- .../miscgui/NEUOverlayPlacements.java | 103 +- .../notenoughupdates/miscgui/StorageOverlay.java | 1220 ++++++------ .../notenoughupdates/miscgui/TradeWindow.java | 615 +++--- .../miscgui/tutorials/NeuTutorial.java | 152 +- .../miscgui/tutorials/TutorialBase.java | 97 +- .../mixins/MixinAbstractClientPlayer.java | 20 +- .../notenoughupdates/mixins/MixinContainer.java | 6 +- .../mixins/MixinEffectRenderer.java | 6 +- .../notenoughupdates/mixins/MixinEntityPlayer.java | 8 +- .../mixins/MixinEntityPlayerSP.java | 8 +- .../mixins/MixinEntityRenderer.java | 74 +- .../notenoughupdates/mixins/MixinGuiChest.java | 14 +- .../notenoughupdates/mixins/MixinGuiContainer.java | 116 +- .../notenoughupdates/mixins/MixinGuiIngame.java | 17 +- .../notenoughupdates/mixins/MixinGuiInventory.java | 4 +- .../notenoughupdates/mixins/MixinGuiScreen.java | 3 +- .../mixins/MixinInventoryEffectRenderer.java | 6 +- .../mixins/MixinInventoryPlayer.java | 9 +- .../mixins/MixinItemCameraTransforms.java | 2 +- .../notenoughupdates/mixins/MixinItemRenderer.java | 11 +- .../notenoughupdates/mixins/MixinItemStack.java | 23 +- .../mixins/MixinLayerArmorBase.java | 25 +- .../mixins/MixinLayerCustomHead.java | 12 +- .../mixins/MixinLoadingScreenRenderer.java | 6 +- .../notenoughupdates/mixins/MixinMinecraft.java | 29 +- .../notenoughupdates/mixins/MixinMouseHelper.java | 2 +- .../mixins/MixinNetHandlerPlayClient.java | 35 +- .../mixins/MixinPlayerControllerMP.java | 7 +- .../notenoughupdates/mixins/MixinRender.java | 8 +- .../notenoughupdates/mixins/MixinRenderFish.java | 53 +- .../notenoughupdates/mixins/MixinRenderGlobal.java | 44 +- .../notenoughupdates/mixins/MixinRenderItem.java | 92 +- .../notenoughupdates/mixins/MixinRenderList.java | 6 +- .../mixins/MixinRendererLivingEntity.java | 11 +- .../mixins/MixinTextureManager.java | 4 +- .../mixins/MixinTileEntitySkullRenderer.java | 5 +- .../mixins/MixinTileEntitySpecialRenderer.java | 10 +- .../mixins/MixinVboRenderList.java | 4 +- .../notenoughupdates/mixins/MixinWorld.java | 15 +- .../notenoughupdates/mixins/MixinWorldClient.java | 4 +- .../notenoughupdates/options/NEUConfig.java | 216 +- .../notenoughupdates/options/NEUConfigEditor.java | 526 ++--- .../options/seperateSections/Dungeons.java | 3 - .../options/seperateSections/Enchanting.java | 4 +- .../options/seperateSections/ItemOverlays.java | 6 +- .../options/seperateSections/Mining.java | 4 - .../options/seperateSections/Misc.java | 7 - .../options/seperateSections/MiscOverlays.java | 18 +- .../options/seperateSections/Notifications.java | 2 +- .../options/seperateSections/StorageGUI.java | 1 - .../options/seperateSections/Toolbar.java | 2 - .../options/seperateSections/TooltipTweaks.java | 2 - .../options/seperateSections/TradeMenu.java | 1 - .../overlays/AuctionSearchOverlay.java | 228 ++- .../overlays/BonemerangOverlay.java | 29 +- .../notenoughupdates/overlays/CraftingOverlay.java | 1 - .../notenoughupdates/overlays/FarmingOverlay.java | 128 +- .../notenoughupdates/overlays/FuelBar.java | 105 +- .../notenoughupdates/overlays/MiningOverlay.java | 176 +- .../notenoughupdates/overlays/OverlayManager.java | 26 +- .../overlays/RancherBootOverlay.java | 78 +- .../notenoughupdates/overlays/TextOverlay.java | 62 +- .../notenoughupdates/overlays/TimersOverlay.java | 201 +- .../profileviewer/GuiProfileViewer.java | 2059 ++++++++++---------- .../notenoughupdates/profileviewer/Panorama.java | 65 +- .../profileviewer/PlayerStats.java | 256 +-- .../profileviewer/ProfileViewer.java | 550 +++--- .../moulberry/notenoughupdates/util/Constants.java | 3 +- .../notenoughupdates/util/GuiTextures.java | 1 - .../notenoughupdates/util/HastebinUploader.java | 15 +- .../notenoughupdates/util/HypixelApi.java | 40 +- .../notenoughupdates/util/LerpingFloat.java | 18 +- .../notenoughupdates/util/NEUResourceManager.java | 3 +- .../notenoughupdates/util/ProfileApiSyncer.java | 24 +- .../util/RequestFocusListener.java | 49 +- .../util/ReverseWorldRenderer.java | 37 +- .../moulberry/notenoughupdates/util/SBInfo.java | 55 +- .../notenoughupdates/util/SpecialColour.java | 19 +- .../moulberry/notenoughupdates/util/TexLoc.java | 28 +- .../moulberry/notenoughupdates/util/Utils.java | 570 +++--- .../notenoughupdates/util/XPInformation.java | 88 +- 199 files changed, 12741 insertions(+), 12833 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/NotSkyblockAddonsInstallerFrame.java b/src/main/java/NotSkyblockAddonsInstallerFrame.java index 7c5a1638..12431ae0 100644 --- a/src/main/java/NotSkyblockAddonsInstallerFrame.java +++ b/src/main/java/NotSkyblockAddonsInstallerFrame.java @@ -122,17 +122,17 @@ public class NotSkyblockAddonsInstallerFrame extends JFrame implements ActionLis private JLabel getPictureLabel() { if (logo == null) { try { - h = w/2; + h = w / 2; margin = 5; BufferedImage myPicture = ImageIO.read(getClass().getClassLoader().getResourceAsStream("assets/notenoughupdates/logo.png")); - Image scaled = myPicture.getScaledInstance(w-margin*2, h-margin, Image.SCALE_SMOOTH); + Image scaled = myPicture.getScaledInstance(w - margin * 2, h - margin, Image.SCALE_SMOOTH); logo = new JLabel(new ImageIcon(scaled)); logo.setName("Logo"); - logo.setBounds(x+margin, y+margin, w-margin*2, h-margin); + logo.setBounds(x + margin, y + margin, w - margin * 2, h - margin); logo.setFont(new Font(Font.DIALOG, Font.BOLD, 18)); logo.setHorizontalAlignment(SwingConstants.CENTER); - logo.setPreferredSize(new Dimension(h*742/537, h)); + logo.setPreferredSize(new Dimension(h * 742 / 537, h)); y += h; } catch (Throwable ivjExc) { @@ -171,14 +171,14 @@ public class NotSkyblockAddonsInstallerFrame extends JFrame implements ActionLis descriptionText = new JTextArea(); descriptionText.setName("TextArea"); - descriptionText.setBounds(x+margin, y+margin, w-margin*2, h-margin); + descriptionText.setBounds(x + margin, y + margin, w - margin * 2, h - margin); descriptionText.setEditable(false); descriptionText.setHighlighter(null); descriptionText.setEnabled(true); descriptionText.setFont(new Font(Font.DIALOG, Font.PLAIN, 12)); descriptionText.setLineWrap(true); descriptionText.setOpaque(false); - descriptionText.setPreferredSize(new Dimension(w-margin*2, h-margin)); + descriptionText.setPreferredSize(new Dimension(w - margin * 2, h - margin)); descriptionText.setText("This installer will copy NotEnoughUpdates into your forge mods folder for you, and replace any old versions that already exist. " + "Close this if you prefer to do this yourself!"); descriptionText.setWrapStyleWord(true); @@ -199,14 +199,14 @@ public class NotSkyblockAddonsInstallerFrame extends JFrame implements ActionLis forgeDescriptionText = new JTextArea(); forgeDescriptionText.setName("TextAreaForge"); - forgeDescriptionText.setBounds(x+margin, y+margin, w-margin*2, h-margin); + forgeDescriptionText.setBounds(x + margin, y + margin, w - margin * 2, h - margin); forgeDescriptionText.setEditable(false); forgeDescriptionText.setHighlighter(null); forgeDescriptionText.setEnabled(true); forgeDescriptionText.setFont(new Font(Font.DIALOG, Font.PLAIN, 12)); forgeDescriptionText.setLineWrap(true); forgeDescriptionText.setOpaque(false); - forgeDescriptionText.setPreferredSize(new Dimension(w-margin*2, h-margin)); + forgeDescriptionText.setPreferredSize(new Dimension(w - margin * 2, h - margin)); forgeDescriptionText.setText("However, you still need to install Forge client in order to be able to run this mod. Click here to visit the download page for Forge 1.8.9!"); forgeDescriptionText.setForeground(Color.BLUE.darker()); forgeDescriptionText.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); @@ -230,7 +230,7 @@ public class NotSkyblockAddonsInstallerFrame extends JFrame implements ActionLis try { labelFolder = new JLabel(); labelFolder.setName("LabelFolder"); - labelFolder.setBounds(x, y+2, w, h); + labelFolder.setBounds(x, y + 2, w, h); labelFolder.setPreferredSize(new Dimension(w, h)); labelFolder.setText("Mods Folder"); } catch (Throwable ivjExc) { @@ -271,7 +271,7 @@ public class NotSkyblockAddonsInstallerFrame extends JFrame implements ActionLis try { BufferedImage myPicture = ImageIO.read(getClass().getClassLoader().getResourceAsStream("assets/notenoughupdates/folder.png")); - Image scaled = myPicture.getScaledInstance(w-8, h-6, Image.SCALE_SMOOTH); + Image scaled = myPicture.getScaledInstance(w - 8, h - 6, Image.SCALE_SMOOTH); buttonChooseFolder = new JButton(new ImageIcon(scaled)); buttonChooseFolder.setName("ButtonFolder"); buttonChooseFolder.setBounds(x, y, w, h); @@ -411,10 +411,7 @@ public class NotSkyblockAddonsInstallerFrame extends JFrame implements ActionLis File thisFile = getThisFile(); if (thisFile != null) { - boolean inSubFolder = false; - if (IN_MODS_SUBFOLDER.matcher(modsFolder.getPath()).find()) { - inSubFolder = true; - } + boolean inSubFolder = IN_MODS_SUBFOLDER.matcher(modsFolder.getPath()).find(); boolean deletingFailure = false; if (modsFolder.isDirectory()) { // Delete in this current folder. diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java index c16cb7d0..7eefac6a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java @@ -31,7 +31,7 @@ public class CustomItems { "DUCTTAPE", "iron_shovel", "You ever accidentally bury your duct tape?", - "No problem! Our team of experts specialise in", + "No problem! Our team of experts specialise in", "subterranean duct tape excavation. That's right:", "your buried duct tape problems are a thing of the past,", "all for the low price of $7.99 or a subscription", @@ -44,24 +44,24 @@ public class CustomItems { public static JsonObject RUNE = create("RUNE", "paper", "No.", "I hate runes."); public static JsonObject TWOBEETWOTEE = create("2B2T", "bedrock", "Minecraft's oldest anarchy Minecraft server in Minecraft.", "This Minecraft anarchy server is the oldest server,", - "being a server since 2010 when Minecraft was a game with a server.", - "It is complete anarchy in Minecraft which means that there is total anarchy.", - "Hacking is allowed in Minecraft on this anarchy server which", - "is the oldest anarchy server in Minecraft, 2b2t. Hack. Steal. Cheat. Lie.", - "On the oldest anarchy server in Minecraft. 2b2t. The worst server in Minecraft,", - "where there are no rules. On the oldest anarchy server in Minecraft.", - "In this Minecraft anarchy server, there have been numerous Minecraft", - "incursions on the server, some of which I, a player on this Minecraft", - "anarchy server in Minecraft, have participated in. One of this server's", - "most infamous Minecraft players on the oldest Minecraft"); + "being a server since 2010 when Minecraft was a game with a server.", + "It is complete anarchy in Minecraft which means that there is total anarchy.", + "Hacking is allowed in Minecraft on this anarchy server which", + "is the oldest anarchy server in Minecraft, 2b2t. Hack. Steal. Cheat. Lie.", + "On the oldest anarchy server in Minecraft. 2b2t. The worst server in Minecraft,", + "where there are no rules. On the oldest anarchy server in Minecraft.", + "In this Minecraft anarchy server, there have been numerous Minecraft", + "incursions on the server, some of which I, a player on this Minecraft", + "anarchy server in Minecraft, have participated in. One of this server's", + "most infamous Minecraft players on the oldest Minecraft"); public static JsonObject LEOCTHL = create("LEOCTHL", "dragon_egg", "--- Stats below may not be entirely accurate ---", "17 legendary dragon pets", - "24 epic dragon pets", - "18 epic golem pets", - "12 legendary golem pets", - "39 legendary phoenix pets", - "", - "get flexed"); + "24 epic dragon pets", + "18 epic golem pets", + "12 legendary golem pets", + "39 legendary phoenix pets", + "", + "get flexed"); public static JsonObject CREDITS = Constants.MISC.getAsJsonObject("credits"); public static JsonObject IRONM00N = create( "IRONM00N", @@ -79,9 +79,9 @@ public class CustomItems { JsonObject json = new JsonObject(); json.addProperty("itemid", itemid); json.addProperty("internalname", internalname); - json.addProperty("displayname", EnumChatFormatting.RED+displayname); + json.addProperty("displayname", EnumChatFormatting.RED + displayname); JsonArray jsonlore = new JsonArray(); - for(String line : lore) { + for (String line : lore) { jsonlore.add(new JsonPrimitive(EnumChatFormatting.GRAY + line)); } json.add("lore", jsonlore); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index 83c4b7ae..0aa80126 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -4,7 +4,6 @@ import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.auction.APIManager; import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; import io.github.moulberry.notenoughupdates.util.Constants; -import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -21,10 +20,10 @@ public class ItemPriceInformation { } public static boolean addToTooltip(List tooltip, String internalname, ItemStack stack, boolean useStackSize) { - if(stack.getTagCompound().hasKey("disableNeuTooltip") && stack.getTagCompound().getBoolean("disableNeuTooltip")){ + if (stack.getTagCompound().hasKey("disableNeuTooltip") && stack.getTagCompound().getBoolean("disableNeuTooltip")) { return false; } - if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKey && !KeybindHelper.isKeyDown(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKeyKeybind)){ + if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKey && !KeybindHelper.isKeyDown(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKeyKeybind)) { return false; } JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); @@ -39,7 +38,7 @@ public class ItemPriceInformation { NumberFormat format = NumberFormat.getInstance(Locale.US); - if(bazaarItem) { + if (bazaarItem) { List lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoBaz; boolean added = false; @@ -48,161 +47,169 @@ public class ItemPriceInformation { int stackMultiplier = 1; int shiftStackMultiplier = useStackSize && stack.stackSize > 1 ? stack.stackSize : 64; - if(shiftPressed) { + if (shiftPressed) { stackMultiplier = shiftStackMultiplier; } //values = {"", "Buy", "Sell", "Buy (Insta)", "Sell (Insta)", "Raw Craft Cost"} - for(int lineId : lines) { + for (int lineId : lines) { switch (lineId) { case 0: - if(bazaarInfo.has("avg_buy")) { - if(!added) { + if (bazaarInfo.has("avg_buy")) { + if (!added) { tooltip.add(""); - if(!shiftPressed) tooltip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]"); + if (!shiftPressed) + tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); added = true; } - int bazaarBuyPrice = (int)bazaarInfo.get("avg_buy").getAsFloat()*stackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Buy: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarBuyPrice)+" coins"); + int bazaarBuyPrice = (int) bazaarInfo.get("avg_buy").getAsFloat() * stackMultiplier; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Buy: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarBuyPrice) + " coins"); } break; case 1: - if(bazaarInfo.has("avg_sell")) { - if(!added) { + if (bazaarInfo.has("avg_sell")) { + if (!added) { tooltip.add(""); - if(!shiftPressed) tooltip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]"); + if (!shiftPressed) + tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); added = true; } - int bazaarSellPrice = (int)bazaarInfo.get("avg_sell").getAsFloat()*stackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Sell: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarSellPrice)+" coins"); + int bazaarSellPrice = (int) bazaarInfo.get("avg_sell").getAsFloat() * stackMultiplier; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Sell: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarSellPrice) + " coins"); } break; case 2: - if(bazaarInfo.has("curr_buy")) { - if(!added) { + if (bazaarInfo.has("curr_buy")) { + if (!added) { tooltip.add(""); - if(!shiftPressed) tooltip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]"); + if (!shiftPressed) + tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); added = true; } - int bazaarInstantBuyPrice = (int)bazaarInfo.get("curr_buy").getAsFloat()*stackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Buy: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantBuyPrice)+" coins"); + int bazaarInstantBuyPrice = (int) bazaarInfo.get("curr_buy").getAsFloat() * stackMultiplier; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Buy: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarInstantBuyPrice) + " coins"); } break; case 3: - if(bazaarInfo.has("curr_sell")) { - if(!added) { + if (bazaarInfo.has("curr_sell")) { + if (!added) { tooltip.add(""); - if(!shiftPressed) tooltip.add(EnumChatFormatting.DARK_GRAY.toString()+"[SHIFT show x"+shiftStackMultiplier+"]"); + if (!shiftPressed) + tooltip.add(EnumChatFormatting.DARK_GRAY + "[SHIFT show x" + shiftStackMultiplier + "]"); added = true; } - int bazaarInstantSellPrice = (int)bazaarInfo.get("curr_sell").getAsFloat()*stackMultiplier; - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Bazaar Insta-Sell: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(bazaarInstantSellPrice)+" coins"); + int bazaarInstantSellPrice = (int) bazaarInfo.get("curr_sell").getAsFloat() * stackMultiplier; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Bazaar Insta-Sell: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(bazaarInstantSellPrice) + " coins"); } break; case 4: - if(craftCost.fromRecipe) { - if((int)craftCost.craftCost == 0){ continue;} - if(!added) { + if (craftCost.fromRecipe) { + if ((int) craftCost.craftCost == 0) { + continue; + } + if (!added) { tooltip.add(""); added = true; } - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins"); + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format((int) craftCost.craftCost) + " coins"); } break; } } return added; - } else if(auctionItem) { + } else if (auctionItem) { List lines = NotEnoughUpdates.INSTANCE.config.tooltipTweaks.priceInfoAuc; boolean added = false; - for(int lineId : lines) { + for (int lineId : lines) { switch (lineId) { case 0: - if(lowestBin > 0) { - if(!added) { + if (lowestBin > 0) { + if (!added) { tooltip.add(""); added = true; } - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: " + - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins"); + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Lowest BIN: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(lowestBin) + " coins"); } break; case 1: - if(auctionInfo != null) { - if(!added) { + if (auctionInfo != null) { + if (!added) { tooltip.add(""); added = true; } - if(auctionInfo.has("clean_price")) { - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price (Clean): "+ EnumChatFormatting.GOLD+ - EnumChatFormatting.BOLD+ - format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins"); + if (auctionInfo.has("clean_price")) { + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price (Clean): " + EnumChatFormatting.GOLD + + EnumChatFormatting.BOLD + + format.format((int) auctionInfo.get("clean_price").getAsFloat()) + " coins"); } else { - int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+ EnumChatFormatting.GOLD+ - EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins"); + int auctionPrice = (int) (auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Price: " + EnumChatFormatting.GOLD + + EnumChatFormatting.BOLD + format.format(auctionPrice) + " coins"); } } break; case 2: - if(auctionInfo != null) { - if(!added) { + if (auctionInfo != null) { + if (!added) { tooltip.add(""); added = true; } - if(auctionInfo.has("clean_price")) { - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales (Clean): "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+ - format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day"); + if (auctionInfo.has("clean_price")) { + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales (Clean): " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + format.format(auctionInfo.get("clean_sales").getAsFloat()) + " sales/day"); } else { - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+ - format.format(auctionInfo.get("sales").getAsFloat())+" sales/day"); + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AH Sales: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + + format.format(auctionInfo.get("sales").getAsFloat()) + " sales/day"); } } break; case 3: - if(craftCost.fromRecipe) { - if((int)craftCost.craftCost == 0){ continue;} - if(!added) { + if (craftCost.fromRecipe) { + if ((int) craftCost.craftCost == 0) { + continue; + } + if (!added) { tooltip.add(""); added = true; } - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins"); + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Raw Craft Cost: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format((int) craftCost.craftCost) + " coins"); } break; case 4: - if(lowestBinAvg > 0) { - if(!added) { + if (lowestBinAvg > 0) { + if (!added) { tooltip.add(""); added = true; } - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+ - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins"); + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "AVG Lowest BIN: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + format.format(lowestBinAvg) + " coins"); } break; case 5: - if(Constants.ESSENCECOSTS == null) break; + if (Constants.ESSENCECOSTS == null) break; JsonObject essenceCosts = Constants.ESSENCECOSTS; - if(!essenceCosts.has(internalname)) { + if (!essenceCosts.has(internalname)) { break; } JsonObject itemCosts = essenceCosts.get(internalname).getAsJsonObject(); String essenceType = itemCosts.get("type").getAsString(); int dungeonItemLevel = -1; - if(stack != null && stack.hasTagCompound() && + if (stack != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("ExtraAttributes", 10)) { NBTTagCompound ea = stack.getTagCompound().getCompoundTag("ExtraAttributes"); @@ -210,24 +217,24 @@ public class ItemPriceInformation { dungeonItemLevel = ea.getInteger("dungeon_item_level"); } } - if(dungeonItemLevel == -1) { + if (dungeonItemLevel == -1) { int dungeonizeCost = 0; - if(itemCosts.has("dungeonize")) { + if (itemCosts.has("dungeonize")) { dungeonizeCost = itemCosts.get("dungeonize").getAsInt(); } - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Dungeonize Cost: " + - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+dungeonizeCost+" "+essenceType); - } else if(dungeonItemLevel >= 0 && dungeonItemLevel <= 4) { - String costType = (dungeonItemLevel+1)+""; + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Dungeonize Cost: " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + dungeonizeCost + " " + essenceType); + } else if (dungeonItemLevel >= 0 && dungeonItemLevel <= 4) { + String costType = (dungeonItemLevel + 1) + ""; int upgradeCost = itemCosts.get(costType).getAsInt(); StringBuilder star = new StringBuilder(); - for(int i=0; i<=dungeonItemLevel; i++) { + for (int i = 0; i <= dungeonItemLevel; i++) { star.append('\u272A'); } - tooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Upgrade to "+ - EnumChatFormatting.GOLD+star+EnumChatFormatting.YELLOW+EnumChatFormatting.BOLD+": " + - EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+upgradeCost+" "+essenceType); + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Upgrade to " + + EnumChatFormatting.GOLD + star + EnumChatFormatting.YELLOW + EnumChatFormatting.BOLD + ": " + + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + upgradeCost + " " + essenceType); } break; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java index 56a196b4..df06aae7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java @@ -4,7 +4,8 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper; public class NEUApi { static boolean disableInventoryButtons = false; - public static void setInventoryButtonsToDisabled(){ + + public static void setInventoryButtonsToDisabled() { disableInventoryButtons = true; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 42b53ef2..527abd02 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1,7 +1,10 @@ package io.github.moulberry.notenoughupdates; import com.google.common.collect.Lists; -import com.google.gson.*; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; @@ -82,7 +85,7 @@ public class NEUEventListener { private void displayUpdateMessageIfOutOfDate() { File repo = neu.manager.repoLocation; - if(repo.exists()) { + if (repo.exists()) { File updateJson = new File(repo, "update.json"); try { JsonObject o = neu.manager.getJsonFromFile(updateJson); @@ -93,7 +96,7 @@ public class NEUEventListener { boolean shouldUpdate = !NotEnoughUpdates.VERSION.equalsIgnoreCase(version); boolean shouldPreUpdate = !NotEnoughUpdates.PRE_VERSION.equalsIgnoreCase(preVersion); - if(o.has("version_id") && o.get("version_id").isJsonPrimitive()) { + if (o.has("version_id") && o.get("version_id").isJsonPrimitive()) { int version_id = o.get("version_id").getAsInt(); shouldUpdate = version_id > NotEnoughUpdates.VERSION_ID; } @@ -102,20 +105,20 @@ public class NEUEventListener { shouldPreUpdate = pre_version_id > NotEnoughUpdates.PRE_VERSION_ID; } - if(shouldUpdate) { + if (shouldUpdate) { String update_msg = o.get("update_msg").getAsString(); int first_len = -1; - for(String line : update_msg.split("\n")) { + for (String line : update_msg.split("\n")) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; int len = fr.getStringWidth(line); - if(first_len == -1) { + if (first_len == -1) { first_len = len; } - int missing_len = first_len-len; - if(missing_len > 0) { + int missing_len = first_len - len; + if (missing_len > 0) { StringBuilder sb = new StringBuilder(line); - for(int i=0; i lines, boolean showForever) { displayNotification(lines, showForever, false); } public static void displayNotification(List lines, boolean showForever, boolean overInventory) { - if(showForever) { + if (showForever) { notificationDisplayMillis = -420; } else { notificationDisplayMillis = System.currentTimeMillis(); @@ -200,30 +204,30 @@ public class NEUEventListener { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { - if(Minecraft.getMinecraft().currentScreen == null || !(Minecraft.getMinecraft().currentScreen instanceof GuiChat)) { + 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; + if (event.phase != TickEvent.Phase.START) return; + if (Minecraft.getMinecraft().theWorld == null) return; + if (Minecraft.getMinecraft().thePlayer == null) return; - if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest cc = (ContainerChest) chest.inventorySlots; - if(!loadedInvName.equals(cc.getLowerChestInventory().getDisplayName().getUnformattedText())) { + if (!loadedInvName.equals(cc.getLowerChestInventory().getDisplayName().getUnformattedText())) { loadedInvName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); inventoryLoaded = false; inventoryLoadedTicks = 3; } - if(!inventoryLoaded) { - if(cc.getLowerChestInventory().getStackInSlot(cc.getLowerChestInventory().getSizeInventory()-1) != null) { + if (!inventoryLoaded) { + if (cc.getLowerChestInventory().getStackInSlot(cc.getLowerChestInventory().getSizeInventory() - 1) != null) { inventoryLoaded = true; } else { - for(ItemStack stack : chest.inventorySlots.getInventory()) { - if(stack != null) { - if(--inventoryLoadedTicks <= 0) { + for (ItemStack stack : chest.inventorySlots.getInventory()) { + if (stack != null) { + if (--inventoryLoadedTicks <= 0) { inventoryLoaded = true; } break; @@ -236,7 +240,7 @@ public class NEUEventListener { inventoryLoadedTicks = 3; } - if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1) && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4) && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD9)) { + if (Keyboard.isKeyDown(Keyboard.KEY_NUMPAD1) && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD4) && Keyboard.isKeyDown(Keyboard.KEY_NUMPAD9)) { ChatComponentText component = new ChatComponentText("\u00a7cYou are permanently banned from this server!"); component.appendText("\n"); component.appendText("\n\u00a77Reason: \u00a7rSuspicious account activity/Other"); @@ -248,51 +252,51 @@ public class NEUEventListener { return; } - if(neu.hasSkyblockScoreboard()) { - if(!preloadedItems) { + if (neu.hasSkyblockScoreboard()) { + if (!preloadedItems) { preloadedItems = true; List list = new ArrayList<>(neu.manager.getItemInformation().values()); - for(JsonObject json : list) { + for (JsonObject json : list) { itemPreloader.submit(() -> { ItemStack stack = neu.manager.jsonToStack(json, true, true); - if(stack.getItem() == Items.skull) toPreload.add(stack); + if (stack.getItem() == Items.skull) toPreload.add(stack); }); } - } else if(!toPreload.isEmpty()) { + } else if (!toPreload.isEmpty()) { Utils.drawItemStack(toPreload.get(0), -100, -100); toPreload.remove(0); } else { itemPreloader.shutdown(); } - for(TextOverlay overlay : OverlayManager.textOverlays) { + for (TextOverlay overlay : OverlayManager.textOverlays) { overlay.shouldUpdateFrequent = true; } } boolean longUpdate = false; long currentTime = System.currentTimeMillis(); - if(currentTime - lastLongUpdate > 1000) { + if (currentTime - lastLongUpdate > 1000) { longUpdate = true; lastLongUpdate = currentTime; } - if(!NotEnoughUpdates.INSTANCE.config.dungeons.slowDungeonBlocks) { + if (!NotEnoughUpdates.INSTANCE.config.dungeons.slowDungeonBlocks) { DungeonBlocks.tick(); } DungeonWin.tick(); String containerName = null; - if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest eventGui = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - if(GuiCustomEnchant.getInstance().shouldOverride(containerName)) { + if (GuiCustomEnchant.getInstance().shouldOverride(containerName)) { GuiCustomEnchant.getInstance().tick(); } } - if(longUpdate) { + if (longUpdate) { CrystalOverlay.tick(); DwarvenMinesTextures.tick(); FairySouls.tick(); @@ -303,8 +307,8 @@ public class NEUEventListener { NPCRetexturing.getInstance().tick(); StorageOverlay.getInstance().markDirty(); - if(neu.hasSkyblockScoreboard()) { - for(TextOverlay overlay : OverlayManager.textOverlays) { + if (neu.hasSkyblockScoreboard()) { + for (TextOverlay overlay : OverlayManager.textOverlays) { overlay.tick(); } } @@ -315,58 +319,57 @@ public class NEUEventListener { NotEnoughUpdates.profileViewer.putNameUuid(Minecraft.getMinecraft().thePlayer.getName(), Minecraft.getMinecraft().thePlayer.getUniqueID().toString().replace("-", "")); - if(NotEnoughUpdates.INSTANCE.config.dungeons.slowDungeonBlocks) { + if (NotEnoughUpdates.INSTANCE.config.dungeons.slowDungeonBlocks) { DungeonBlocks.tick(); } - if(System.currentTimeMillis() - SBInfo.getInstance().joinedWorld > 500 && + if (System.currentTimeMillis() - SBInfo.getInstance().joinedWorld > 500 && System.currentTimeMillis() - SBInfo.getInstance().unloadedWorld > 500) { neu.updateSkyblockScoreboard(); } CapeManager.getInstance().tick(); - if(containerName != null) { - if(!containerName.trim().startsWith("Accessory Bag")) { + if (containerName != null) { + if (!containerName.trim().startsWith("Accessory Bag")) { AccessoryBagOverlay.resetCache(); } } else { AccessoryBagOverlay.resetCache(); } - if(neu.hasSkyblockScoreboard()) { + if (neu.hasSkyblockScoreboard()) { SBInfo.getInstance().tick(); lastSkyblockScoreboard = currentTime; - if(!joinedSB) { + if (!joinedSB) { joinedSB = true; //SBGamemodes.loadFromFile(); - - if(NotEnoughUpdates.INSTANCE.config.notifications.showUpdateMsg) { + if (NotEnoughUpdates.INSTANCE.config.notifications.showUpdateMsg) { displayUpdateMessageIfOutOfDate(); } - if(NotEnoughUpdates.INSTANCE.config.notifications.doRamNotif) { - long maxMemoryMB = Runtime.getRuntime().maxMemory()/1024L/1024L; - if(maxMemoryMB > 4100) { + if (NotEnoughUpdates.INSTANCE.config.notifications.doRamNotif) { + long maxMemoryMB = Runtime.getRuntime().maxMemory() / 1024L / 1024L; + if (maxMemoryMB > 4100) { notificationDisplayMillis = System.currentTimeMillis(); notificationLines = new ArrayList<>(); - notificationLines.add(EnumChatFormatting.GRAY+"Too much memory allocated!"); - notificationLines.add(String.format(EnumChatFormatting.DARK_GRAY+"NEU has detected %03dMB of memory allocated to Minecraft!", maxMemoryMB)); - notificationLines.add(EnumChatFormatting.GRAY+"It is recommended to allocated between 2-4GB of memory"); - notificationLines.add(EnumChatFormatting.GRAY+"More than 4GB MAY cause FPS issues, EVEN if you have 16GB+ available"); + notificationLines.add(EnumChatFormatting.GRAY + "Too much memory allocated!"); + notificationLines.add(String.format(EnumChatFormatting.DARK_GRAY + "NEU has detected %03dMB of memory allocated to Minecraft!", maxMemoryMB)); + notificationLines.add(EnumChatFormatting.GRAY + "It is recommended to allocated between 2-4GB of memory"); + notificationLines.add(EnumChatFormatting.GRAY + "More than 4GB MAY cause FPS issues, EVEN if you have 16GB+ available"); notificationLines.add(""); - notificationLines.add(EnumChatFormatting.GRAY+"For more information, visit #ram-info in discord.gg/moulberry"); + notificationLines.add(EnumChatFormatting.GRAY + "For more information, visit #ram-info in discord.gg/moulberry"); } } - if(!NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore) { + if (!NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore) { NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore = true; - 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 Feature List 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")); + 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 Feature List 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("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.GOLD+"To view the feature list after restarting type /neufeatures")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("" + EnumChatFormatting.GOLD + "To view the feature list after restarting type /neufeatures")); } else { String url = Constants.MISC.get("featureslist").getAsString(); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); @@ -379,14 +382,14 @@ public class NEUEventListener { } Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); ChatComponentText clickTextHelp = new ChatComponentText( - EnumChatFormatting.YELLOW+"Click this message if you would like to view a list of NotEnoughUpdate's commands."); + EnumChatFormatting.YELLOW + "Click this message if you would like to view a list of NotEnoughUpdate's commands."); clickTextHelp.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neuhelp")); Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextHelp); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); } } } - if(currentTime - lastSkyblockScoreboard < 5*60*1000) { //5 minutes + if (currentTime - lastSkyblockScoreboard < 5 * 60 * 1000) { //5 minutes neu.manager.auctionManager.tick(); } else { neu.manager.auctionManager.markNeedsUpdate(); @@ -472,10 +475,10 @@ public class NEUEventListener { } }*/ - @SubscribeEvent(priority= EventPriority.HIGHEST) + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onRenderEntitySpecials(RenderLivingEvent.Specials.Pre event) { - if(Minecraft.getMinecraft().currentScreen instanceof GuiProfileViewer) { - if(((GuiProfileViewer)Minecraft.getMinecraft().currentScreen).getEntityPlayer() == event.entity) { + if (Minecraft.getMinecraft().currentScreen instanceof GuiProfileViewer) { + if (((GuiProfileViewer) Minecraft.getMinecraft().currentScreen).getEntityPlayer() == event.entity) { event.setCanceled(true); } } @@ -487,19 +490,19 @@ public class NEUEventListener { Minecraft.getMinecraft().currentScreen instanceof GuiContainer && neu.overlay.isUsingMobsFilter()) { event.setCanceled(true); } - if(event.type != null && event.type.equals(RenderGameOverlayEvent.ElementType.PLAYER_LIST)) { + if (event.type != null && event.type.equals(RenderGameOverlayEvent.ElementType.PLAYER_LIST)) { GlStateManager.enableDepth(); } } @SubscribeEvent public void onRenderGameOverlayPost(RenderGameOverlayEvent.Post event) { - if(neu.hasSkyblockScoreboard() && event.type.equals(RenderGameOverlayEvent.ElementType.ALL)) { + if (neu.hasSkyblockScoreboard() && event.type.equals(RenderGameOverlayEvent.ElementType.ALL)) { DungeonWin.render(event.partialTicks); GlStateManager.pushMatrix(); GlStateManager.translate(0, 0, -200); - for(TextOverlay overlay : OverlayManager.textOverlays) { - if(OverlayManager.dontRenderOverlay != null && OverlayManager.dontRenderOverlay.isAssignableFrom(overlay.getClass())) { + for (TextOverlay overlay : OverlayManager.textOverlays) { + if (OverlayManager.dontRenderOverlay != null && OverlayManager.dontRenderOverlay.isAssignableFrom(overlay.getClass())) { continue; } GlStateManager.translate(0, 0, -1); @@ -509,55 +512,56 @@ public class NEUEventListener { GlStateManager.popMatrix(); OverlayManager.dontRenderOverlay = null; } - if(Keyboard.isKeyDown(Keyboard.KEY_X)) { + if (Keyboard.isKeyDown(Keyboard.KEY_X)) { notificationDisplayMillis = 0; } - if(event.type == RenderGameOverlayEvent.ElementType.ALL){ + if (event.type == RenderGameOverlayEvent