aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorDoKM <54663875+DoKM@users.noreply.github.com>2021-07-25 19:20:10 +0200
committerGitHub <noreply@github.com>2021-07-25 19:20:10 +0200
commit57a5639f6cfaed3dff8473ae7b59d59a89727fda (patch)
treea8e4a0c84dc559be1925b230dc719423dd2a5ff1 /src/main/java
parent7b79c6bb2f9b570c9c2c3f424f239c645dfe90d7 (diff)
parenta7dde6d4582ad1b2474b0f59c1c74dd70b654a98 (diff)
downloadNotEnoughUpdates-57a5639f6cfaed3dff8473ae7b59d59a89727fda.tar.gz
NotEnoughUpdates-57a5639f6cfaed3dff8473ae7b59d59a89727fda.tar.bz2
NotEnoughUpdates-57a5639f6cfaed3dff8473ae7b59d59a89727fda.zip
Merge pull request #12 from IRONM00N/pr
Move PR. to your fork
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java43
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java28
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java31
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java6012
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java2461
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java2
10 files changed, 4310 insertions, 4307 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java
index dcd8cfb2..c16cb7d0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/CustomItems.java
@@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
+import io.github.moulberry.notenoughupdates.util.Constants;
import net.minecraft.util.EnumChatFormatting;
public class CustomItems {
@@ -61,6 +62,14 @@ public class CustomItems {
"39 legendary phoenix pets",
"",
"get flexed");
+ public static JsonObject CREDITS = Constants.MISC.getAsJsonObject("credits");
+ public static JsonObject IRONM00N = create(
+ "IRONM00N",
+ "end_stone",
+ "IRONM00N",
+ "Your life has been a lie,",
+ "the moon is made out of iron."
+ );
/**
* SHAAAAAAAAAAAAAAAAAAME
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 69ecc841..b849c890 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -19,7 +19,10 @@ import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes;
import io.github.moulberry.notenoughupdates.miscfeatures.*;
import io.github.moulberry.notenoughupdates.miscgui.*;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
-import io.github.moulberry.notenoughupdates.overlays.*;
+import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay;
+import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
+import io.github.moulberry.notenoughupdates.overlays.RancherBootOverlay;
+import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.util.*;
import net.minecraft.client.Minecraft;
@@ -31,10 +34,7 @@ import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.client.gui.inventory.GuiInventory;
-import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
import net.minecraft.init.Blocks;
@@ -46,14 +46,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTUtil;
-import net.minecraft.network.play.client.C12PacketUpdateSign;
import net.minecraft.util.*;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.event.*;
-import net.minecraftforge.event.entity.player.EntityInteractEvent;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.world.WorldEvent;
-import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
@@ -101,13 +98,19 @@ public class NEUEventListener {
JsonObject o = neu.manager.getJsonFromFile(updateJson);
String version = o.get("version").getAsString();
+ String preVersion = o.get("pre_version").getAsString();
boolean shouldUpdate = !NotEnoughUpdates.VERSION.equalsIgnoreCase(version);
+ boolean shouldPreUpdate = !NotEnoughUpdates.PRE_VERSION.equalsIgnoreCase(preVersion);
if(o.has("version_id") && o.get("version_id").isJsonPrimitive()) {
int version_id = o.get("version_id").getAsInt();
shouldUpdate = version_id > NotEnoughUpdates.VERSION_ID;
}
+ if (o.has("pre_version_id") && o.get("pre_version_id").isJsonPrimitive()) {
+ int pre_version_id = o.get("pre_version_id").getAsInt();
+ shouldPreUpdate = pre_version_id > NotEnoughUpdates.PRE_VERSION_ID;
+ }
if(shouldUpdate) {
String update_msg = o.get("update_msg").getAsString();
@@ -134,6 +137,31 @@ public class NEUEventListener {
neu.displayLinks(o);
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
+ } else if (shouldPreUpdate && NotEnoughUpdates.VERSION.equalsIgnoreCase("2.0.0-REL")) {
+ String pre_update_msg = o.get("pre_update_msg").getAsString();
+
+ int first_len = -1;
+ for (String line : pre_update_msg.split("\n")) {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ int len = fr.getStringWidth(line);
+ if (first_len == -1) {
+ first_len = len;
+ }
+ int missing_len = first_len - len;
+ if (missing_len > 0) {
+ StringBuilder sb = new StringBuilder(line);
+ for (int i = 0; i < missing_len / 8; i++) {
+ sb.insert(0, " ");
+ }
+ line = sb.toString();
+ }
+ line = line.replaceAll("\\{pre_version}", preVersion);
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(line));
+ }
+
+ neu.displayLinks(o);
+
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""));
}
} catch(Exception ignored) {}
}
@@ -314,6 +342,7 @@ public class NEUEventListener {
SBGamemodes.loadFromFile();
+
if(NotEnoughUpdates.INSTANCE.config.notifications.showUpdateMsg) {
displayUpdateMessageIfOutOfDate();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index 38925b77..967ef903 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -3,8 +3,6 @@ package io.github.moulberry.notenoughupdates;
import com.google.common.collect.Lists;
import com.google.gson.*;
import io.github.moulberry.notenoughupdates.auction.APIManager;
-import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
-import io.github.moulberry.notenoughupdates.miscgui.GuiItemCustomize;
import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.HypixelApi;
@@ -1170,32 +1168,6 @@ public class NEUManager {
return true;
}
- public boolean uploadItemJson(String internalname, String itemid, String displayname, String[] lore, String crafttext, String infoType, String[] info,
- String clickcommand, int damage, NBTTagCompound nbttag) {
- JsonObject json = createItemJson(internalname, itemid, displayname, lore, crafttext, infoType, info, clickcommand, damage, nbttag);
- if(json == null) {
- return false;
- }
-
- String username = Minecraft.getMinecraft().thePlayer.getName();
- String newBranchName = UUID.randomUUID().toString().substring(0, 8) + "-" + internalname + "-" + username;
- String prTitle = internalname + "-" + username;
- String prBody = "Internal name: " + internalname + "\nSubmitted by: " + username;
- String file = "items/"+internalname+".json";
- /*if(!neuio.createNewRequest(newBranchName, prTitle, prBody, file, gson.toJson(json))) {
- return false;
- }*/
-
- try {
- writeJsonDefaultDir(json, internalname+".json");
- } catch(IOException e) {
- return false;
- }
-
- loadItem(internalname);
- return true;
- }
-
public void writeJson(JsonObject json, File file) throws IOException {
file.createNewFile();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 9e3c863c..bf85a6a6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -71,7 +71,7 @@ public class NEUOverlay extends Gui {
private NEUManager manager;
private String mobRegex = ".*?((_MONSTER)|(_ANIMAL)|(_MINIBOSS)|(_BOSS)|(_SC))$";
- private String petRegex = ".*?;[0-4]$";
+ private String petRegex = ".*?;[0-5]$";
private ResourceLocation[] sortIcons = new ResourceLocation[] {
sort_all, sort_mob, sort_pet, sort_tool, sort_armor, sort_accessory
@@ -1045,7 +1045,7 @@ public class NEUOverlay extends Gui {
EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD.toString()+"EPIC",
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD.toString()+"LEGENDARY",
EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"MYTHIC",
- EnumChatFormatting.LIGHT_PURPLE+EnumChatFormatting.BOLD.toString()+"SPECIAL",
+ EnumChatFormatting.RED+EnumChatFormatting.BOLD.toString()+"SPECIAL",
};
/**
@@ -1272,6 +1272,15 @@ public class NEUOverlay extends Gui {
case "spinaxx":
searchedItems.add(CustomItems.SPINAXX);
break;
+ case "credits":
+ case "credit":
+ case "who made this mod":
+ searchedItems.add(CustomItems.CREDITS);
+ break;
+ case "ironmoon":
+ case "ironm00n":
+ searchedItems.add(CustomItems.IRONM00N);
+ break;
}
this.searchedItems = searchedItems;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index eb53a29a..c638eca6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -90,7 +90,9 @@ import java.util.concurrent.atomic.AtomicInteger;
public class NotEnoughUpdates {
public static final String MODID = "notenoughupdates";
public static final String VERSION = "2.0.0-REL";
+ public static final String PRE_VERSION = "30.2";
public static final int VERSION_ID = 20000;
+ public static final int PRE_VERSION_ID = 3002;
public static NotEnoughUpdates INSTANCE = null;
@@ -311,6 +313,7 @@ public class NotEnoughUpdates {
petRarityToColourMap.put("RARE", EnumChatFormatting.BLUE.toString());
petRarityToColourMap.put("EPIC", EnumChatFormatting.DARK_PURPLE.toString());
petRarityToColourMap.put("LEGENDARY", EnumChatFormatting.GOLD.toString());
+ petRarityToColourMap.put("MYTHIC", EnumChatFormatting.LIGHT_PURPLE.toString());
}
ScheduledExecutorService peekCommandExecutorService = null;
SimpleCommand peekCommand = new SimpleCommand("peek", new SimpleCommand.ProcessCommandRunnable() {
@@ -399,6 +402,7 @@ public class NotEnoughUpdates {
zombie = 2;
spider = 1;
wolf = 2;
+ enderman = 0;
}
EnumChatFormatting combatPrefix = combat>20?(combat>35?EnumChatFormatting.GREEN:EnumChatFormatting.YELLOW):EnumChatFormatting.RED;
@@ -429,7 +433,7 @@ public class NotEnoughUpdates {
wolfPrefix+(int)Math.floor(wolf)+"-"+
endermanPrefix+(int)Math.floor(enderman)));
}
- if(stats == null) {
+ if (stats == null) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
EnumChatFormatting.YELLOW+"Skills, collection and/or inventory apis disabled!"));
} else {
@@ -476,7 +480,7 @@ public class NotEnoughUpdates {
String overall = "Skywars Main";
if(isMe) {
- overall = Utils.chromaString("Literally the best player to exist");
+ 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) {
@@ -829,6 +833,11 @@ public class NotEnoughUpdates {
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;
@@ -958,7 +967,7 @@ public class NotEnoughUpdates {
} catch(Exception ignored) { }
}
- if(!config.hidden.dev) {
+ if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) {
openGui = new GuiDungeonMapEditor();
return;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java
index b33dc888..8c856c95 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java
@@ -82,6 +82,8 @@ public class DevInfoPane extends TextInfoPane {
return text;
}
+ //#region add vanilla items
+
AtomicBoolean running = new AtomicBoolean(false);
ScheduledExecutorService ses = Executors.newScheduledThreadPool(1);
@@ -1060,4 +1062,5 @@ public class DevInfoPane extends TextInfoPane {
}*/
return false;
}
+ //#endregion
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
index 2da81b94..4614a6d3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
@@ -116,23 +116,6 @@ public class NEUItemEditor extends GuiScreen {
}.b;
rightOptions.add(button);
- /*button = new Object() { //Used to make the compiler shut the fuck up
- GuiElementButton b = new GuiElementButton("Upload", Color.YELLOW.getRGB(), new Runnable() {
- public void run() {
- if(b.getText().equals("Upload")) {
- b.setText("Confirm upload?");
- } else {
- if(upload()) {
- b.setText("Uploaded");
- } else {
- b.setText("Upload failed.");
- }
- }
- }
- });
- }.b;
- rightOptions.add(button);*/
-
rightOptions.add(new GuiElementText("", Color.WHITE.getRGB()));
rightOptions.add(new GuiElementButton("Remove enchants", Color.RED.getRGB(), () -> {
@@ -160,20 +143,6 @@ public class NEUItemEditor extends GuiScreen {
crafttext.get(), infoType.get(), infoA, clickcommand.get(), damageI, nbttag);
}
- /*public boolean upload() {
- int damageI = 0;
- try {
- damageI = Integer.valueOf(damage.get());
- } catch(NumberFormatException e) {}
- resyncNbttag();
- String[] infoA = info.get().trim().split("\n");
- if(infoA.length == 0 || infoA[0].isEmpty()) {
- infoA = new String[0];
- }
- return manager.uploadItemJson(internalname.get(), itemid.get(), displayname.get(), lore.get().split("\n"),
- crafttext.get(), infoType.get(), infoA, clickcommand.get(), damageI, nbttag);
- }*/
-
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
}
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 db0eac09..449b642b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -1,3005 +1,3007 @@
-package io.github.moulberry.notenoughupdates.profileviewer;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
-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.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
-import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
-import io.github.moulberry.notenoughupdates.util.SBInfo;
-import io.github.moulberry.notenoughupdates.util.Constants;
-import io.github.moulberry.notenoughupdates.util.Utils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityOtherPlayerMP;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.*;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.resources.DefaultPlayerSkin;
-import net.minecraft.client.resources.SkinManager;
-import net.minecraft.client.shader.Framebuffer;
-import net.minecraft.client.shader.Shader;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EnumPlayerModelParts;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.*;
-import net.minecraft.util.*;
-import org.apache.commons.lang3.text.WordUtils;
-import org.lwjgl.input.Keyboard;
-import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL14;
-import org.lwjgl.opengl.GL20;
-
-import java.awt.*;
-import java.io.IOException;
-import java.text.NumberFormat;
-import java.util.*;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class GuiProfileViewer extends GuiScreen {
-
- private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png");
- public static final ResourceLocation pv_basic = new ResourceLocation("notenoughupdates:pv_basic.png");
- public static final ResourceLocation pv_dung = new ResourceLocation("notenoughupdates:pv_dung.png");
- public static final ResourceLocation pv_extra = new ResourceLocation("notenoughupdates:pv_extra.png");
- public static final ResourceLocation pv_invs = new ResourceLocation("notenoughupdates:pv_invs.png");
- public static final ResourceLocation pv_cols = new ResourceLocation("notenoughupdates:pv_cols.png");
- public static final ResourceLocation pv_pets = new ResourceLocation("notenoughupdates:pv_pets.png");
- public static final ResourceLocation pv_dropdown = new ResourceLocation("notenoughupdates:pv_dropdown.png");
- public static final ResourceLocation pv_bg = new ResourceLocation("notenoughupdates:pv_bg.png");
- public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png");
- public static final ResourceLocation resource_packs = new ResourceLocation("minecraft:textures/gui/resource_packs.png");
- public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png");
-
- private static final NumberFormat numberFormat = NumberFormat.getInstance(Locale.US);
-
- private final ProfileViewer.Profile profile;
- public static ProfileViewerPage currentPage = ProfileViewerPage.BASIC;
- private int sizeX;
- private int sizeY;
- private int guiLeft;
- private int guiTop;
-
- private float backgroundRotation = 0;
-
- private long currentTime = 0;
- private long lastTime = 0;
- private long startTime = 0;
-
- private List<String> tooltipToDisplay = null;
-
- private String profileId = null;
- private boolean profileDropdownSelected = false;
-
- public enum ProfileViewerPage {
- LOADING(null),
- INVALID_NAME(null),
- NO_SKYBLOCK(null),
- BASIC(new ItemStack(Items.paper)),
- DUNG(new ItemStack(Item.getItemFromBlock(Blocks.deadbush))),
- EXTRA(new ItemStack(Items.book)),
- INVS(new ItemStack(Item.getItemFromBlock(Blocks.ender_chest))),
- COLS(new ItemStack(Items.painting)),
- PETS(new ItemStack(Items.bone));
-
- public final ItemStack stack;
-
- ProfileViewerPage(ItemStack stack) {
- this.stack = stack;
- }
- }
-
- public GuiProfileViewer(ProfileViewer.Profile profile) {
- this.profile = profile;
- String name = "";
- if(profile != null && profile.getHypixelProfile() != null) {
- name = profile.getHypixelProfile().get("displayname").getAsString();
- }
- playerNameTextField = new GuiElementTextField(name,
- GuiElementTextField.SCALE_TEXT);
- playerNameTextField.setSize(100, 20);
-
- if(currentPage == ProfileViewerPage.LOADING) {
- currentPage = ProfileViewerPage.BASIC;
- }
- }
-
- private GuiElementTextField playerNameTextField;
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- currentTime = System.currentTimeMillis();
- if(startTime == 0) startTime = currentTime;
-
- ProfileViewerPage page = currentPage;
- if(profile == null) {
- page = ProfileViewerPage.INVALID_NAME;
- } else if(profile.getPlayerInformation(null) == null) {
- page = ProfileViewerPage.LOADING;
- } else if(profile.getLatestProfile() == null) {
- page = ProfileViewerPage.NO_SKYBLOCK;
- }
-
- if(profileId == null && profile != null && profile.getLatestProfile() != null) {
- profileId = profile.getLatestProfile();
- }
-
- this.sizeX = 431;
- this.sizeY = 202;
- this.guiLeft = (this.width-this.sizeX)/2;
- this.guiTop = (this.height-this.sizeY)/2;
-
- super.drawScreen(mouseX, mouseY, partialTicks);
- drawDefaultBackground();
-
- blurBackground();
- renderBlurredBackground(width, height, guiLeft+2, guiTop+2, sizeX-4, sizeY-4);
-
- GlStateManager.enableDepth();
- GlStateManager.translate(0, 0, 5);
- renderTabs(true);
- GlStateManager.translate(0, 0, -3);
-
- GlStateManager.disableDepth();
- GlStateManager.translate(0, 0, -2);
- renderTabs(false);
- GlStateManager.translate(0, 0, 2);
-
- GlStateManager.disableLighting();
- GlStateManager.enableDepth();
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.enableAlpha();
- GlStateManager.alphaFunc(516, 0.1F);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(pv_bg);
- Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST);
-
- if(!(page == ProfileViewerPage.LOADING)) {
- playerNameTextField.render(guiLeft+sizeX-100, guiTop+sizeY+5);
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
-
- if(profile != null) {
- renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+3+2, 100-4, 20-4);
- Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown);
- Utils.drawTexturedRect(guiLeft, guiTop+sizeY+3, 100, 20,
- 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST);
- Utils.drawStringCenteredScaledMaxWidth(profileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50,
- guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB());
-
- if(profileDropdownSelected && !profile.getProfileIds().isEmpty() && scaledResolution.getScaleFactor() != 4) {
- int dropdownOptionSize = scaledResolution.getScaleFactor()==3?10:20;
-
- int numProfiles = profile.getProfileIds().size();
- int sizeYDropdown = numProfiles*dropdownOptionSize;
- renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+23, 100-4, sizeYDropdown-2);
- Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown);
- Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23-3, 100, 3,
- 100/200f, 1, 0, 3/185f, GL11.GL_NEAREST);
- Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23+sizeYDropdown-4, 100, 4,
- 100/200f, 1, 181/185f, 1, GL11.GL_NEAREST);
- Utils.drawTexturedRect(guiLeft, guiTop+sizeY+23, 100, sizeYDropdown-4,
- 100/200f, 1, (181-sizeYDropdown)/185f, 181/185f, GL11.GL_NEAREST);
-
- for(int yIndex = 0; yIndex<profile.getProfileIds().size(); yIndex++) {
- String otherProfileId = profile.getProfileIds().get(yIndex);
- Utils.drawStringCenteredScaledMaxWidth(otherProfileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50,
- guiTop+sizeY+23+dropdownOptionSize/2f+dropdownOptionSize*yIndex, true, 90, new Color(33, 112, 104, 255).getRGB());
- }
-
- }
- }
- }
-
- GlStateManager.color(1, 1, 1, 1);
- switch (page) {
- case BASIC:
- drawBasicPage(mouseX, mouseY, partialTicks);
- break;
- case DUNG:
- drawDungPage(mouseX, mouseY, partialTicks);
- break;
- case EXTRA:
- drawExtraPage(mouseX, mouseY, partialTicks);
- break;
- case INVS:
- drawInvsPage(mouseX, mouseY, partialTicks);
- break;
- case COLS:
- drawColsPage(mouseX, mouseY, partialTicks);
- break;
- case PETS:
- drawPetsPage(mouseX, mouseY, partialTicks);
- break;
- case LOADING:
- String str = EnumChatFormatting.YELLOW+"Loading player profiles.";
- long currentTimeMod = System.currentTimeMillis() % 1000;
- if(currentTimeMod > 333) {
- if(currentTimeMod < 666) {
- str += ".";
- } else {
- str += "..";
- }
- }
-
- Utils.drawStringCentered(str, Minecraft.getMinecraft().fontRendererObj,
- guiLeft+sizeX/2f, guiTop+101, true, 0);
- break;
- case INVALID_NAME:
- Utils.drawStringCentered(EnumChatFormatting.RED+"Invalid name or API is down!", Minecraft.getMinecraft().fontRendererObj,
- guiLeft+sizeX/2f, guiTop+101, true, 0);
- break;
- case NO_SKYBLOCK:
- Utils.drawStringCentered(EnumChatFormatting.RED+"No skyblock data found!", Minecraft.getMinecraft().fontRendererObj,
- guiLeft+sizeX/2f, guiTop+101, true, 0);
- break;
- }
-
- lastTime = currentTime;
-
- if(tooltipToDisplay != null) {
- List<String> grayTooltip = new ArrayList<>(tooltipToDisplay.size());
- for(String line : tooltipToDisplay) {
- grayTooltip.add(EnumChatFormatting.GRAY + line);
- }
- Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj);
- tooltipToDisplay = null;
- }
- }
-
- private void renderTabs(boolean renderPressed) {
- int ignoredTabs = 0;
- for(int i=0; i<ProfileViewerPage.values().length; i++) {
- ProfileViewerPage page = ProfileViewerPage.values()[i];
- if(page.stack == null) {
- ignoredTabs++;
- continue;
- }
- boolean pressed = page == currentPage;
- if(pressed == renderPressed) {
- renderTab(page.stack, i-ignoredTabs, pressed);
- }
- }
- }
-
- private void renderTab(ItemStack stack, int xIndex, boolean pressed) {
- GlStateManager.disableLighting();
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.enableAlpha();
- GlStateManager.alphaFunc(516, 0.1F);
-
- int x = guiLeft+xIndex*28;
- int y = guiTop-28;
-
- float uMin = 0;
- float uMax = 28/256f;