mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 20:42:35 +00:00
Replace ForestryTank with StandardTank
This commit is contained in:
1 parent
7947a66187
commit
5442b99837
28 files changed
+218
-285
No files matched your search
@@ -25,10 +25,10 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import forestry.api.apiculture.IAlvearyComponent;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -57,7 +57,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
|
||||
/* MEMBERS */
|
||||
InventoryAdapter canInventory = new InventoryAdapter(1, "CanInv");
|
||||
private ForestryTank liquidTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
private StandardTank liquidTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
|
||||
private HygroregulatorRecipe currentRecipe;
|
||||
private int transferTime;
|
||||
@@ -146,7 +146,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
|
||||
canInventory.readFromNBT(nbttagcompound);
|
||||
|
||||
liquidTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
liquidTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("LiquidTank"))
|
||||
liquidTank.readFromNBT(nbttagcompound.getCompoundTag("LiquidTank"));
|
||||
|
||||
@@ -283,8 +283,8 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { liquidTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { liquidTank };
|
||||
}
|
||||
|
||||
/* SMP GUI */
|
||||
|
||||
@@ -11,18 +11,16 @@
|
||||
package forestry.core.fluids.tanks;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public final class FakeTank extends FluidTank {
|
||||
public final class FakeTank extends StandardTank {
|
||||
|
||||
public static final IFluidTank INSTANCE = new FakeTank();
|
||||
public static final IFluidTank[] ARRAY = new IFluidTank[]{INSTANCE};
|
||||
public static final FakeTank INSTANCE = new FakeTank();
|
||||
public static final FakeTank[] ARRAY = new FakeTank[]{INSTANCE};
|
||||
public static final FluidTankInfo[] INFO = new FluidTankInfo[]{INSTANCE.getInfo()};
|
||||
|
||||
private FakeTank() {
|
||||
|
||||
@@ -25,97 +25,113 @@ import net.minecraftforge.fluids.FluidTank;
|
||||
*/
|
||||
public class StandardTank extends FluidTank {
|
||||
|
||||
public static final int DEFAULT_COLOR = 0xFFFFFF;
|
||||
public int colorCache = DEFAULT_COLOR;
|
||||
private int tankIndex;
|
||||
public static final int DEFAULT_COLOR = 0xFFFFFF;
|
||||
public int colorCache = DEFAULT_COLOR;
|
||||
private int tankIndex;
|
||||
|
||||
public StandardTank(int capacity) {
|
||||
super(capacity);
|
||||
}
|
||||
public StandardTank(int capacity) {
|
||||
super(capacity);
|
||||
}
|
||||
|
||||
public StandardTank(int capacity, TileEntity tile) {
|
||||
this(capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
public StandardTank(FluidStack fluid, int capacity) {
|
||||
this(capacity);
|
||||
setFluid(fluid);
|
||||
}
|
||||
|
||||
public void setTankIndex(int index) {
|
||||
this.tankIndex = index;
|
||||
}
|
||||
public StandardTank(int capacity, TileEntity tile) {
|
||||
this(capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public int getTankIndex() {
|
||||
return tankIndex;
|
||||
}
|
||||
public StandardTank(FluidStack fluid, int capacity, TileEntity tile) {
|
||||
this(capacity);
|
||||
this.tile = tile;
|
||||
setFluid(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluid(FluidStack fluid) {
|
||||
super.setFluid(fluid);
|
||||
colorCache = StandardTank.DEFAULT_COLOR;
|
||||
}
|
||||
public void setTankIndex(int index) {
|
||||
this.tankIndex = index;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
Fluid f = getFluidType();
|
||||
if (f == null)
|
||||
return DEFAULT_COLOR;
|
||||
return f.getColor(getFluid());
|
||||
}
|
||||
public int getTankIndex() {
|
||||
return tankIndex;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return getFluid() == null || getFluid().amount <= 0;
|
||||
}
|
||||
@Override
|
||||
public void setFluid(FluidStack fluid) {
|
||||
super.setFluid(fluid);
|
||||
colorCache = StandardTank.DEFAULT_COLOR;
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return getFluid() != null && getFluid().amount == getCapacity();
|
||||
}
|
||||
public int getColor() {
|
||||
Fluid f = getFluidType();
|
||||
if (f == null)
|
||||
return DEFAULT_COLOR;
|
||||
return f.getColor(getFluid());
|
||||
}
|
||||
|
||||
public int getRemainingSpace() {
|
||||
return capacity - getFluidAmount();
|
||||
}
|
||||
public boolean isEmpty() {
|
||||
return getFluid() == null || getFluid().amount <= 0;
|
||||
}
|
||||
|
||||
public Fluid getFluidType() {
|
||||
return getFluid() != null ? getFluid().getFluid() : null;
|
||||
}
|
||||
public boolean isFull() {
|
||||
return getFluid() != null && getFluid().amount == getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(final FluidStack resource, final boolean doFill) {
|
||||
if (resource == null)
|
||||
return 0;
|
||||
if (resource.amount <= 0)
|
||||
return 0;
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
public int getRemainingSpace() {
|
||||
return capacity - getFluidAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
if (maxDrain <= 0)
|
||||
return null;
|
||||
return super.drain(maxDrain, doDrain);
|
||||
}
|
||||
public Fluid getFluidType() {
|
||||
return getFluid() != null ? getFluid().getFluid() : null;
|
||||
}
|
||||
|
||||
public ToolTip getToolTip() {
|
||||
return toolTip;
|
||||
}
|
||||
@Override
|
||||
public int fill(final FluidStack resource, final boolean doFill) {
|
||||
if (resource == null)
|
||||
return 0;
|
||||
if (resource.amount <= 0)
|
||||
return 0;
|
||||
return super.fill(resource, doFill);
|
||||
}
|
||||
|
||||
protected void refreshTooltip() {
|
||||
toolTip.clear();
|
||||
int amount = 0;
|
||||
if (getFluid() != null && getFluid().amount > 0 && getFluid().getFluid() != null) {
|
||||
Fluid fluidType = getFluidType();
|
||||
EnumRarity rarity = fluidType.getRarity();
|
||||
if (rarity == null)
|
||||
rarity = EnumRarity.common;
|
||||
ToolTipLine fluidName = new ToolTipLine(fluidType.getLocalizedName(), rarity.rarityColor);
|
||||
fluidName.setSpacing(2);
|
||||
toolTip.add(fluidName);
|
||||
amount = getFluid().amount;
|
||||
}
|
||||
toolTip.add(new ToolTipLine(String.format(Locale.ENGLISH, "%,d / %,d", amount, getCapacity())));
|
||||
}
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
if (maxDrain <= 0)
|
||||
return null;
|
||||
return super.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
protected final ToolTip toolTip = new ToolTip() {
|
||||
@Override
|
||||
public void refresh() {
|
||||
refreshTooltip();
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Tank: %s, %d/%d", fluid != null && fluid.getFluid() != null ? fluid.getFluid().getName() : "Empty", getFluidAmount(), getCapacity());
|
||||
}
|
||||
|
||||
};
|
||||
public ToolTip getToolTip() {
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
protected void refreshTooltip() {
|
||||
toolTip.clear();
|
||||
int amount = 0;
|
||||
if (getFluid() != null && getFluid().amount > 0 && getFluid().getFluid() != null) {
|
||||
Fluid fluidType = getFluidType();
|
||||
EnumRarity rarity = fluidType.getRarity();
|
||||
if (rarity == null)
|
||||
rarity = EnumRarity.common;
|
||||
ToolTipLine fluidName = new ToolTipLine(fluidType.getLocalizedName(), rarity.rarityColor);
|
||||
fluidName.setSpacing(2);
|
||||
toolTip.add(fluidName);
|
||||
amount = getFluid().amount;
|
||||
}
|
||||
toolTip.add(new ToolTipLine(String.format(Locale.ENGLISH, "%,d / %,d", amount, getCapacity())));
|
||||
}
|
||||
|
||||
protected final ToolTip toolTip = new ToolTip() {
|
||||
@Override
|
||||
public void refresh() {
|
||||
refreshTooltip();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
@@ -31,11 +31,11 @@ import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
|
||||
import forestry.core.TemperatureState;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.interfaces.IPowerHandler;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.plugins.PluginBuildCraft;
|
||||
|
||||
public abstract class Engine extends TileBase implements IPowerHandler, IPipeConnection, IPowerEmitter {
|
||||
@@ -96,7 +96,7 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
powerProvider.configure(10, 200, 10, 100000);
|
||||
}
|
||||
|
||||
protected ItemStack replenishByContainer(ItemStack inventoryStack, FluidContainerData container, ForestryTank tank) {
|
||||
protected ItemStack replenishByContainer(ItemStack inventoryStack, FluidContainerData container, StandardTank tank) {
|
||||
if (container == null)
|
||||
return inventoryStack;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketInventoryStack;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -67,7 +67,7 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
|
||||
public FluidStack resource = FluidRegistry.getFluidStack(Defaults.LIQUID_HONEY, HONEY_REQUIRED);
|
||||
@EntityNetData
|
||||
public ForestryTank resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
private final Stack<ItemStack> pendingProducts = new Stack<ItemStack>();
|
||||
|
||||
/* CONSTRUCTOR */
|
||||
@@ -441,8 +441,8 @@ public class TileAnalyzer extends TileBase implements ISpecialInventory, ISidedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { resourceTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { resourceTank };
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.tanks.FakeTank;
|
||||
import forestry.core.interfaces.IErrorSource;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.interfaces.IOwnable;
|
||||
@@ -43,7 +44,7 @@ import forestry.core.network.PacketPayload;
|
||||
import forestry.core.network.PacketTileUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumAccess;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.Vect;
|
||||
|
||||
@@ -355,14 +356,14 @@ public abstract class TileForestry extends TileEntity implements INetworkedEntit
|
||||
/* IFLUIDHANDLER BASICS */
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
if (this instanceof ILiquidTankContainer) {
|
||||
ForestryTank[] tanks = ((ILiquidTankContainer) this).getTanks();
|
||||
StandardTank[] tanks = ((ILiquidTankContainer) this).getTanks();
|
||||
FluidTankInfo[] info = new FluidTankInfo[tanks.length];
|
||||
for (int i = 0; i < info.length; i++) {
|
||||
info[i] = tanks[i].getInfo();
|
||||
}
|
||||
return info;
|
||||
}
|
||||
return ForestryTank.DUMMY_TANKINFO_ARRAY;
|
||||
return FakeTank.INFO;
|
||||
}
|
||||
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import forestry.core.network.IndexInPayload;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
|
||||
public abstract class TilePowered extends TileBase implements IPowerHandler, IRenderableMachine {
|
||||
|
||||
@@ -179,7 +179,7 @@ public abstract class TilePowered extends TileBase implements IPowerHandler, IRe
|
||||
} */
|
||||
|
||||
/* LIQUID CONTAINER HANDLING */
|
||||
protected ItemStack bottleIntoContainer(ItemStack canStack, ItemStack outputStack, FluidContainerData container, ForestryTank tank) {
|
||||
protected ItemStack bottleIntoContainer(ItemStack canStack, ItemStack outputStack, FluidContainerData container, StandardTank tank) {
|
||||
if (tank.getFluidAmount() < container.fluid.amount)
|
||||
return outputStack;
|
||||
if (canStack.stackSize <= 0)
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gui;
|
||||
|
||||
import forestry.core.fluids.tanks.FakeTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -19,8 +21,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.core.gui.slots.SlotForestry;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
public class ContainerForestry extends Container {
|
||||
|
||||
@@ -208,7 +210,7 @@ public class ContainerForestry extends Container {
|
||||
public void onTankUpdate(NBTTagCompound nbt) {
|
||||
}
|
||||
|
||||
public ForestryTank getTank(int slot) {
|
||||
return ForestryTank.FAKETANK;
|
||||
public StandardTank getTank(int slot) {
|
||||
return FakeTank.INSTANCE;
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,14 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
import forestry.api.core.IToolPipette;
|
||||
import forestry.core.fluids.tanks.FakeTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.PacketIds;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.network.PacketTankUpdate;
|
||||
import forestry.core.network.PacketUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
|
||||
public class ContainerLiquidTanks extends ContainerForestry {
|
||||
|
||||
@@ -79,14 +80,14 @@ public class ContainerLiquidTanks extends ContainerForestry {
|
||||
|
||||
}
|
||||
}
|
||||
private Map<Integer, ForestryTank> syncedFluids = new HashMap<Integer, ForestryTank>();
|
||||
private Map<Integer, StandardTank> syncedFluids = new HashMap<Integer, StandardTank>();
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (int i = 0; i < tanks.getTanks().length; i++) {
|
||||
ForestryTank tank = tanks.getTanks()[i];
|
||||
StandardTank tank = tanks.getTanks()[i];
|
||||
|
||||
// If null has been synced
|
||||
if (tank.getFluid() == null && getTank(i).getFluidAmount() <= 0)
|
||||
@@ -102,7 +103,7 @@ public class ContainerLiquidTanks extends ContainerForestry {
|
||||
}
|
||||
}
|
||||
|
||||
syncedFluids.put(i, new ForestryTank(tank.getFluid() == null ? null : tank.getFluid().copy(), tank.getCapacity()));
|
||||
syncedFluids.put(i, new StandardTank(tank.getFluid() == null ? null : tank.getFluid().copy(), tank.getCapacity()));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -113,13 +114,13 @@ public class ContainerLiquidTanks extends ContainerForestry {
|
||||
int capacity = nbt.getShort("capacity");
|
||||
tanks.getTanks()[tankID].readFromNBT(nbt);
|
||||
|
||||
ForestryTank tank = new ForestryTank(capacity);
|
||||
StandardTank tank = new StandardTank(capacity);
|
||||
tank.readFromNBT(nbt);
|
||||
syncedFluids.put(tankID, tank);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank getTank(int slot) {
|
||||
return syncedFluids.get(slot) == null ? ForestryTank.FAKETANK : syncedFluids.get(slot);
|
||||
public StandardTank getTank(int slot) {
|
||||
return syncedFluids.get(slot) == null ? FakeTank.INSTANCE : syncedFluids.get(slot);
|
||||
}
|
||||
}
|
||||
@@ -19,13 +19,13 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.api.core.IToolPipette;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.WidgetManager;
|
||||
import forestry.core.gui.tooltips.ToolTip;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.SpriteSheet;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
|
||||
/**
|
||||
* Slot for liquid tanks
|
||||
@@ -48,7 +48,7 @@ public class TankWidget extends Widget {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ForestryTank getTank() {
|
||||
public StandardTank getTank() {
|
||||
return ((ContainerForestry) manager.gui.inventorySlots).getTank(slot);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TankWidget extends Widget {
|
||||
|
||||
@Override
|
||||
public ToolTip getToolTip() {
|
||||
ForestryTank tank = getTank();
|
||||
StandardTank tank = getTank();
|
||||
if (tank == null)
|
||||
return null;
|
||||
return tank.getToolTip();
|
||||
|
||||
@@ -10,12 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.interfaces;
|
||||
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import forestry.core.utils.ForestryTank;
|
||||
|
||||
public interface ILiquidTankContainer extends IFluidHandler {
|
||||
|
||||
ForestryTank[] getTanks();
|
||||
|
||||
StandardTank[] getTanks();
|
||||
|
||||
}
|
||||
@@ -10,13 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.network;
|
||||
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.core.utils.ForestryTank;
|
||||
|
||||
public class PacketTankUpdate extends PacketNBT {
|
||||
|
||||
public PacketTankUpdate(int tankSlot, ForestryTank tank) {
|
||||
public PacketTankUpdate(int tankSlot, StandardTank tank) {
|
||||
super(PacketIds.TANK_UPDATE);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setByte("tank", (byte) tankSlot);
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.utils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.tooltips.ToolTip;
|
||||
import forestry.core.gui.tooltips.ToolTipLine;
|
||||
|
||||
public class ForestryTank extends FluidTank {
|
||||
|
||||
public static final ForestryTank FAKETANK = new ForestryTank(0);
|
||||
public static final ForestryTank[] FAKETANK_ARRAY = new ForestryTank[] { FAKETANK };
|
||||
public static final FluidTankInfo DUMMY_TANK_INFO = new FluidTankInfo(FAKETANK);
|
||||
public static final FluidTankInfo[] DUMMY_TANKINFO_ARRAY = new FluidTankInfo[] { DUMMY_TANK_INFO };
|
||||
|
||||
public ForestryTank(FluidStack stack, int capacity) {
|
||||
super(stack, capacity);
|
||||
}
|
||||
|
||||
public ForestryTank(int capacity) {
|
||||
super(capacity);
|
||||
}
|
||||
|
||||
public ForestryTank(Fluid fluid, int amount, int capacity) {
|
||||
super(fluid, amount, capacity);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return getFluid() == null || getFluid().amount <= 0;
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return getFluid() != null && getFluid().amount == getCapacity();
|
||||
}
|
||||
|
||||
public Fluid getFluidType() {
|
||||
return getFluid() != null ? getFluid().getFluid() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Tank: %s, %d/%d", fluid != null && fluid.getFluid() != null ? fluid.getFluid().getName() : "Empty", getFluidAmount(), getCapacity());
|
||||
}
|
||||
|
||||
public ToolTip getToolTip() {
|
||||
return toolTip;
|
||||
}
|
||||
protected final ToolTip toolTip = new ToolTip() {
|
||||
@Override
|
||||
public void refresh() {
|
||||
toolTip.clear();
|
||||
int amount = 0;
|
||||
if (getFluid() != null && getFluid().amount > 0 && getFluid().getFluid() != null) {
|
||||
Fluid fluidType = getFluidType();
|
||||
EnumRarity rarity = fluidType.getRarity();
|
||||
if (rarity == null)
|
||||
rarity = EnumRarity.common;
|
||||
ToolTipLine fluidName = new ToolTipLine(fluidType.getLocalizedName(getFluid()), rarity.rarityColor);
|
||||
fluidName.setSpacing(2);
|
||||
toolTip.add(fluidName);
|
||||
amount = getFluid().amount;
|
||||
} else {
|
||||
toolTip.add(new ToolTipLine(StringUtil.localize("gui.empty")));
|
||||
}
|
||||
if (Config.tooltipLiquidAmount)
|
||||
toolTip.add(new ToolTipLine(String.format(Locale.ENGLISH, "%,d / %,d", amount, getCapacity())));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gadgets.TileForestry;
|
||||
|
||||
public class StackUtils {
|
||||
@@ -400,12 +401,12 @@ public class StackUtils {
|
||||
|
||||
}
|
||||
|
||||
public static void replenishByContainer(TileForestry tile, ItemStack inventoryStack, ForestryTank tank) {
|
||||
public static void replenishByContainer(TileForestry tile, ItemStack inventoryStack, StandardTank tank) {
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(inventoryStack);
|
||||
replenishByContainer(tile, inventoryStack, container, tank);
|
||||
}
|
||||
|
||||
public static ItemStack replenishByContainer(TileForestry tile, ItemStack inventoryStack, FluidContainerData container, ForestryTank tank) {
|
||||
public static ItemStack replenishByContainer(TileForestry tile, ItemStack inventoryStack, FluidContainerData container, StandardTank tank) {
|
||||
if (container == null)
|
||||
return inventoryStack;
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ import forestry.api.fuels.FuelManager;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gadgets.Engine;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.PacketPayload;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
|
||||
@@ -65,8 +65,8 @@ public class EngineBronze extends Engine implements ISpecialInventory, ILiquidTa
|
||||
else
|
||||
shutdown = false;
|
||||
}
|
||||
public ForestryTank fuelTank = new ForestryTank(Defaults.ENGINE_TANK_CAPACITY);
|
||||
public ForestryTank heatingTank = new ForestryTank(Defaults.ENGINE_TANK_CAPACITY);
|
||||
public StandardTank fuelTank = new StandardTank(Defaults.ENGINE_TANK_CAPACITY);
|
||||
public StandardTank heatingTank = new StandardTank(Defaults.ENGINE_TANK_CAPACITY);
|
||||
private final TileInventoryAdapter inventory;
|
||||
public int burnTime;
|
||||
public int totalTime;
|
||||
@@ -99,7 +99,7 @@ public class EngineBronze extends Engine implements ISpecialInventory, ILiquidTa
|
||||
FluidContainerData container = LiquidHelper.getLiquidContainer(inventory.getStackInSlot(SLOT_CAN));
|
||||
if (container != null) {
|
||||
|
||||
ForestryTank tank = null;
|
||||
StandardTank tank = null;
|
||||
|
||||
if (container.fluid.isFluidEqual(LiquidHelper.getLiquid(Defaults.LIQUID_LAVA, 1)))
|
||||
tank = heatingTank;
|
||||
@@ -284,8 +284,8 @@ public class EngineBronze extends Engine implements ISpecialInventory, ILiquidTa
|
||||
currentFluidId = fluid.getID();
|
||||
}
|
||||
|
||||
fuelTank = new ForestryTank(Defaults.ENGINE_TANK_CAPACITY);
|
||||
heatingTank = new ForestryTank(Defaults.ENGINE_TANK_CAPACITY);
|
||||
fuelTank = new StandardTank(Defaults.ENGINE_TANK_CAPACITY);
|
||||
heatingTank = new StandardTank(Defaults.ENGINE_TANK_CAPACITY);
|
||||
if (nbt.hasKey("FuelSlot")) {
|
||||
fuelTank.readFromNBT(nbt.getCompoundTag("FuelSlot"));
|
||||
heatingTank.readFromNBT(nbt.getCompoundTag("HeatingSlot"));
|
||||
@@ -457,7 +457,7 @@ public class EngineBronze extends Engine implements ISpecialInventory, ILiquidTa
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { fuelTank, heatingTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { fuelTank, heatingTank };
|
||||
}
|
||||
}
|
||||
@@ -28,17 +28,16 @@ import forestry.api.fuels.GeneratorFuel;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.interfaces.IRenderableMachine;
|
||||
import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.Utils;
|
||||
import forestry.plugins.PluginIC2;
|
||||
|
||||
@@ -49,7 +48,7 @@ public class MachineGenerator extends TileBase implements ISpecialInventory, ILi
|
||||
public static final int maxEnergy = 30000;
|
||||
|
||||
@EntityNetData
|
||||
public ForestryTank resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
private int tickCount = 0;
|
||||
|
||||
InventoryAdapter inventory = new InventoryAdapter(1, "Items");
|
||||
@@ -92,7 +91,7 @@ public class MachineGenerator extends TileBase implements ISpecialInventory, ILi
|
||||
|
||||
if (ic2EnergySource != null) ic2EnergySource.readFromNBT(nbttagcompound);
|
||||
|
||||
resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("ResourceTank"))
|
||||
resourceTank.readFromNBT(nbttagcompound.getCompoundTag("ResourceTank"));
|
||||
|
||||
@@ -286,7 +285,7 @@ public class MachineGenerator extends TileBase implements ISpecialInventory, ILi
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { resourceTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { resourceTank };
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
@@ -46,7 +47,6 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -149,7 +149,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
}
|
||||
|
||||
@EntityNetData
|
||||
public ForestryTank resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(3, "Items");
|
||||
|
||||
@@ -215,7 +215,7 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
fillingTotalTime = nbttagcompound.getInteger("FillingTotalTime");
|
||||
productPending = nbttagcompound.getBoolean("ProductPending");
|
||||
|
||||
resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("ResourceTank"))
|
||||
resourceTank.readFromNBT(nbttagcompound.getCompoundTag("ResourceTank"));
|
||||
|
||||
@@ -494,8 +494,8 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { resourceTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { resourceTank };
|
||||
}
|
||||
|
||||
// ITRIGGERPROVIDER
|
||||
|
||||
@@ -40,6 +40,7 @@ import forestry.core.EnumErrorCode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.gadgets.TileBase;
|
||||
import forestry.core.gadgets.TilePowered;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
@@ -47,7 +48,6 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
@@ -214,7 +214,7 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
|
||||
/* MEMBER */
|
||||
@EntityNetData
|
||||
public ForestryTank resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
private final TileInventoryAdapter craftingInventory;
|
||||
private final TileInventoryAdapter accessibleInventory;
|
||||
public MachineCarpenter.Recipe currentRecipe;
|
||||
@@ -287,7 +287,7 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
packageTime = nbttagcompound.getInteger("PackageTime");
|
||||
totalTime = nbttagcompound.getInteger("PackageTotalTime");
|
||||
|
||||
resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("ResourceTank"))
|
||||
resourceTank.readFromNBT(nbttagcompound.getCompoundTag("ResourceTank"));
|
||||
|
||||
@@ -680,8 +680,8 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { resourceTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { resourceTank };
|
||||
}
|
||||
|
||||
// ITRIGGERPROVIDER
|
||||
|
||||
@@ -37,7 +37,7 @@ import forestry.core.interfaces.ICrafter;
|
||||
import forestry.core.interfaces.ICraftingPlan;
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -230,7 +230,7 @@ public class MachineFabricator extends TilePowered implements ICrafter, ISpecial
|
||||
|
||||
/* MEMBER */
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(30, "Items");
|
||||
private ForestryTank moltenTank = new ForestryTank(2 * Defaults.BUCKET_VOLUME);
|
||||
private StandardTank moltenTank = new StandardTank(2 * Defaults.BUCKET_VOLUME);
|
||||
private int heat = 0;
|
||||
private int guiMeltingPoint = 0;
|
||||
|
||||
@@ -284,7 +284,7 @@ public class MachineFabricator extends TilePowered implements ICrafter, ISpecial
|
||||
heat = nbttagcompound.getInteger("Heat");
|
||||
|
||||
// Tank
|
||||
moltenTank = new ForestryTank(Defaults.BUCKET_VOLUME * 2);
|
||||
moltenTank = new StandardTank(Defaults.BUCKET_VOLUME * 2);
|
||||
if (nbttagcompound.hasKey("MoltenTank"))
|
||||
moltenTank.readFromNBT(nbttagcompound.getCompoundTag("MoltenTank"));
|
||||
|
||||
@@ -579,7 +579,7 @@ public class MachineFabricator extends TilePowered implements ICrafter, ISpecial
|
||||
|
||||
/* ILIQUIDCONTAINER */
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { moltenTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { moltenTank };
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -180,9 +180,9 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
|
||||
}
|
||||
}
|
||||
@EntityNetData
|
||||
public ForestryTank resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
@EntityNetData
|
||||
public ForestryTank productTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank productTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(5, "Items");
|
||||
private Recipe currentRecipe;
|
||||
private float currentResourceModifier;
|
||||
@@ -244,8 +244,8 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
|
||||
fuelTotalTime = nbttagcompound.getInteger("FuelTotalTime");
|
||||
fuelCurrentFerment = nbttagcompound.getInteger("FuelCurrentFerment");
|
||||
|
||||
resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
productTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
productTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("ResourceTank")) {
|
||||
resourceTank.readFromNBT(nbttagcompound.getCompoundTag("ResourceTank"));
|
||||
productTank.readFromNBT(nbttagcompound.getCompoundTag("ProductTank"));
|
||||
@@ -685,8 +685,8 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { resourceTank, productTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { resourceTank, productTank };
|
||||
}
|
||||
|
||||
// ITRIGGERPROVIDER
|
||||
|
||||
@@ -43,7 +43,7 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -127,7 +127,7 @@ public class MachineMoistener extends TilePowered implements ISpecialInventory,
|
||||
}
|
||||
|
||||
@EntityNetData
|
||||
public ForestryTank resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(12, "Items");
|
||||
//private ItemStack[] inventoryStacks = new ItemStack[12];
|
||||
public MachineMoistener.Recipe currentRecipe;
|
||||
@@ -190,7 +190,7 @@ public class MachineMoistener extends TilePowered implements ISpecialInventory,
|
||||
totalTime = nbttagcompound.getInteger("TotalTime");
|
||||
productionTime = nbttagcompound.getInteger("ProductionTime");
|
||||
|
||||
resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("ResourceTank"))
|
||||
resourceTank.readFromNBT(nbttagcompound.getCompoundTag("ResourceTank"));
|
||||
|
||||
@@ -687,8 +687,8 @@ public class MachineMoistener extends TilePowered implements ISpecialInventory,
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { resourceTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { resourceTank };
|
||||
}
|
||||
|
||||
/* SMP GUI */
|
||||
|
||||
@@ -35,7 +35,7 @@ import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
import forestry.core.utils.Fluids;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -49,7 +49,7 @@ public class MachineRaintank extends TileBase implements ISidedInventory, ILiqui
|
||||
private static final FluidStack STACK_WATER = LiquidHelper.getLiquid(Defaults.LIQUID_WATER, Defaults.RAINTANK_AMOUNT_PER_UPDATE);
|
||||
|
||||
/* MEMBER */
|
||||
public ForestryTank resourceTank = new ForestryTank(Defaults.RAINTANK_TANK_CAPACITY);
|
||||
public StandardTank resourceTank = new StandardTank(Defaults.RAINTANK_TANK_CAPACITY);
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(3, "Items");
|
||||
private boolean isValidBiome = true;
|
||||
private int fillingTime;
|
||||
@@ -97,7 +97,7 @@ public class MachineRaintank extends TileBase implements ISidedInventory, ILiqui
|
||||
|
||||
isValidBiome = nbttagcompound.getBoolean("IsValidBiome");
|
||||
|
||||
resourceTank = new ForestryTank(Defaults.RAINTANK_TANK_CAPACITY);
|
||||
resourceTank = new StandardTank(Defaults.RAINTANK_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("ResourceTank"))
|
||||
resourceTank.readFromNBT(nbttagcompound.getCompoundTag("ResourceTank"));
|
||||
|
||||
@@ -300,8 +300,8 @@ public class MachineRaintank extends TileBase implements ISidedInventory, ILiqui
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { resourceTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { resourceTank };
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
|
||||
@@ -44,7 +44,7 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -116,7 +116,7 @@ public class MachineSqueezer extends TilePowered implements ISpecialInventory, I
|
||||
|
||||
/* MEMBER */
|
||||
@EntityNetData
|
||||
public ForestryTank productTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank productTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(12, "Items");
|
||||
private Recipe currentRecipe;
|
||||
@@ -211,7 +211,7 @@ public class MachineSqueezer extends TilePowered implements ISpecialInventory, I
|
||||
}
|
||||
|
||||
// Product tank
|
||||
productTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
productTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("ProductTank"))
|
||||
productTank.readFromNBT(nbttagcompound.getCompoundTag("ProductTank"));
|
||||
|
||||
@@ -526,8 +526,8 @@ public class MachineSqueezer extends TilePowered implements ISpecialInventory, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { productTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { productTank };
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
|
||||
@@ -42,7 +42,7 @@ import forestry.core.network.EntityNetData;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.triggers.ForestryTrigger;
|
||||
import forestry.core.utils.EnumTankLevel;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -116,9 +116,9 @@ public class MachineStill extends TilePowered implements ISpecialInventory, ISid
|
||||
|
||||
/* MEMBER */
|
||||
@EntityNetData
|
||||
public ForestryTank resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
@EntityNetData
|
||||
public ForestryTank productTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
public StandardTank productTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
|
||||
private final InventoryAdapter inventory = new InventoryAdapter(3, "Items");
|
||||
|
||||
@@ -172,8 +172,8 @@ public class MachineStill extends TilePowered implements ISpecialInventory, ISid
|
||||
distillationTime = nbttagcompound.getInteger("DistillationTime");
|
||||
distillationTotalTime = nbttagcompound.getInteger("DistillationTotalTime");
|
||||
|
||||
resourceTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
productTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
resourceTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
productTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("ResourceTank")) {
|
||||
resourceTank.readFromNBT(nbttagcompound.getCompoundTag("ResourceTank"));
|
||||
productTank.readFromNBT(nbttagcompound.getCompoundTag("ProductTank"));
|
||||
@@ -483,8 +483,8 @@ public class MachineStill extends TilePowered implements ISpecialInventory, ISid
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
return new ForestryTank[] { resourceTank, productTank };
|
||||
public StandardTank[] getTanks() {
|
||||
return new StandardTank[] { resourceTank, productTank };
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
|
||||
@@ -51,7 +51,7 @@ import forestry.core.interfaces.IHintSource;
|
||||
import forestry.core.interfaces.ISocketable;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.DelayTimer;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.InventoryAdapter;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.StackUtils;
|
||||
@@ -88,7 +88,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable
|
||||
|
||||
private final InventoryAdapter sockets = new InventoryAdapter(1, "sockets");
|
||||
|
||||
private ForestryTank liquidTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
private StandardTank liquidTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
|
||||
private IFarmLogic harvestProvider; // The farm logic which supplied the pending crops.
|
||||
private final Stack<ICrop> pendingCrops = new Stack<ICrop>();
|
||||
@@ -121,7 +121,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable
|
||||
|
||||
refreshFarmLogics();
|
||||
|
||||
liquidTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
liquidTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
if (nbttagcompound.hasKey("LiquidTank"))
|
||||
liquidTank.readFromNBT(nbttagcompound.getCompoundTag("LiquidTank"));
|
||||
}
|
||||
@@ -667,7 +667,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable
|
||||
public void makeMaster() {
|
||||
super.makeMaster();
|
||||
if (liquidTank == null)
|
||||
liquidTank = new ForestryTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
liquidTank = new StandardTank(Defaults.PROCESSOR_TANK_CAPACITY);
|
||||
refreshFarmLogics();
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ public class TileFarmPlain extends TileFarm implements IFarmHousing, ISocketable
|
||||
super.onStructureReset();
|
||||
}
|
||||
|
||||
public ForestryTank getTank() {
|
||||
public StandardTank getTank() {
|
||||
return liquidTank;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.gadgets;
|
||||
|
||||
import forestry.core.fluids.tanks.FakeTank;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.core.interfaces.ILiquidTankContainer;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
|
||||
public class TileValve extends TileFarm implements ILiquidTankContainer {
|
||||
|
||||
@@ -33,7 +34,7 @@ public class TileValve extends TileFarm implements ILiquidTankContainer {
|
||||
}
|
||||
|
||||
/* ILIQUIDTANKCONTAINER */
|
||||
private ForestryTank getMasterTank() {
|
||||
private StandardTank getMasterTank() {
|
||||
if (!isIntegratedIntoStructure() || !hasMaster())
|
||||
return null;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class TileValve extends TileFarm implements ILiquidTankContainer {
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
ForestryTank tank = getMasterTank();
|
||||
StandardTank tank = getMasterTank();
|
||||
if (tank == null)
|
||||
return 0;
|
||||
|
||||
@@ -55,7 +56,7 @@ public class TileValve extends TileFarm implements ILiquidTankContainer {
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
ForestryTank tank = getMasterTank();
|
||||
StandardTank tank = getMasterTank();
|
||||
if (tank == null)
|
||||
return null;
|
||||
|
||||
@@ -63,12 +64,12 @@ public class TileValve extends TileFarm implements ILiquidTankContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank[] getTanks() {
|
||||
ForestryTank tank = getMasterTank();
|
||||
public StandardTank[] getTanks() {
|
||||
StandardTank tank = getMasterTank();
|
||||
if (tank == null)
|
||||
return ForestryTank.FAKETANK_ARRAY;
|
||||
return FakeTank.ARRAY;
|
||||
|
||||
return new ForestryTank[] { tank };
|
||||
return new StandardTank[] { tank };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
import forestry.core.fluids.tanks.FakeTank;
|
||||
import forestry.core.gui.ContainerSocketed;
|
||||
import forestry.core.gui.slots.SlotCustom;
|
||||
import forestry.core.gui.slots.SlotForestry;
|
||||
@@ -30,7 +31,7 @@ import forestry.core.gui.slots.SlotLiquidContainer;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.network.PacketTankUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.utils.TileInventoryAdapter;
|
||||
import forestry.farming.gadgets.TileFarmPlain;
|
||||
import forestry.plugins.PluginFarming;
|
||||
@@ -135,7 +136,7 @@ public class ContainerFarm extends ContainerSocketed {
|
||||
public void updateProgressBar(int i, int j) {
|
||||
tile.getGUINetworkData(i, j);
|
||||
}
|
||||
private Map<Integer, ForestryTank> syncedFluids = new HashMap<Integer, ForestryTank>();
|
||||
private Map<Integer, StandardTank> syncedFluids = new HashMap<Integer, StandardTank>();
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
@@ -145,7 +146,7 @@ public class ContainerFarm extends ContainerSocketed {
|
||||
tile.sendGUINetworkData(this, (ICrafting) crafters.get(i));
|
||||
}
|
||||
|
||||
ForestryTank tank = tile.getTank();
|
||||
StandardTank tank = tile.getTank();
|
||||
|
||||
// If null has been synced
|
||||
if (tank.getFluid() == null && getTank(0).getFluidAmount() <= 0)
|
||||
@@ -160,7 +161,7 @@ public class ContainerFarm extends ContainerSocketed {
|
||||
Proxies.net.sendToPlayer(new PacketTankUpdate(0, tank), player);
|
||||
}
|
||||
}
|
||||
syncedFluids.put(0, new ForestryTank(tank.getFluid() == null ? null : tank.getFluid().copy(), tank.getCapacity()));
|
||||
syncedFluids.put(0, new StandardTank(tank.getFluid() == null ? null : tank.getFluid().copy(), tank.getCapacity()));
|
||||
|
||||
}
|
||||
|
||||
@@ -168,13 +169,13 @@ public class ContainerFarm extends ContainerSocketed {
|
||||
public void onTankUpdate(NBTTagCompound nbt) {
|
||||
int tankID = nbt.getByte("tank");
|
||||
int capacity = nbt.getShort("capacity");
|
||||
ForestryTank tank = new ForestryTank(capacity);
|
||||
StandardTank tank = new StandardTank(capacity);
|
||||
tank.readFromNBT(nbt);
|
||||
syncedFluids.put(tankID, tank);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForestryTank getTank(int slot) {
|
||||
return syncedFluids.get(slot) == null ? ForestryTank.FAKETANK : syncedFluids.get(slot);
|
||||
public StandardTank getTank(int slot) {
|
||||
return syncedFluids.get(slot) == null ? FakeTank.INSTANCE : syncedFluids.get(slot);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import buildcraft.api.gates.ITriggerParameter;
|
||||
|
||||
import forestry.api.core.ITileStructure;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.core.utils.ForestryTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.farming.gadgets.TileFarmPlain;
|
||||
import forestry.farming.gadgets.TileHatch;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class TriggerLowLiquid extends Trigger {
|
||||
if (central == null || !(central instanceof TileFarmPlain))
|
||||
return false;
|
||||
|
||||
ForestryTank tank = ((TileFarmPlain) central).getTank();
|
||||
StandardTank tank = ((TileFarmPlain) central).getTank();
|
||||
return ((float) tank.getFluidAmount() / tank.getCapacity()) <= threshold;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user