aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java52
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java2
7 files changed, 52 insertions, 20 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index c3cb4a73..90065ffe 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,12 +98,18 @@ 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();
@@ -133,6 +136,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,7 +342,7 @@ public class NEUEventListener {
SBGamemodes.loadFromFile();
if(neu.config.notifications.showUpdateMsg) {
- displayUpdateMessageIfOutOfDate();
+ this.displayUpdateMessageIfOutOfDate();
}
if(neu.config.notifications.doRamNotif) {
@@ -571,7 +599,7 @@ public class NEUEventListener {
&& event.gui instanceof GuiContainer) {
neu.overlay.reset();
}
- if(event.gui != null && neu.config.hidden.dev) {
+ if(event.gui != null && NotEnoughUpdates.INSTANCE.config.hidden.dev) {
if(event.gui instanceof GuiChest) {
GuiChest eventGui = (GuiChest) event.gui;
ContainerChest cc = (ContainerChest) eventGui.inventorySlots;
@@ -1473,7 +1501,7 @@ public class NEUEventListener {
event.setCanceled(true);
}
}
- if(neu.config.hidden.dev && neu.config.hidden.enableItemEditing && Minecraft.getMinecraft().theWorld != null &&
+ if(NotEnoughUpdates.INSTANCE.config.hidden.dev && NotEnoughUpdates.INSTANCE.config.hidden.enableItemEditing && Minecraft.getMinecraft().theWorld != null &&
Keyboard.getEventKey() == Keyboard.KEY_N && Keyboard.getEventKeyState()) {
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if(gui instanceof GuiChest) {
@@ -1529,7 +1557,7 @@ public class NEUEventListener {
System.out.println(essenceJson);
}
}
- if(neu.config.hidden.dev && neu.config.hidden.enableItemEditing && Minecraft.getMinecraft().theWorld != null &&
+ if(NotEnoughUpdates.INSTANCE.config.hidden.dev && NotEnoughUpdates.INSTANCE.config.hidden.enableItemEditing && Minecraft.getMinecraft().theWorld != null &&
Keyboard.getEventKey() == Keyboard.KEY_O && Keyboard.getEventKeyState()) {
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if(gui instanceof GuiChest) {
@@ -2268,7 +2296,7 @@ public class NEUEventListener {
}
}
}*/
- if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && neu.config.hidden.dev &&
+ if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && NotEnoughUpdates.INSTANCE.config.hidden.dev &&
event.toolTip.size()>0&&event.toolTip.get(event.toolTip.size()-1).startsWith(EnumChatFormatting.DARK_GRAY + "NBT: ")) {
event.toolTip.remove(event.toolTip.size()-1);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index 181b9225..90025881 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -66,7 +66,7 @@ public class NEUManager {
private ExecutorService repoLoaderES = Executors.newSingleThreadExecutor();
- private static final String GIT_COMMITS_URL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master";
+ private static String GIT_COMMITS_URL;
private HashMap<String, Set<String>> usagesMap = new HashMap<>();
@@ -80,6 +80,7 @@ public class NEUManager {
this.neu = neu;
this.configLocation = configLocation;
this.auctionManager = new APIManager(this);
+ GIT_COMMITS_URL = neu.config.hidden.repoCommitsURL;
gson = new GsonBuilder().setPrettyPrinting().create();
@@ -188,8 +189,7 @@ public class NEUManager {
Utils.recursiveDelete(repoLocation);
repoLocation.mkdirs();
- //TODO: Store hard-coded value somewhere else
- String dlUrl = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip";
+ String dlUrl = neu.config.hidden.repoURL;
pane.setMessage("Downloading NEU Master Archive. (DL# >20)");
dialog.pack();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index cfab28e0..f6202cc3 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;
@@ -952,7 +954,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 22427cee..0489dd42 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/DevInfoPane.java
@@ -588,7 +588,7 @@ public class DevInfoPane extends TextInfoPane {
ItemStack stack = null;
if(i < shapeless.getRecipeSize()) {
- Object o = shapeless.getInput().get(i);;
+ Object o = shapeless.getInput().get(i);
if(o instanceof ItemStack) {
stack = (ItemStack) o;
} else if(o instanceof List<?>) {
@@ -829,7 +829,7 @@ public class DevInfoPane extends TextInfoPane {
ItemStack stack = null;
if(i < shapeless.getRecipeSize()) {
- Object o = shapeless.getInput().get(i);;
+ Object o = shapeless.getInput().get(i);
if(o instanceof ItemStack) {
stack = (ItemStack) o;
} else if(o instanceof List<?>) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index 58deef74..22d5e32f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -284,6 +284,8 @@ public class NEUConfig extends Config {
"Life Steal:\u003e:3:5:0",
"Scavenger:\u003e:3:5:0",
"Looting:\u003e:3:5:0");
+ @Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip";
+ @Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master";
}
private static ArrayList<String> createDefaultQuickCommands() {
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 af4c354c..f66a0783 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -2396,7 +2396,7 @@ public class GuiProfileViewer extends GuiScreen {
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"));;
+ Utils.getElementAsString(profile.getHypixelProfile().get("newPackageRank"), "NONE"));
String monthlyPackageRank = Utils.getElementAsString(profile.getHypixelProfile().get("monthlyPackageRank"), "NONE");
if(!rank.equals("YOUTUBER") && !monthlyPackageRank.equals("NONE")) {
rank = monthlyPackageRank;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
index fc5d3e38..20219ff6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
@@ -70,7 +70,7 @@ public class XPInformation {
if(matcher.matches()) {
String skillS = matcher.group(2);
String currentXpS = matcher.group(3).replace(",","");
- String maxXpS = matcher.group(4).replace(",","");;
+ String maxXpS = matcher.group(4).replace(",","");
float currentXp = Float.parseFloat(currentXpS);
float maxXp = Float.parseFloat(maxXpS);