Skip to content

Commit 089bac8

Browse files
author
Moulberry
committed
1.7
1 parent 07403ec commit 089bac8

49 files changed

Lines changed: 2506 additions & 226 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ apply plugin: 'com.github.johnrengelman.shadow'
1919
sourceCompatibility = 1.8
2020
targetCompatibility = 1.8
2121

22-
version = "1.5-REL"
22+
version = "1.7-REL"
2323
group= "io.github.moulberry"
2424
archivesBaseName = "NotEnoughUpdates"
2525
String modid = "notenoughupdates"

src/main/java/io/github/moulberry/notenoughupdates/BetterContainers.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,17 @@ public static boolean getUsingCache() {
102102
return usingCached && System.currentTimeMillis() - lastRenderMillis < 300;
103103
}
104104

105-
public static boolean isAh() {
105+
public static boolean isBlacklistedInventory() {
106106
if(!isChestOpen()) return false;
107107

108108
GuiChest eventGui = (GuiChest) Minecraft.getMinecraft().currentScreen;
109109
ContainerChest cc = (ContainerChest) eventGui.inventorySlots;
110110
String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText();
111-
return containerName.trim().startsWith("Auctions Browser") || containerName.trim().startsWith("Wardrobe");
111+
return containerName.toLowerCase().trim().startsWith("navigate the maze");
112112
}
113113

114114
public static boolean isOverriding() {
115-
return isChestOpen() && ((loaded && texture != null));
115+
return isChestOpen() && ((loaded && texture != null)) && !isBlacklistedInventory();
116116
}
117117

118118
public static boolean isBlankStack(ItemStack stack) {
@@ -171,7 +171,6 @@ private static void generateTex(ResourceLocation location) {
171171
textColour = (int)Long.parseLong(textColourS, 16);
172172
} catch(Exception e) {
173173
textColour = 4210752;
174-
e.printStackTrace();
175174
}
176175

177176
try {

src/main/java/io/github/moulberry/notenoughupdates/CalendarOverlay.java

Lines changed: 1414 additions & 0 deletions
Large diffs are not rendered by default.

src/main/java/io/github/moulberry/notenoughupdates/CustomItemEffects.java

Lines changed: 301 additions & 56 deletions
Large diffs are not rendered by default.

src/main/java/io/github/moulberry/notenoughupdates/GuiTextures.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ private GuiTextures() {} //Not instantiable. Use import static to access class m
1919
public static final ResourceLocation help = new ResourceLocation("notenoughupdates:help.png");
2020
public static final ResourceLocation slider_off = new ResourceLocation("notenoughupdates:slider_off.png");
2121
public static final ResourceLocation slider_on = new ResourceLocation("notenoughupdates:slider_on.png");
22+
public static final ResourceLocation slider_off_large = new ResourceLocation("notenoughupdates:slider_off_large.png");
23+
public static final ResourceLocation slider_on_large = new ResourceLocation("notenoughupdates:slider_on_large.png");
2224
public static final ResourceLocation slider_button = new ResourceLocation("notenoughupdates:slider_button.png");
2325

2426
public static final ResourceLocation item_mask = new ResourceLocation("notenoughupdates:item_mask.png");

src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java

Lines changed: 118 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
import net.minecraft.client.gui.inventory.GuiContainer;
2424
import net.minecraft.client.gui.inventory.GuiCrafting;
2525
import net.minecraft.client.gui.inventory.GuiEditSign;
26+
import net.minecraft.client.network.NetworkPlayerInfo;
2627
import net.minecraft.client.renderer.GlStateManager;
28+
import net.minecraft.entity.player.EntityPlayer;
2729
import net.minecraft.event.ClickEvent;
2830
import net.minecraft.init.Blocks;
2931
import net.minecraft.inventory.ContainerChest;
@@ -35,7 +37,9 @@
3537
import net.minecraft.util.ChatComponentText;
3638
import net.minecraft.util.EnumChatFormatting;
3739
import net.minecraftforge.client.event.*;
40+
import net.minecraftforge.event.entity.player.EntityInteractEvent;
3841
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
42+
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
3943
import net.minecraftforge.fml.common.Loader;
4044
import net.minecraftforge.fml.common.eventhandler.EventPriority;
4145
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -180,16 +184,18 @@ public void onTick(TickEvent.ClientTickEvent event) {
180184
displayUpdateMessageIfOutOfDate();
181185
}
182186

183-
long maxMemoryMB = Runtime.getRuntime().maxMemory()/1024L/1024L;
184-
if(maxMemoryMB > 4100) {
185-
notificationDisplayMillis = System.currentTimeMillis();
186-
notificationLines = new ArrayList<>();
187-
notificationLines.add(EnumChatFormatting.DARK_RED+"Too much memory allocated!");
188-
notificationLines.add(String.format(EnumChatFormatting.DARK_GRAY+"NEU has detected %03dMB of memory allocated to Minecraft!", maxMemoryMB));
189-
notificationLines.add(EnumChatFormatting.DARK_GRAY+"It is recommended to allocated between 2-4GB of memory");
190-
notificationLines.add(EnumChatFormatting.DARK_GRAY+"More than 4GB WILL cause FPS issues, EVEN if you have 16GB+ available");
191-
notificationLines.add("");
192-
notificationLines.add(EnumChatFormatting.DARK_GRAY+"For more information, visit #ram-info in discord.gg/spr6ESn");
187+
if(NotEnoughUpdates.INSTANCE.manager.config.doRamNotif.value) {
188+
long maxMemoryMB = Runtime.getRuntime().maxMemory()/1024L/1024L;
189+
if(maxMemoryMB > 4100) {
190+
notificationDisplayMillis = System.currentTimeMillis();
191+
notificationLines = new ArrayList<>();
192+
notificationLines.add(EnumChatFormatting.DARK_RED+"Too much memory allocated!");
193+
notificationLines.add(String.format(EnumChatFormatting.DARK_GRAY+"NEU has detected %03dMB of memory allocated to Minecraft!", maxMemoryMB));
194+
notificationLines.add(EnumChatFormatting.DARK_GRAY+"It is recommended to allocated between 2-4GB of memory");
195+
notificationLines.add(EnumChatFormatting.DARK_GRAY+"More than 4GB WILL cause FPS issues, EVEN if you have 16GB+ available");
196+
notificationLines.add("");
197+
notificationLines.add(EnumChatFormatting.DARK_GRAY+"For more information, visit #ram-info in discord.gg/spr6ESn");
198+
}
193199
}
194200

195201
if(!neu.manager.config.loadedModBefore.value) {
@@ -358,6 +364,10 @@ public void onRenderGameOverlay(RenderGameOverlayEvent event) {
358364
AtomicBoolean missingRecipe = new AtomicBoolean(false);
359365
@SubscribeEvent
360366
public void onGuiOpen(GuiOpenEvent event) {
367+
if(!(event.gui instanceof GuiContainer) && Minecraft.getMinecraft().currentScreen != null) {
368+
CalendarOverlay.setEnabled(false);
369+
}
370+
361371
neu.manager.auctionManager.customAH.lastGuiScreenSwitch = System.currentTimeMillis();
362372
BetterContainers.reset();
363373

@@ -493,6 +503,24 @@ public void onGuiOpen(GuiOpenEvent event) {
493503
}
494504
}
495505

506+
@SubscribeEvent
507+
public void onPlayerInteract(EntityInteractEvent event) {
508+
if(!event.isCanceled() && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() &&
509+
Minecraft.getMinecraft().thePlayer.isSneaking() &&
510+
Minecraft.getMinecraft().ingameGUI != null) {
511+
if(event.target instanceof EntityPlayer) {
512+
for(NetworkPlayerInfo info : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) {
513+
String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info);
514+
if(name.contains("Status: "+EnumChatFormatting.RESET+EnumChatFormatting.BLUE+"Guest")) {
515+
NotEnoughUpdates.INSTANCE.sendChatMessage("/trade " + event.target.getName());
516+
event.setCanceled(true);
517+
break;
518+
}
519+
}
520+
}
521+
}
522+
}
523+
496524
/**
497525
* 1) When receiving "You are playing on profile" messages, will set the current profile.
498526
* 2) When a /viewrecipe command fails (i.e. player does not have recipe unlocked, will open the custom recipe GUI)
@@ -665,12 +693,14 @@ public void onGuiScreenDrawPost(GuiScreenEvent.DrawScreenEvent.Post event) {
665693
if(!(TradeWindow.tradeWindowActive() || event.gui instanceof CustomAHGui ||
666694
neu.manager.auctionManager.customAH.isRenderOverAuctionView())) {
667695
if(shouldRenderOverlay(event.gui) && neu.isOnSkyblock()) {
696+
GlStateManager.pushMatrix();
668697
if(!focusInv) {
669698
GL11.glTranslatef(0, 0, 300);
670699
neu.overlay.render(hoverInv && focusInv);
671700
GL11.glTranslatef(0, 0, -300);
672701
}
673702
neu.overlay.renderOverlay();
703+
GlStateManager.popMatrix();
674704
}
675705
}
676706
}
@@ -727,7 +757,10 @@ private void renderDungeonChestOverlay(GuiScreen gui) {
727757
worthBIN = bazaarPrice;
728758
worthAUC = bazaarPrice;
729759
} else {
730-
worthBIN = neu.manager.auctionManager.getLowestBin(internal);
760+
worthBIN = neu.manager.auctionManager.getItemAvgBin(internal);
761+
if(worthBIN <= 0) {
762+
worthBIN = neu.manager.auctionManager.getLowestBin(internal);
763+
}
731764
JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
732765
if(aucInfo != null) {
733766
worthAUC = aucInfo.get("price").getAsFloat();
@@ -1250,7 +1283,50 @@ public void onItemTooltipLow(ItemTooltipEvent event) {
12501283
if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && !Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
12511284
newTooltip.add(EnumChatFormatting.GRAY+"[SHIFT for Price Info]");
12521285
} else {
1253-
JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
1286+
JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internalname);
1287+
float lowestBinAvg = neu.manager.auctionManager.getItemAvgBin(internalname);
1288+
1289+
int lowestBin = neu.manager.auctionManager.getLowestBin(internalname);
1290+
APIManager.CraftInfo craftCost = neu.manager.auctionManager.getCraftCost(internalname);
1291+
1292+
boolean hasAuctionPrice = auctionInfo != null;
1293+
boolean hasLowestBinPrice = lowestBin > 0 && neu.manager.config.advancedPriceInfo.value;
1294+
boolean hasLowestBinAvgPrice = lowestBinAvg > 0;
1295+
1296+
NumberFormat format = NumberFormat.getInstance(Locale.US);
1297+
1298+
if(hasLowestBinPrice) {
1299+
newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+
1300+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins");
1301+
}
1302+
if(hasLowestBinAvgPrice) {
1303+
newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+
1304+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins");
1305+
}
1306+
if(hasAuctionPrice) {
1307+
int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
1308+
newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+
1309+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionPrice)+" coins");
1310+
if(neu.manager.config.advancedPriceInfo.value) {
1311+
newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales: "+
1312+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("sales").getAsFloat())+" sales/day");
1313+
}
1314+
if(auctionInfo.has("clean_price")) {
1315+
newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price (Clean): "+
1316+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)auctionInfo.get("clean_price").getAsFloat())+" coins");
1317+
if(neu.manager.config.advancedPriceInfo.value) {
1318+
newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Sales (Clean): "+
1319+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(auctionInfo.get("clean_sales").getAsFloat())+" sales/day");
1320+
}
1321+
}
1322+
1323+
}
1324+
if(hasAuctionPrice && craftCost.fromRecipe) {
1325+
newTooltip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Raw Craft Cost: "+
1326+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format((int)craftCost.craftCost)+" coins");
1327+
}
1328+
1329+
/*JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname);
12541330
12551331
boolean hasAuctionPrice = auctionInfo != null;
12561332
@@ -1280,7 +1356,7 @@ public void onItemTooltipLow(ItemTooltipEvent event) {
12801356
if(craftCost.fromRecipe) {
12811357
newTooltip.add(EnumChatFormatting.GRAY+"Raw Craft Cost: "+
12821358
EnumChatFormatting.GOLD+format.format((int)craftCost.craftCost)+" coins");
1283-
}
1359+
}*/
12841360
}
12851361
}
12861362
}
@@ -1314,10 +1390,28 @@ public void onItemTooltipLow(ItemTooltipEvent event) {
13141390
ItemStack item = lower.getStackInSlot(11+i);
13151391
String internal = neu.manager.getInternalNameForItem(item);
13161392
if(internal != null) {
1317-
float worthBIN = neu.manager.auctionManager.getLowestBin(internal);
1318-
float worthAUC = neu.manager.auctionManager.getLowestBin(internal);
1393+
float bazaarPrice = -1;
1394+
JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(internal);
1395+
if(bazaarInfo != null && bazaarInfo.has("avg_sell")) {
1396+
bazaarPrice = bazaarInfo.get("avg_sell").getAsFloat();
1397+
}
1398+
1399+
float worthBIN = -1;
1400+
float worthAUC = -1;
13191401

1320-
if(worthAUC == -1) worthAUC = neu.manager.auctionManager.getCraftCost(internal).craftCost;
1402+
if(bazaarPrice > 0) {
1403+
worthBIN = bazaarPrice;
1404+
worthAUC = bazaarPrice;
1405+
} else {
1406+
worthBIN = neu.manager.auctionManager.getItemAvgBin(internal);
1407+
if(worthBIN <= 0) {
1408+
worthBIN = neu.manager.auctionManager.getLowestBin(internal);
1409+
}
1410+
JsonObject aucInfo = neu.manager.auctionManager.getItemAuctionInfo(internal);
1411+
if(aucInfo != null) {
1412+
worthAUC = aucInfo.get("price").getAsFloat();
1413+
}
1414+
}
13211415

13221416
if(worthAUC <= 0 && worthBIN <= 0) {
13231417
missing = true;
@@ -1392,21 +1486,27 @@ public void onItemTooltipLow(ItemTooltipEvent event) {
13921486
if(internalname != null) {
13931487
JsonObject auctionInfo = neu.manager.auctionManager.getItemAuctionInfo(internalname);
13941488
JsonObject bazaarInfo = neu.manager.auctionManager.getBazaarInfo(internalname);
1489+
float lowestBinAvg = neu.manager.auctionManager.getItemAvgBin(internalname);
13951490

13961491
int lowestBin = neu.manager.auctionManager.getLowestBin(internalname);
13971492
APIManager.CraftInfo craftCost = neu.manager.auctionManager.getCraftCost(internalname);
13981493

13991494
boolean hasAuctionPrice = neu.manager.config.invAuctionPrice.value && auctionInfo != null;
14001495
boolean hasBazaarPrice = neu.manager.config.invBazaarPrice.value && bazaarInfo != null;
1401-
boolean hasLowestBinPrice = neu.manager.config.invAuctionPrice.value && lowestBin > 0;
1496+
boolean hasLowestBinPrice = neu.manager.config.invAuctionPrice.value && lowestBin > 0 && neu.manager.config.advancedPriceInfo.value;
1497+
boolean hasLowestBinAvgPrice = neu.manager.config.invAuctionPrice.value && lowestBinAvg > 0;
14021498

14031499
NumberFormat format = NumberFormat.getInstance(Locale.US);
14041500

1405-
if(hasAuctionPrice || hasBazaarPrice || hasLowestBinPrice) event.toolTip.add("");
1501+
if(hasAuctionPrice || hasBazaarPrice || hasLowestBinAvgPrice || hasLowestBinPrice) event.toolTip.add("");
14061502
if(hasLowestBinPrice) {
14071503
event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"Lowest BIN: "+
14081504
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBin)+" coins");
14091505
}
1506+
if(hasLowestBinAvgPrice) {
1507+
event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AVG Lowest BIN: "+
1508+
EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+format.format(lowestBinAvg)+" coins");
1509+
}
14101510
if(hasAuctionPrice) {
14111511
int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat());
14121512
event.toolTip.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"AH Price: "+

0 commit comments

Comments
 (0)