diff options
author | Lulonaut <lulonaut@tutanota.de> | 2022-12-24 02:19:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 12:19:54 +1100 |
commit | 4fd32fb0575fbb698b2c7611f357595255ce2635 (patch) | |
tree | 615d3a00aae0db0137bc83d68ecc4a8e86b3dd0b /src/main/java/io | |
parent | 5b1c9f4959ff16be963217917a72d5bf669c4d8b (diff) | |
download | NotEnoughUpdates-4fd32fb0575fbb698b2c7611f357595255ce2635.tar.gz NotEnoughUpdates-4fd32fb0575fbb698b2c7611f357595255ce2635.tar.bz2 NotEnoughUpdates-4fd32fb0575fbb698b2c7611f357595255ce2635.zip |
allow coin ingredients with decimal places (#506)
Diffstat (limited to 'src/main/java/io')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java | 12 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java | 5 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java index c973f8c0..38d2447b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java @@ -32,7 +32,7 @@ import java.util.Set; public class Ingredient { public static final String SKYBLOCK_COIN = "SKYBLOCK_COIN"; - private final int count; + private final double count; private final String internalItemId; private final NEUManager manager; private ItemStack itemStack; @@ -42,7 +42,7 @@ public class Ingredient { String[] parts = ingredientIdentifier.split(":"); internalItemId = parts[0]; if (parts.length == 2) { - count = Integer.parseInt(parts[1]); + count = Double.parseDouble(parts[1]); } else if (parts.length == 1) { count = 1; } else { @@ -50,13 +50,13 @@ public class Ingredient { } } - public Ingredient(NEUManager manager, String internalItemId, int count) { + public Ingredient(NEUManager manager, String internalItemId, double count) { this.manager = manager; this.count = count; this.internalItemId = internalItemId; } - private Ingredient(NEUManager manager, int coinValue) { + private Ingredient(NEUManager manager, double coinValue) { this.manager = manager; this.internalItemId = SKYBLOCK_COIN; this.count = coinValue; @@ -82,7 +82,7 @@ public class Ingredient { return "SKYBLOCK_COIN".equals(internalItemId); } - public int getCount() { + public double getCount() { return count; } @@ -97,7 +97,7 @@ public class Ingredient { } JsonObject itemInfo = manager.getItemInformation().get(internalItemId); itemStack = manager.jsonToStack(itemInfo); - itemStack.stackSize = count; + itemStack.stackSize = (int) count; return itemStack; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java index 2ff9692d..bc44f656 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -42,13 +42,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.function.BiFunction; public class ItemUtils { - public static ItemStack getCoinItemStack(long coinAmount) { + public static ItemStack getCoinItemStack(double coinAmount) { String uuid = "2070f6cb-f5db-367a-acd0-64d39a7e5d1b"; String texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTM4MDcxNzIxY2M1YjRjZDQwNmNlNDMxYTEzZjg2MDgzYTg5NzNlMTA2NGQyZjg4OTc4Njk5MzBlZTZlNTIzNyJ9fX0="; @@ -63,7 +62,7 @@ public class ItemUtils { "ewogICJ0aW1lc3RhbXAiIDogMTYzNTk1NzQ4ODQxNywKICAicHJvZmlsZUlkIiA6ICJmNThkZWJkNTlmNTA0MjIyOGY2MDIyMjExZDRjMTQwYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJ1bnZlbnRpdmV0YWxlbnQiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2I5NTFmZWQ2YTdiMmNiYzIwMzY5MTZkZWM3YTQ2YzRhNTY0ODE1NjRkMTRmOTQ1YjZlYmMwMzM4Mjc2NmQzYiIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9"; } ItemStack skull = Utils.createSkull( - "\u00A7r\u00A76" + NumberFormat.getInstance(Locale.US).format(coinAmount) + " Coins", + "§r§6" + NumberFormat.getInstance().format(coinAmount) + " Coins", uuid, texture ); |