diff options
author | Cow <cow@volloeko.de> | 2021-04-25 23:36:52 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2021-04-25 23:36:52 +0200 |
commit | 953153625f8586201a85d8b983ef2d9dd0e98807 (patch) | |
tree | 85d4d49f34d6f9b6480f363bff5c36191194bb1b /src/main/java/de/cowtipper/cowlection/chesttracker/ItemData.java | |
parent | b1e45622c2bf1aacdb101d60a5efe7458f126d77 (diff) | |
download | Cowlection-953153625f8586201a85d8b983ef2d9dd0e98807.tar.gz Cowlection-953153625f8586201a85d8b983ef2d9dd0e98807.tar.bz2 Cowlection-953153625f8586201a85d8b983ef2d9dd0e98807.zip |
Bumped version to 1.8.9-0.13.0
- also minor text fixes (package name, readme etc)
Diffstat (limited to 'src/main/java/de/cowtipper/cowlection/chesttracker/ItemData.java')
-rw-r--r-- | src/main/java/de/cowtipper/cowlection/chesttracker/ItemData.java | 70 |
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..05f52bf --- /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()); + } +} |