aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-08-19 12:16:12 +1000
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-08-19 12:16:12 +1000
commitea1391e0c6f0db863bbb61511eb6e9acb57a5968 (patch)
tree16e0b8a76055838b6cc1963f56c1327cd8850c66 /src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
parent0c23f52d2be811d74a3b6ef598dd9de7ccb763ab (diff)
downloadnotenoughupdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.tar.gz
notenoughupdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.tar.bz2
notenoughupdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.zip
1.1.5
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
index 3780db3d..817c9e96 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
@@ -1,6 +1,7 @@
package io.github.moulberry.notenoughupdates.auction;
import io.github.moulberry.notenoughupdates.NEUManager;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -405,13 +406,12 @@ public class CustomAH extends Gui {
return -1;
}
- public String findEndsInStr(ItemStack stack) {
+ public String findStrStart(ItemStack stack, String toFind) {
if(stack.hasTagCompound()) {
//ยง7Ends in:
- String endsIn = EnumChatFormatting.GRAY+"Ends in: ";
for(String line : manager.getLoreFromNBT(stack.getTagCompound())) {
- if(line.trim().startsWith(endsIn)) {
- return line.substring(endsIn.length());
+ if(line.trim().startsWith(toFind)) {
+ return line.substring(toFind.length());
}
}
}
@@ -419,6 +419,10 @@ public class CustomAH extends Gui {
return null;
}
+ public String findEndsInStr(ItemStack stack) {
+ return findStrStart(stack, EnumChatFormatting.GRAY+"Ends in: ");
+ }
+
public void drawScreen(int mouseX, int mouseY) {
if(System.currentTimeMillis() - lastOpen < 1000) Mouse.setGrabbed(false);
@@ -522,7 +526,11 @@ public class CustomAH extends Gui {
if(mouseX > auctionViewLeft+31 && mouseX <auctionViewLeft+31+16) {
if(mouseY > guiTop+35 && mouseY < guiTop+35+16) {
- if(topStack != null) tooltipToRender = topStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ if(topStack != null) {
+ tooltipToRender = topStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ tooltipToRender.add("");
+ tooltipToRender.add(EnumChatFormatting.YELLOW+"Click to copy seller name!");
+ }
} else if(mouseY > guiTop+100 && mouseY < guiTop+100+16) {
if(leftStack != null) tooltipToRender = leftStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
} else if(mouseY > guiTop+61 && mouseY < guiTop+61+16) {
@@ -916,11 +924,13 @@ public class CustomAH extends Gui {
mouseClickMove(mouseX, mouseY, this.eventButton, l);
}
- int dWheel = Mouse.getEventDWheel();
- dWheel = Math.max(-1, Math.min(1, dWheel));
+ if(!manager.config.disableAhScroll.value) {
+ int dWheel = Mouse.getEventDWheel();
+ dWheel = Math.max(-1, Math.min(1, dWheel));
- scrollAmount = scrollAmount - dWheel/(float)(auctionIds.size()/9-(5+splits));
- scrollAmount = Math.max(0, Math.min(1, scrollAmount));
+ scrollAmount = scrollAmount - dWheel/(float)(auctionIds.size()/9-(5+splits));
+ scrollAmount = Math.max(0, Math.min(1, scrollAmount));
+ }
}
private String niceAucId(String aucId) {
@@ -1362,7 +1372,16 @@ public class CustomAH extends Gui {
if(containerName.trim().equals("Auction View") || containerName.trim().equals("BIN Auction View")) {
if(mouseX > guiLeft+getXSize()+4+31 && mouseX < guiLeft+getXSize()+4+31+16) {
boolean leftFiller = isGuiFiller(auctionView.inventorySlots.getSlot(29).getStack());//isBin
- if(mouseY > guiTop+100 && mouseY < guiTop+100+16) {
+ if(mouseY > guiTop+35 && mouseY < guiTop+35+16) {
+ ItemStack topStack = auctionView.inventorySlots.getSlot(13).getStack();
+ if(topStack != null) {
+ String line = findStrStart(topStack, EnumChatFormatting.GRAY+"Seller: ");
+ String[] split = line.split(" ");
+ String seller = split[split.length-1];
+ StringSelection selection = new StringSelection(seller);
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, selection);
+ }
+ } else if(mouseY > guiTop+100 && mouseY < guiTop+100+16) {
int slotClick = leftFiller ? 31 : 29;
Minecraft.getMinecraft().playerController.windowClick(auctionView.inventorySlots.windowId,
slotClick, 2, 3, Minecraft.getMinecraft().thePlayer);