blob: 062da2b01c9254e244278ecb9241db1e7ccd5cf1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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());
}
}
|