aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/cowtipper/cowlection/chestTracker/ItemData.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/chestTracker/ItemData.java')
-rw-r--r--src/main/java/de/cowtipper/cowlection/chestTracker/ItemData.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/chestTracker/ItemData.java b/src/main/java/de/cowtipper/cowlection/chestTracker/ItemData.java
new file mode 100644
index 0000000..062da2b
--- /dev/null
+++ b/src/main/java/de/cowtipper/cowlection/chestTracker/ItemData.java
@@ -0,0 +1,70 @@
+package de.cowtipper.cowlection.chestTracker;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ItemData {
+ private final String key;
+ private final ItemStack itemStack;
+ private final String name;
+ private int amount;
+ private double bazaarInstantSellPrice = -1;
+ private double bazaarSellOfferPrice = -1;
+
+ public ItemData(String key, ItemStack itemStack) {
+ this.key = key;
+ this.itemStack = itemStack;
+ this.itemStack.stackSize = 1;
+ this.name = itemStack.getDisplayName();
+ this.amount = 0;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public ItemStack getItemStack() {
+ return itemStack;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getAmount() {
+ return amount;
+ }
+
+ public double getBazaarInstantSellPrice() {
+ return bazaarInstantSellPrice;
+ }
+
+ public void setBazaarInstantSellPrice(double bazaarInstantSellPrice) {
+ this.bazaarInstantSellPrice = bazaarInstantSellPrice;
+ }
+
+ public double getBazaarSellOfferPrice() {
+ return bazaarSellOfferPrice;
+ }
+
+ public void setBazaarSellOfferPrice(double bazaarSellOfferPrice) {
+ this.bazaarSellOfferPrice = bazaarSellOfferPrice;
+ }
+
+ public ItemData addAmount(int stackSize) {
+ this.amount += stackSize;
+ return this;
+ }
+
+ public double getBazaarInstantSellValue() {
+ return bazaarInstantSellPrice >= 0 ? amount * bazaarInstantSellPrice : -1;
+ }
+
+ public double getBazaarSellOfferValue() {
+ return bazaarSellOfferPrice >= 0 ? amount * bazaarSellOfferPrice : -1;
+ }
+
+ public String toCopyableFormat() {
+ return "\n" + EnumChatFormatting.getTextWithoutFormattingCodes(name) + "\t" + name + "\t" + amount + "\t" + Math.round(getBazaarInstantSellPrice()) + "\t" + Math.round(getBazaarInstantSellValue()) + "\t" + Math.round(getBazaarSellOfferPrice()) + "\t" + Math.round(getBazaarSellOfferValue());
+ }
+}