aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorGrowlingGrizzly <52770460+GrowlingGrizzly@users.noreply.github.com>2024-04-10 03:10:29 -0400
committerGitHub <noreply@github.com>2024-04-10 09:10:29 +0200
commitb04290ede8420e8ef9b56f2c8a9252224b8f1d2d (patch)
tree1ad2aa5ba74a943937c6e01bce0290f2c41e7291 /src/main/java/io
parentd308b5a3927232d668e836d669acd547977c8554 (diff)
downloadNotEnoughUpdates-b04290ede8420e8ef9b56f2c8a9252224b8f1d2d.tar.gz
NotEnoughUpdates-b04290ede8420e8ef9b56f2c8a9252224b8f1d2d.tar.bz2
NotEnoughUpdates-b04290ede8420e8ef9b56f2c8a9252224b8f1d2d.zip
Add stored amount for bazaar price in composter (#1074)
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
index cd756a88..9a43db0b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java
@@ -61,6 +61,9 @@ public class ItemPriceInformation {
private static final Pattern SACK_STORED_AMOUNT = Pattern.compile(
".*Stored: §.(?<amount>[\\d,]+)§.\\/.*");
+ private static final Pattern COMPOSTER_STORED_AMOUNT = Pattern.compile(
+ ".*Compost Available: §.(?<amount>[\\d,]+)");
+
public static void addToTooltip(List<String> tooltip, String internalName, ItemStack stack) {
addToTooltip(tooltip, internalName, stack, true);
}
@@ -135,17 +138,19 @@ public class ItemPriceInformation {
shiftStackMultiplier = stack.getTagCompound().getInteger(STACKSIZE_OVERRIDE);
}
int stackMultiplier = 1;
- for (int i = 3; i < tooltip.size(); i++) {
- val matcher = SACK_STORED_AMOUNT.matcher(tooltip.get(i));
- if (matcher.matches()) {
- String amountString = matcher.group("amount").replace(",", "");
- try {
- int parsedValue = Integer.parseInt(amountString);
- if (parsedValue != 0) {
- shiftStackMultiplier = parsedValue;
+ for (int i = 1; i < tooltip.size(); i++) {
+ for (Pattern pattern : new Pattern[]{SACK_STORED_AMOUNT, COMPOSTER_STORED_AMOUNT}) {
+ val matcher = pattern.matcher(tooltip.get(i));
+ if (matcher.matches()) {
+ String amountString = matcher.group("amount").replace(",", "");
+ try {
+ int parsedValue = Integer.parseInt(amountString);
+ if (parsedValue != 0) {
+ shiftStackMultiplier = parsedValue;
+ }
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
}
- } catch (NumberFormatException e) {
- e.printStackTrace();
}
}
}