diff options
| author | Roman / Linnea Gräf <roman.graef@gmail.com> | 2022-08-26 13:24:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-26 21:24:35 +1000 |
| commit | dfd2f6b05bce74d7feb5d28e7a388dbb871ecf6a (patch) | |
| tree | 001913c4f1dd391831da26e4398f75e6731c88e1 /src/main/java | |
| parent | c3845685bbb3a2a7fde25476eed0f788e038dc93 (diff) | |
| download | NotEnoughUpdates-dfd2f6b05bce74d7feb5d28e7a388dbb871ecf6a.tar.gz NotEnoughUpdates-dfd2f6b05bce74d7feb5d28e7a388dbb871ecf6a.tar.bz2 NotEnoughUpdates-dfd2f6b05bce74d7feb5d28e7a388dbb871ecf6a.zip | |
Of course you have pronouns in pv (#234)
Diffstat (limited to 'src/main/java')
14 files changed, 904 insertions, 176 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java b/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java new file mode 100644 index 00000000..d997d980 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2022 NotEnoughUpdates contributors + * + * This file is part of NotEnoughUpdates. + * + * NotEnoughUpdates is free software: you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + * + * NotEnoughUpdates is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>. + */ + +package io.github.moulberry.notenoughupdates; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +/** + * For storage of compile-time configuration flags + */ +public class BuildFlags { + + private static final Properties properties = new Properties(); + + static { + try { + properties.load(BuildFlags.class.getResourceAsStream("/buildflags.properties")); + } catch (IOException | NullPointerException e) { + System.out.println("Failed to load build properties: " + e); + } + } + + private static boolean getBuildFlag(String flag) { + return Boolean.parseBoolean(properties.getProperty("neu.buildflags." + flag)); + } + + public static Map<String, Boolean> getAllFlags() { + return Holder.ALL_FLAGS; + } + + public static final boolean ENABLE_PRONOUNS_IN_PV_BY_DEFAULT = getBuildFlag("pronouns"); + + private static class Holder { + static Map<String, Boolean> ALL_FLAGS = new HashMap<>(); + + static { + for (Field declaredField : BuildFlags.class.getDeclaredFields()) { + if (Boolean.TYPE.equals(declaredField.getType()) + && (declaredField.getModifiers() & Modifier.STATIC) != 0) { + try { + declaredField.setAccessible(true); + ALL_FLAGS.put(declaredField.getName(), (Boolean) declaredField.get(null)); + } catch (IllegalAccessException | ClassCastException | SecurityException e) { + System.err.println("Failed to access BuildFlag: " + e); + } + } + } + } + } + +} 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 917185ab..fcb2aaf9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java @@ -42,6 +42,7 @@ import io.github.moulberry.notenoughupdates.commands.misc.CalculatorCommand; import io.github.moulberry.notenoughupdates.commands.misc.CalendarCommand; import io.github.moulberry.notenoughupdates.commands.misc.CosmeticsCommand; import io.github.moulberry.notenoughupdates.commands.misc.CustomizeCommand; +import io.github.moulberry.notenoughupdates.commands.misc.PronounsCommand; import io.github.moulberry.notenoughupdates.commands.misc.UpdateCommand; import io.github.moulberry.notenoughupdates.commands.profile.CataCommand; import io.github.moulberry.notenoughupdates.commands.profile.PeekCommand; @@ -97,6 +98,7 @@ public class Commands { ClientCommandHandler.instance.registerCommand(new CalculatorCommand()); ClientCommandHandler.instance.registerCommand(new CalendarCommand()); ClientCommandHandler.instance.registerCommand(new UpdateCommand(NotEnoughUpdates.INSTANCE)); + ClientCommandHandler.instance.registerCommand(new PronounsCommand()); // Fairy Soul Commands ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand()); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java index 7cca9d3b..fdf59bb0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java @@ -19,6 +19,7 @@ package io.github.moulberry.notenoughupdates.commands.dev; +import io.github.moulberry.notenoughupdates.BuildFlags; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.commands.ClientCommandBase; import io.github.moulberry.notenoughupdates.core.config.GuiPositionEditor; @@ -27,6 +28,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.Custom import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent; import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.SpecialBlockZone; import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph; +import io.github.moulberry.notenoughupdates.util.PronounDB; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -40,6 +42,7 @@ import net.minecraftforge.common.MinecraftForge; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; public class DevTestCommand extends ClientCommandBase { @@ -118,6 +121,14 @@ public class DevTestCommand extends ClientCommandBase { " with the mode " + gamemode)); } + if (args.length >= 1 && args[0].equalsIgnoreCase("buildflags")) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + "BuildFlags: \n" + + BuildFlags.getAllFlags().entrySet().stream() + .map(it -> " + " + it.getKey() + " - " + it.getValue()) + .collect(Collectors.joining("\n")))); + return; + } if (args.length >= 1 && args[0].equalsIgnoreCase("pricetest")) { if (args.length == 1) { NotEnoughUpdates.INSTANCE.manager.auctionManager.updateBazaar(); @@ -163,6 +174,10 @@ public class DevTestCommand extends ClientCommandBase { "I would never search")); return; } + if (args.length == 1 && args[0].equalsIgnoreCase("bluehair")) { + PronounDB.test(); + return; + } if (args.length == 2 && args[0].equalsIgnoreCase("openGui")) { try { NotEnoughUpdates.INSTANCE.openGui = (GuiScreen) Class.forName(args[1]).newInstance(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java new file mode 100644 index 00000000..6d0ee88d --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2022 NotEnoughUpdates contributors + * + * This file is part of NotEnoughUpdates. + * + * NotEnoughUpdates is free software: you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + * + * NotEnoughUpdates is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>. + */ + +package io.github.moulberry.notenoughupdates.commands.misc; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.commands.ClientCommandBase; +import io.github.moulberry.notenoughupdates.util.MinecraftExecutor; +import io.github.moulberry.notenoughupdates.util.PronounDB; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiNewChat; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; + +import java.util.Optional; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +public class PronounsCommand extends ClientCommandBase { + public PronounsCommand() { + super("neupronouns"); + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/neupronouns <username> [platform]"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + switch (args.length) { + case 1: + fetchPronouns("minecraft", args[0]); + break; + case 2: + fetchPronouns(args[1], args[0]); + break; + default: + sender.addChatMessage(new ChatComponentText("§4" + getCommandUsage(sender))); + } + } + + private void fetchPronouns(String platform, String user) { + GuiNewChat nc = Minecraft.getMinecraft().ingameGUI.getChatGUI(); + int id = new Random().nextInt(); + nc.printChatMessageWithOptionalDeletion(new ChatComponentText("§e[NEU] Fetching Pronouns..."), id); + + CompletableFuture<Optional<PronounDB.PronounChoice>> pronouns; + if ("minecraft".equals(platform)) { + CompletableFuture<UUID> c = new CompletableFuture<>(); + NotEnoughUpdates.profileViewer.getPlayerUUID(user, uuidString -> { + if (uuidString == null) { + c.completeExceptionally(new NullPointerException()); + } else { + c.complete(Utils.parseDashlessUUID(uuidString)); + } + }); + pronouns = c.thenApplyAsync(PronounDB::getPronounsFor); + } else { + pronouns = CompletableFuture.supplyAsync(() -> PronounDB.getPronounsFor(platform, user)); + } + pronouns.handleAsync((pronounChoice, throwable) -> { + if (throwable != null || !pronounChoice.isPresent()) { + nc.printChatMessageWithOptionalDeletion(new ChatComponentText("§e[NEU] §4Failed to fetch pronouns."), id); + return null; + } + PronounDB.PronounChoice betterPronounChoice = pronounChoice.get(); + nc.printChatMessageWithOptionalDeletion(new ChatComponentText("§e[NEU] Pronouns for §b" + user + " §eon §b" + platform + "§e:"), id); + betterPronounChoice.render().forEach(it -> nc.printChatMessage(new ChatComponentText("§e[NEU] §a" + it))); + return null; + }, MinecraftExecutor.INSTANCE); + + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java index d52f9ba1..ecb4cd8b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java @@ -23,6 +23,9 @@ import com.google.common.collect.Sets; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.Set; public class StringUtils { @@ -63,4 +66,12 @@ public class StringUtils { str = str.replace(",", ""); return Integer.parseInt(str); } + + public static String urlEncode(String something) { + try { + return URLEncoder.encode(something, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); // UTF 8 should always be present + } + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java index ee1abf46..673e1015 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java @@ -20,7 +20,12 @@ package io.github.moulberry.notenoughupdates.options.seperateSections; import com.google.gson.annotations.Expose; -import io.github.moulberry.notenoughupdates.core.config.annotations.*; +import io.github.moulberry.notenoughupdates.BuildFlags; +import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean; +import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorButton; +import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDraggableList; +import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorFSR; +import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption; import java.util.ArrayList; import java.util.Arrays; @@ -81,4 +86,12 @@ public class ProfileViewer { ) @ConfigEditorBoolean public boolean alwaysShowBingoTab = false; + + @Expose + @ConfigOption( + name = "Show Pronouns in /pv", + desc = "Shows the pronouns of a player in /pv. Data sourced from pronoundb.org" + ) + @ConfigEditorBoolean + public boolean showPronounsInPv = BuildFlags.ENABLE_PRONOUNS_IN_PV_BY_DEFAULT; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java index 30ffcdd9..dcbcb9e4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java @@ -19,8 +19,6 @@ package io.github.moulberry.notenoughupdates.profileviewer; -import static io.github.moulberry.notenoughupdates.util.Utils.roundToNearestInt; - import com.google.common.base.Splitter; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -30,17 +28,9 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.profileviewer.weight.lily.LilyWeight; import io.github.moulberry.notenoughupdates.profileviewer.weight.senither.SenitherWeight; import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.PronounDB; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadPoolExecutor; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.gui.FontRenderer; @@ -63,6 +53,19 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; +import java.awt.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; + +import static io.github.moulberry.notenoughupdates.util.Utils.roundToNearestInt; + public class BasicPage extends GuiProfileViewerPage { private static final ResourceLocation pv_basic = new ResourceLocation("notenoughupdates:pv_basic.png"); @@ -117,7 +120,8 @@ public class BasicPage extends GuiProfileViewerPage { String panoramaIdentifier = "day"; if (SBInfo.getInstance().currentTimeDate != null) { - if (SBInfo.getInstance().currentTimeDate.getHours() <= 6 || SBInfo.getInstance().currentTimeDate.getHours() >= 20) { + if (SBInfo.getInstance().currentTimeDate.getHours() <= 6 || + SBInfo.getInstance().currentTimeDate.getHours() >= 20) { panoramaIdentifier = "night"; } } @@ -133,19 +137,36 @@ public class BasicPage extends GuiProfileViewerPage { Panorama.getPanoramasForLocation(location == null ? "unknown" : location, panoramaIdentifier) ); + if (Utils.isWithinRect(mouseX, mouseY, guiLeft + 23, guiTop + 44, 81, 108)) { + Optional<PronounDB.PronounChoice> pronounChoice = + GuiProfileViewer.pronouns + .peekValue() + .flatMap(it -> it); // Flatten: First optional is whether it loaded, second optional is whether it was successful + if (pronounChoice.isPresent()) { + PronounDB.PronounChoice pronouns = pronounChoice.get(); + if (pronouns.isConsciousChoice()) { + getInstance().tooltipToDisplay = pronouns.render(); + } + } + } + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_basic); Utils.drawTexturedRect(guiLeft, guiTop, getInstance().sizeX, getInstance().sizeY, GL11.GL_NEAREST); if (entityPlayer != null && profile.getHypixelProfile() != null) { String playerName = null; if (profile.getHypixelProfile().has("prefix")) { - playerName = Utils.getElementAsString(profile.getHypixelProfile().get("prefix"), "") + " " + entityPlayer.getName(); + playerName = Utils.getElementAsString(profile.getHypixelProfile().get("prefix"), "") + " " + + entityPlayer.getName(); } else { String rank = Utils.getElementAsString( profile.getHypixelProfile().get("rank"), Utils.getElementAsString(profile.getHypixelProfile().get("newPackageRank"), "NONE") ); - String monthlyPackageRank = Utils.getElementAsString(profile.getHypixelProfile().get("monthlyPackageRank"), "NONE"); + String monthlyPackageRank = Utils.getElementAsString( + profile.getHypixelProfile().get("monthlyPackageRank"), + "NONE" + ); if (!rank.equals("YOUTUBER") && !monthlyPackageRank.equals("NONE")) { rank = monthlyPackageRank; } @@ -191,7 +212,13 @@ public class BasicPage extends GuiProfileViewerPage { int x = guiLeft + 63; int y = guiTop + 54; - GuiScreen.drawRect(x - halfRankPrefixLen - 1, y - 1, x + halfRankPrefixLen + 1, y + 8, new Color(0, 0, 0, 64).getRGB()); + GuiScreen.drawRect( + x - halfRankPrefixLen - 1, + y - 1, + x + halfRankPrefixLen + 1, + y + 8, + new Color(0, 0, 0, 64).getRGB() + ); fr.drawString(playerName, x - halfRankPrefixLen, y, 0, true); } @@ -200,7 +227,8 @@ public class BasicPage extends GuiProfileViewerPage { long networth = profile.getNetWorth(profileId); if (networth > 0) { Utils.drawStringCentered( - EnumChatFormatting.GREEN + "Net Worth: " + EnumChatFormatting.GOLD + GuiProfileViewer.numberFormat.format(networth), + EnumChatFormatting.GREEN + "Net Worth: " + EnumChatFormatting.GOLD + + GuiProfileViewer.numberFormat.format(networth), fr, guiLeft + 63, guiTop + 38, @@ -211,31 +239,38 @@ public class BasicPage extends GuiProfileViewerPage { double networthInCookies = ( networth / - NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo("BOOSTER_COOKIE").get("avg_buy").getAsDouble() + NotEnoughUpdates.INSTANCE.manager.auctionManager + .getBazaarInfo("BOOSTER_COOKIE") + .get("avg_buy") + .getAsDouble() ); String networthIRLMoney = Long.toString(Math.round(((networthInCookies * 325) / 675) * 4.99)); if ( mouseX > guiLeft + 8 && - mouseX < guiLeft + 8 + fr.getStringWidth("Net Worth: " + GuiProfileViewer.numberFormat.format(networth)) + mouseX < guiLeft + 8 + fr.getStringWidth("Net Worth: " + GuiProfileViewer.numberFormat.format(networth)) ) { if (mouseY > guiTop + 32 && mouseY < guiTop + 32 + fr.FONT_HEIGHT) { getInstance().tooltipToDisplay = new ArrayList<>(); getInstance() .tooltipToDisplay.add( EnumChatFormatting.GREEN + - "Net worth in IRL money: " + - EnumChatFormatting.DARK_GREEN + - "$" + - EnumChatFormatting.GOLD + - networthIRLMoney + "Net worth in IRL money: " + + EnumChatFormatting.DARK_GREEN + + "$" + + EnumChatFormatting.GOLD + + networthIRLMoney ); getInstance().tooltipToDisplay.add(""); if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "This is calculated using the current"); - getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "price of booster cookies on bazaar and the price"); - getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "for cookies using gems, then the price of gems"); - getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "is where we get the amount of IRL money you"); - getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "theoretically have on skyblock in net worth."); + getInstance().tooltipToDisplay.add( + EnumChatFormatting.RED + "price of booster cookies on bazaar and the price"); + getInstance().tooltipToDisplay.add( + EnumChatFormatting.RED + "for cookies using gems, then the price of gems"); + getInstance().tooltipToDisplay.add( + EnumChatFormatting.RED + "is where we get the amount of IRL money you"); + getInstance().tooltipToDisplay.add( + EnumChatFormatting.RED + "theoretically have on skyblock in net worth."); } else { getInstance().tooltipToDisplay.add(EnumChatFormatting.GRAY + "[SHIFT for Info]"); } @@ -245,7 +280,8 @@ public class BasicPage extends GuiProfileViewerPage { } } } - } catch (Exception ignored) {} + } catch (Exception ignored) { + } } if (status != null) { @@ -261,9 +297,17 @@ public class BasicPage extends GuiProfileViewerPage { NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("POTATO_CROWN") ); potato_crown.addEnchantment(Enchantment.unbreaking, 1656638942); // this number may be useful - Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(new ItemStack(Items.potato), guiLeft + 35, guiTop + 160); + Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI( + new ItemStack(Items.potato), + guiLeft + 35, + guiTop + 160 + ); Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(potato_crown, guiLeft + 50, guiTop + 162); - Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(new ItemStack(Items.potato), guiLeft + 63, guiTop + 160); + Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI( + new ItemStack(Items.potato), + guiLeft + 63, + guiTop + 160 + ); } else if (online) { locationStr = NotEnoughUpdates.INSTANCE.navigation.getNameForAreaModeOrUnknown(location); } @@ -370,7 +414,8 @@ public class BasicPage extends GuiProfileViewerPage { }, false ); - } catch (Exception ignored) {} + } catch (Exception ignored) { + } } GlStateManager.color(1, 1, 1, 1); @@ -388,9 +433,9 @@ public class BasicPage extends GuiProfileViewerPage { int x = guiLeft + 20; float y = guiTop + - 82 + - 15 * - (float) Math.sin(((getInstance().currentTime - getInstance().startTime) / 800f) % (2 * Math.PI)); + 82 + + 15 * + (float) Math.sin(((getInstance().currentTime - getInstance().startTime) / 800f) % (2 * Math.PI)); GlStateManager.translate(x, y, 0); ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, false); @@ -410,7 +455,14 @@ public class BasicPage extends GuiProfileViewerPage { } } if (entityPlayer != null) { - drawEntityOnScreen(guiLeft + 63, guiTop + 128 + 7, 36, guiLeft + 63 - mouseX, guiTop + 129 - mouseY, entityPlayer); + drawEntityOnScreen( + guiLeft + 63, + guiTop + 128 + 7, + 36, + guiLeft + 63 - mouseX, + guiTop + 129 - mouseY, + entityPlayer + ); } PlayerStats.Stats stats = profile.getStats(profileId); @@ -426,7 +478,12 @@ public class BasicPage extends GuiProfileViewerPage { GlStateManager.color(1, 1, 1, 1); GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL14.glBlendFuncSeparate( + GL11.GL_SRC_ALPHA, + GL11.GL_ONE_MINUS_SRC_ALPHA, + GL11.GL_ONE, + GL11.GL_ONE_MINUS_SRC_ALPHA + ); Utils.renderAlignedString( statNamePretty, EnumChatFormatting.WHITE.toString() + val, @@ -445,49 +502,49 @@ public class BasicPage extends GuiProfileViewerPage { getInstance() .tooltipToDisplay.add( EnumChatFormatting.GRAY + - "Base " + - split.get(1) + - ": " + - EnumChatFormatting.GREEN + - base + - " " + - split.get(0) + "Base " + + split.get(1) + + ": " + + EnumChatFormatting.GREEN + + base + + " " + + split.get(0) ); int passive = Math.round(profile.getPassiveStats(profileId).get(statName) - baseStats.get(statName)); getInstance() .tooltipToDisplay.add( EnumChatFormatting.GRAY + - "Passive " + - split.get(1) + - " Bonus: +" + - EnumChatFormatting.YELLOW + - passive + - " " + - split.get(0) + "Passive " + + split.get(1) + + " Bonus: +" + + EnumChatFormatting.YELLOW + + passive + + " " + + split.get(0) ); int itemBonus = Math.round(stats.get(statName) - profile.getPassiveStats(profileId).get(statName)); getInstance() .tooltipToDisplay.add( EnumChatFormatting.GRAY + - "Item " + - split.get(1) + - " Bonus: +" + - EnumChatFormatting.DARK_PURPLE + - itemBonus + - " " + - split.get(0) + "Item " + + split.get(1) + + " Bonus: +" + + EnumChatFormatting.DARK_PURPLE + + itemBonus + + " " + + split.get(0) ); int finalStat = Math.round(stats.get(statName)); getInstance() .tooltipToDisplay.add( EnumChatFormatting.GRAY + - "Final " + - split.get(1) + - ": +" + - EnumChatFormatting.RED + - finalStat + - " " + - split.get(0) + "Final " + + split.get(1) + + ": +" + + EnumChatFormatting.RED + + finalStat + + " " + + split.get(0) ); } } @@ -551,17 +608,18 @@ public class BasicPage extends GuiProfileViewerPage { getInstance().tooltipToDisplay = new ArrayList<>(); getInstance().tooltipToDisplay.add(skillName); if (skyblockInfo.get(entry.getKey()).maxed) { - getInstance().tooltipToDisplay.add(EnumChatFormatting.GRAY + "Progress: " + EnumChatFormatting.GOLD + "MAXED!"); + getInstance().tooltipToDisplay.add( + EnumChatFormatting.GRAY + "Progress: " + EnumChatFormatting.GOLD + "MAXED!"); } else { int maxXp = (int) skyblockInfo.get(entry.getKey()).maxXpForLevel; getInstance() .tooltipToDisplay.add( EnumChatFormatting.GRAY + - "Progress: " + - EnumChatFormatting.DARK_PURPLE + - GuiProfileViewer.shortNumberFormat(Math.round((level % 1) * maxXp), 0) + - "/" + - GuiProfileViewer.shortNumberFormat(maxXp, 0) + "Progress: " + + EnumChatFormatting.DARK_PURPLE + + GuiProfileViewer.shortNumberFormat(Math.round((level % 1) * maxXp), 0) + + "/" + + GuiProfileViewer.shortNumberFormat(maxXp, 0) ); } String totalXpS = GuiProfileViewer.numberFormat.format((int) skyblockInfo.get(entry.getKey()).totalXp); @@ -605,23 +663,29 @@ public class BasicPage extends GuiProfileViewerPage { return ( uuidStr.substring(0, 8) + - "-" + - uuidStr.substring(8, 12) + - "-" + - uuidStr.substring(12, 16) + - "-" + - uuidStr.substring(16, 20) + - "-" + - uuidStr.substring(20, 32) + "-" + + uuidStr.substring(8, 12) + + "-" + + uuidStr.substring(12, 16) + + "-" + + uuidStr.substring(16, 20) + + "-" + + uuidStr.substring(20, 32) ); } - private void renderWeight(int mouseX, int mouseY, Map<String, ProfileViewer.Level> skyblockInfo, JsonObject profileInfo) { + private void renderWeight( + int mouseX, + int mouseY, + Map<String, ProfileViewer.Level> skyblockInfo, + JsonObject profileInfo + ) { if (skyblockInfo == null) { return; } - if (Constants.WEIGHT == null || Utils.getElement |
