mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 22:34:21 +00:00
The Great Reformat; moving to google-java-style w/ 4 space indent and 120 column line wrap
This commit is contained in:
1 parent
c632cc6af9
commit
e0b7ea62a4
933 files changed
+95734
-108818
No files matched your search
@@ -6,58 +6,50 @@ import mekanism.common.base.ISustainedData;
|
||||
import mekanism.common.util.ItemDataUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class InfuseStorage implements ISustainedData
|
||||
{
|
||||
public InfuseType type;
|
||||
public class InfuseStorage implements ISustainedData {
|
||||
|
||||
public int amount;
|
||||
public InfuseType type;
|
||||
|
||||
public InfuseStorage() {}
|
||||
public int amount;
|
||||
|
||||
public InfuseStorage(InfuseType infuseType, int infuseAmount)
|
||||
{
|
||||
type = infuseType;
|
||||
amount = infuseAmount;
|
||||
}
|
||||
public InfuseStorage() {
|
||||
}
|
||||
|
||||
public boolean contains(InfuseStorage storage)
|
||||
{
|
||||
return type == storage.type && amount >= storage.amount;
|
||||
}
|
||||
public InfuseStorage(InfuseType infuseType, int infuseAmount) {
|
||||
type = infuseType;
|
||||
amount = infuseAmount;
|
||||
}
|
||||
|
||||
public void subtract(InfuseStorage storage)
|
||||
{
|
||||
if(contains(storage))
|
||||
{
|
||||
amount -= storage.amount;
|
||||
}
|
||||
else if(type == storage.type)
|
||||
{
|
||||
amount = 0;
|
||||
}
|
||||
}
|
||||
public boolean contains(InfuseStorage storage) {
|
||||
return type == storage.type && amount >= storage.amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSustainedData(ItemStack itemStack)
|
||||
{
|
||||
if (type != null && amount > 0)
|
||||
{
|
||||
ItemDataUtils.setString(itemStack, "infuseType", type.name);
|
||||
ItemDataUtils.setInt(itemStack, "infuseAmount", amount);
|
||||
}
|
||||
}
|
||||
public void subtract(InfuseStorage storage) {
|
||||
if (contains(storage)) {
|
||||
amount -= storage.amount;
|
||||
} else if (type == storage.type) {
|
||||
amount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSustainedData(ItemStack itemStack)
|
||||
{
|
||||
if (ItemDataUtils.hasData(itemStack, "infuseType") && ItemDataUtils.hasData(itemStack, "infuseAmount")){
|
||||
type = InfuseRegistry.get(ItemDataUtils.getString(itemStack, "infuseType"));
|
||||
if (type != null){
|
||||
amount = ItemDataUtils.getInt(itemStack, "infuseAmount");
|
||||
}
|
||||
} else {
|
||||
type = null;
|
||||
amount = 0;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void writeSustainedData(ItemStack itemStack) {
|
||||
if (type != null && amount > 0) {
|
||||
ItemDataUtils.setString(itemStack, "infuseType", type.name);
|
||||
ItemDataUtils.setInt(itemStack, "infuseAmount", amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSustainedData(ItemStack itemStack) {
|
||||
if (ItemDataUtils.hasData(itemStack, "infuseType") && ItemDataUtils.hasData(itemStack, "infuseAmount")) {
|
||||
type = InfuseRegistry.get(ItemDataUtils.getString(itemStack, "infuseType"));
|
||||
if (type != null) {
|
||||
amount = ItemDataUtils.getInt(itemStack, "infuseAmount");
|
||||
}
|
||||
} else {
|
||||
type = null;
|
||||
amount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user