mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 23:03:18 +00:00
Update to current ForestryMC/master
This commit is contained in:
commit
aff9d9d785
41 files changed
+1160
-210
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 */
|
||||
|
||||
@@ -12,19 +12,20 @@ package forestry.arboriculture.genetics;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.EnumGrowthConditions;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class GrowthProviderTropical extends GrowthProvider {
|
||||
|
||||
@Override
|
||||
public EnumGrowthConditions getGrowthConditions(ITreeGenome genome, World world, int xPos, int yPos, int zPos) {
|
||||
EnumGrowthConditions light = getConditionFromLight(world, xPos, yPos, zPos);
|
||||
EnumGrowthConditions moisture = getConditionsFromRainfall(world, xPos, yPos, zPos, 0.9f, 2.0f);
|
||||
EnumGrowthConditions temperature = getConditionsFromTemperature(world, xPos, yPos, zPos, 1.2f, 1.9f);
|
||||
EnumGrowthConditions moisture = getConditionsFromRainfall(world, xPos, yPos, zPos, BiomeGenBase.jungle.rainfall, 2.0f);
|
||||
EnumGrowthConditions temperature = getConditionsFromTemperature(world, xPos, yPos, zPos, BiomeGenBase.jungle.temperature, BiomeGenBase.desert.temperature - 0.1f);
|
||||
|
||||
EnumSet<EnumGrowthConditions> conditions = EnumSet.of(light, moisture, temperature);
|
||||
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
/*******************************************************************************
|
||||
* 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.fluids;
|
||||
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.inventory.InvTools;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public final class FluidHelper {
|
||||
|
||||
public static final int BUCKET_FILL_TIME = 8;
|
||||
public static final int NETWORK_UPDATE_INTERVAL = 128;
|
||||
public static final int BUCKET_VOLUME = 1000;
|
||||
|
||||
private FluidHelper() {
|
||||
}
|
||||
|
||||
public static boolean handleRightClick(IFluidHandler tank, ForgeDirection side, EntityPlayer player, boolean fill, boolean drain) {
|
||||
if (player == null)
|
||||
return false;
|
||||
ItemStack current = player.inventory.getCurrentItem();
|
||||
if (current != null) {
|
||||
|
||||
FluidStack liquid = getFluidStackInContainer(current);
|
||||
|
||||
if (fill && liquid != null) {
|
||||
int used = tank.fill(side, liquid, true);
|
||||
|
||||
if (used > 0) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (drain) {
|
||||
|
||||
FluidStack available = tank.drain(side, Integer.MAX_VALUE, false);
|
||||
if (available != null) {
|
||||
ItemStack filled = fillContainer(available, current);
|
||||
|
||||
liquid = getFluidStackInContainer(filled);
|
||||
if (liquid != null) {
|
||||
|
||||
if (current.stackSize > 1) {
|
||||
if (!player.inventory.addItemStackToInventory(filled))
|
||||
return false;
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.markDirty();
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, InvTools.depleteItem(current));
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, filled);
|
||||
player.inventory.markDirty();
|
||||
}
|
||||
|
||||
tank.drain(side, liquid.amount, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot) {
|
||||
processContainers(tank, inv, inputSlot, outputSlot, tank.getFluidType(), true, true);
|
||||
}
|
||||
|
||||
public static void processContainers(StandardTank tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) {
|
||||
TankManager tankManger = new TankManager();
|
||||
tankManger.add(tank);
|
||||
processContainers(tankManger, inv, inputSlot, outputSlot, fluidToFill, processFilled, processEmpty);
|
||||
}
|
||||
|
||||
public static void processContainers(TankManager tank, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) {
|
||||
processContainers(tank, inv, inputSlot, outputSlot, fluidToFill, true, true);
|
||||
}
|
||||
|
||||
public static void processContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill, boolean processFilled, boolean processEmpty) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
|
||||
if (input == null)
|
||||
return;
|
||||
|
||||
if (processFilled && drainContainers(fluidHandler, inv, inputSlot, outputSlot))
|
||||
return;
|
||||
|
||||
if (processEmpty && fluidToFill != null)
|
||||
fillContainers(fluidHandler, inv, inputSlot, outputSlot, fluidToFill);
|
||||
}
|
||||
|
||||
public static boolean fillContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot, Fluid fluidToFill) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
ItemStack output = inv.getStackInSlot(outputSlot);
|
||||
ItemStack filled = getFilledContainer(fluidToFill, input);
|
||||
if (filled != null && (output == null || (output.stackSize < output.getMaxStackSize() && InvTools.isItemEqual(filled, output)))) {
|
||||
FluidStack fluidInContainer = getFluidStackInContainer(filled);
|
||||
FluidStack drain = fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, false);
|
||||
if (drain != null && drain.amount == fluidInContainer.amount) {
|
||||
fluidHandler.drain(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
if (output == null)
|
||||
inv.setInventorySlotContents(outputSlot, filled);
|
||||
else
|
||||
output.stackSize++;
|
||||
inv.decrStackSize(inputSlot, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean drainContainers(IFluidHandler fluidHandler, IInventory inv, int inputSlot, int outputSlot) {
|
||||
ItemStack input = inv.getStackInSlot(inputSlot);
|
||||
ItemStack output = inv.getStackInSlot(outputSlot);
|
||||
|
||||
if (input != null) {
|
||||
FluidStack fluidInContainer = getFluidStackInContainer(input);
|
||||
ItemStack emptyItem = input.getItem().getContainerItem(input);
|
||||
if (fluidInContainer != null && (emptyItem == null || output == null || (output.stackSize < output.getMaxStackSize() && InvTools.isItemEqual(output, emptyItem)))) {
|
||||
int used = fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, false);
|
||||
if (used >= fluidInContainer.amount) {
|
||||
fluidHandler.fill(ForgeDirection.UNKNOWN, fluidInContainer, true);
|
||||
if (emptyItem != null)
|
||||
if (output == null)
|
||||
inv.setInventorySlotContents(outputSlot, emptyItem);
|
||||
else
|
||||
output.stackSize++;
|
||||
inv.decrStackSize(inputSlot, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isBucket(ItemStack stack) {
|
||||
return FluidContainerRegistry.isBucket(stack);
|
||||
}
|
||||
|
||||
public static boolean isContainer(ItemStack stack) {
|
||||
if (stack != null && stack.getItem() instanceof IFluidContainerItem)
|
||||
return true;
|
||||
return FluidContainerRegistry.isContainer(stack);
|
||||
}
|
||||
|
||||
public static boolean isFilledContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.isFilledContainer(stack);
|
||||
}
|
||||
|
||||
public static boolean isEmptyContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.isEmptyContainer(stack);
|
||||
}
|
||||
|
||||
public static ItemStack getFilledContainer(Fluid fluid, ItemStack empty) {
|
||||
if (fluid == null || empty == null) return null;
|
||||
return FluidContainerRegistry.fillFluidContainer(new FluidStack(fluid, Integer.MAX_VALUE), empty);
|
||||
}
|
||||
|
||||
public static ItemStack getFilledContainer(FluidStack fluid, ItemStack empty) {
|
||||
if (fluid == null || empty == null) return null;
|
||||
fluid = fluid.copy();
|
||||
fluid.amount = Integer.MAX_VALUE;
|
||||
return FluidContainerRegistry.fillFluidContainer(fluid, empty);
|
||||
}
|
||||
|
||||
public static ItemStack fillContainer(FluidStack liquid, ItemStack empty) {
|
||||
if (liquid == null || empty == null) return null;
|
||||
return FluidContainerRegistry.fillFluidContainer(liquid, empty);
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStackInContainer(ItemStack stack) {
|
||||
return FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
}
|
||||
|
||||
public static Fluid getFluidInContianer(ItemStack stack) {
|
||||
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
return fluidStack != null ? fluidStack.getFluid() : null;
|
||||
}
|
||||
|
||||
public static boolean containsFluidStack(ItemStack stack, FluidStack fluidStack) {
|
||||
return FluidContainerRegistry.containsFluid(stack, fluidStack);
|
||||
}
|
||||
|
||||
public static boolean containsFluid(ItemStack stack, Fluid fluid) {
|
||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(fluid, 1));
|
||||
}
|
||||
|
||||
public static boolean isFluidEqual(FluidStack L1, FluidStack L2) {
|
||||
if (L1 == null || L2 == null)
|
||||
return false;
|
||||
return L1.isFluidEqual(L2);
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getContainersFilledWith(FluidStack fluidStack) {
|
||||
List<ItemStack> containers = new ArrayList<ItemStack>();
|
||||
for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
FluidStack inContainer = getFluidStackInContainer(data.filledContainer);
|
||||
if (inContainer != null && inContainer.containsFluid(fluidStack))
|
||||
containers.add(data.filledContainer.copy());
|
||||
}
|
||||
return containers;
|
||||
}
|
||||
|
||||
public static void nerfWaterBottle() {
|
||||
for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
|
||||
if (data.filledContainer.getItem() == Items.potionitem && data.emptyContainer.getItem() == Items.glass_bottle && Fluids.WATER.is(data.fluid)) {
|
||||
data.fluid.amount = 333;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static FluidStack drainBlock(World world, int x, int y, int z, boolean doDrain) {
|
||||
return drainBlock(world.getBlock(x, y, z), world, x, y, z, doDrain);
|
||||
}
|
||||
|
||||
public static FluidStack drainBlock(Block block, World world, int x, int y, int z, boolean doDrain) {
|
||||
if (block instanceof IFluidBlock) {
|
||||
IFluidBlock fluidBlock = (IFluidBlock)block;
|
||||
if (fluidBlock.canDrain(world, x, y, z))
|
||||
return fluidBlock.drain(world, x, y, z, doDrain);
|
||||
} else if (block == Blocks.water || block == Blocks.flowing_water) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 0)
|
||||
return null;
|
||||
if (doDrain)
|
||||
world.setBlockToAir(x, y, z);
|
||||
return new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME);
|
||||
} else if (block == Blocks.lava || block == Blocks.flowing_lava) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 0)
|
||||
return null;
|
||||
if (doDrain)
|
||||
world.setBlockToAir(x, y, z);
|
||||
return new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isFullFluidBlock(World world, int x, int y, int z) {
|
||||
return isFullFluidBlock(world.getBlock(x, y, z), world, x, y, z);
|
||||
}
|
||||
|
||||
public static boolean isFullFluidBlock(Block block, World world, int x, int y, int z) {
|
||||
if (block instanceof BlockLiquid || block instanceof IFluidBlock)
|
||||
return world.getBlockMetadata(x, y, z) == 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Fluid getFluid(Block block) {
|
||||
if (block instanceof IFluidBlock)
|
||||
return ((IFluidBlock) block).getFluid();
|
||||
else if (block == Blocks.water || block == Blocks.flowing_water)
|
||||
return FluidRegistry.WATER;
|
||||
else if (block == Blocks.lava || block == Blocks.flowing_lava)
|
||||
return FluidRegistry.LAVA;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*******************************************************************************
|
||||
* 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.fluids;
|
||||
|
||||
import java.util.Locale;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public enum Fluids {
|
||||
|
||||
WATER, LAVA, FUEL, BIOFUEL, CREOSOTE, STEAM, BIOETHANOL, COAL, PYROTHEUM;
|
||||
private final String tag;
|
||||
|
||||
private Fluids() {
|
||||
tag = name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public Fluid get() {
|
||||
return FluidRegistry.getFluid(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a FluidStack filled with qty milliBuckets worth of Fluid.
|
||||
*
|
||||
* @param qty
|
||||
* @return
|
||||
*/
|
||||
public FluidStack get(int qty) {
|
||||
return FluidRegistry.getFluidStack(tag, qty);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a FluidStack filled with n buckets worth of Fluid.
|
||||
*
|
||||
* @param n
|
||||
* @return
|
||||
*/
|
||||
public FluidStack getB(int n) {
|
||||
return FluidRegistry.getFluidStack(tag, n * FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
|
||||
public boolean is(Fluid fluid) {
|
||||
return get() == fluid;
|
||||
}
|
||||
|
||||
public boolean is(FluidStack fluidStack) {
|
||||
return fluidStack != null && get() == fluidStack.getFluid();
|
||||
}
|
||||
|
||||
public boolean isContained(ItemStack containerStack) {
|
||||
return containerStack != null && FluidHelper.containsFluid(containerStack, get());
|
||||
}
|
||||
|
||||
public static boolean areEqual(Fluid fluid, FluidStack fluidStack) {
|
||||
if (fluidStack != null && fluid == fluidStack.getFluid())
|
||||
return true;
|
||||
return fluid == null && fluidStack == null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
/*******************************************************************************
|
||||
* 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.fluids;
|
||||
|
||||
import com.google.common.collect.ForwardingList;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.inventory.ITileFilter;
|
||||
import forestry.core.utils.NBTUtil;
|
||||
import forestry.core.utils.NBTUtil.NBTList;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public class TankManager extends ForwardingList<StandardTank> implements IFluidHandler, List<StandardTank> {
|
||||
|
||||
public static final ITileFilter TANK_FILTER = new ITileFilter() {
|
||||
@Override
|
||||
public boolean matches(TileEntity tile) {
|
||||
return tile instanceof IFluidHandler;
|
||||
}
|
||||
|
||||
};
|
||||
private static final byte NETWORK_DATA = 3;
|
||||
private final List<StandardTank> tanks = new ArrayList<StandardTank>();
|
||||
private final List<FluidStack> prevFluidStacks = new ArrayList<FluidStack>();
|
||||
private final List<Integer> prevColor = new ArrayList<Integer>();
|
||||
|
||||
public TankManager() {
|
||||
}
|
||||
|
||||
public TankManager(StandardTank... tanks) {
|
||||
addAll(Arrays.asList(tanks));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<StandardTank> delegate() {
|
||||
return tanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(StandardTank tank) {
|
||||
boolean added = tanks.add(tank);
|
||||
int index = tanks.indexOf(tank);
|
||||
tank.setTankIndex(index);
|
||||
prevFluidStacks.add(tank.getFluid() == null ? null : tank.getFluid().copy());
|
||||
prevColor.add(tank.getColor());
|
||||
return added;
|
||||
}
|
||||
|
||||
public void writeTanksToNBT(NBTTagCompound data) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for (byte slot = 0; slot < tanks.size(); slot++) {
|
||||
StandardTank tank = tanks.get(slot);
|
||||
if (tank.getFluid() != null) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setByte("tank", slot);
|
||||
tank.writeToNBT(tag);
|
||||
tagList.appendTag(tag);
|
||||
}
|
||||
}
|
||||
data.setTag("tanks", tagList);
|
||||
}
|
||||
|
||||
public void readTanksFromNBT(NBTTagCompound data) {
|
||||
NBTList<NBTTagCompound> tagList = NBTUtil.getNBTList(data, "tanks", NBTUtil.EnumNBTType.COMPOUND);
|
||||
for (NBTTagCompound tag : tagList) {
|
||||
int slot = tag.getByte("tank");
|
||||
if (slot >= 0 && slot < tanks.size())
|
||||
tanks.get(slot).readFromNBT(tag);
|
||||
}
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream data) throws IOException {
|
||||
for (int i = 0; i < tanks.size(); i++)
|
||||
writePacketData(data, i);
|
||||
}
|
||||
|
||||
public void writePacketData(DataOutputStream data, int tankIndex) throws IOException {
|
||||
if (tankIndex >= tanks.size())
|
||||
return;
|
||||
StandardTank tank = tanks.get(tankIndex);
|
||||
FluidStack fluidStack = tank.getFluid();
|
||||
if (fluidStack != null) {
|
||||
data.writeShort(fluidStack.fluidID);
|
||||
data.writeInt(fluidStack.amount);
|
||||
data.writeInt(fluidStack.getFluid().getColor(fluidStack));
|
||||
} else
|
||||
data.writeShort(-1);
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream data) throws IOException {
|
||||
for (int i = 0; i < tanks.size(); i++)
|
||||
readPacketData(data, i);
|
||||
}
|
||||
|
||||
public void readPacketData(DataInputStream data, int tankIndex) throws IOException {
|
||||
if (tankIndex >= tanks.size())
|
||||
return;
|
||||
StandardTank tank = tanks.get(tankIndex);
|
||||
int fluidId = data.readShort();
|
||||
if (fluidId != -1) {
|
||||
tank.setFluid(new FluidStack(fluidId, data.readInt()));
|
||||
tank.colorCache = data.readInt();
|
||||
} else
|
||||
tank.setFluid(null);
|
||||
}
|
||||
|
||||
public void initGuiData(Container container, ICrafting player, int tankIndex) {
|
||||
if (tankIndex >= tanks.size())
|
||||
return;
|
||||
FluidStack fluidStack = tanks.get(tankIndex).getFluid();
|
||||
int fluidId = -1;
|
||||
int fluidAmount = 0;
|
||||
if (fluidStack != null && fluidStack.amount > 0) {
|
||||
fluidId = fluidStack.getFluid().getID();
|
||||
fluidAmount = fluidStack.amount;
|
||||
}
|
||||
|
||||
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId);
|
||||
PacketBuilder.instance().sendGuiIntegerPacket((EntityPlayerMP) player, container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount);
|
||||
}
|
||||
|
||||
public void updateGuiData(Container container, List crafters, int tankIndex) {
|
||||
StandardTank tank = tanks.get(tankIndex);
|
||||
FluidStack fluidStack = tank.getFluid();
|
||||
FluidStack prev = prevFluidStacks.get(tankIndex);
|
||||
int color = tank.getColor();
|
||||
int pColor = prevColor.get(tankIndex);
|
||||
|
||||
for (Object crafter1 : crafters) {
|
||||
ICrafting crafter = (ICrafting) crafter1;
|
||||
EntityPlayerMP player = (EntityPlayerMP) crafter1;
|
||||
if (fluidStack == null ^ prev == null) {
|
||||
int fluidId = -1;
|
||||
int fluidAmount = 0;
|
||||
if (fluidStack != null) {
|
||||
fluidId = fluidStack.fluidID;
|
||||
fluidAmount = fluidStack.amount;
|
||||
}
|
||||
crafter.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId);
|
||||
PacketBuilder.instance().sendGuiIntegerPacket(player, container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount);
|
||||
} else if (fluidStack != null && prev != null) {
|
||||
if (fluidStack.getFluid() != prev.getFluid())
|
||||
crafter.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidStack.fluidID);
|
||||
if (fluidStack.amount != prev.amount)
|
||||
PacketBuilder.instance().sendGuiIntegerPacket(player, container.windowId, tankIndex * NETWORK_DATA + 1, fluidStack.amount);
|
||||
if (color != pColor)
|
||||
PacketBuilder.instance().sendGuiIntegerPacket(player, container.windowId, tankIndex * NETWORK_DATA + 2, color);
|
||||
}
|
||||
}
|
||||
|
||||
prevFluidStacks.set(tankIndex, tank.getFluid() == null ? null : tank.getFluid().copy());
|
||||
prevColor.set(tankIndex, color);
|
||||
}
|
||||
|
||||
public void processGuiUpdate(int messageId, int data) {
|
||||
int tankIndex = messageId / NETWORK_DATA;
|
||||
|
||||
if (tankIndex >= tanks.size())
|
||||
return;
|
||||
StandardTank tank = tanks.get(tankIndex);
|
||||
FluidStack fluidStack = tank.getFluid();
|
||||
if (fluidStack == null) {
|
||||
fluidStack = new FluidStack(-1, 0);
|
||||
tank.setFluid(fluidStack);
|
||||
}
|
||||
int fluidId = fluidStack.fluidID;
|
||||
int amount = fluidStack.amount;
|
||||
int color = tank.colorCache;
|
||||
boolean newLiquid = false;
|
||||
switch (messageId % NETWORK_DATA) {
|
||||
case 0:
|
||||
fluidId = data;
|
||||
newLiquid = true;
|
||||
break;
|
||||
case 1:
|
||||
amount = data;
|
||||
break;
|
||||
case 2:
|
||||
color = data;
|
||||
break;
|
||||
}
|
||||
if (newLiquid) {
|
||||
fluidStack = new FluidStack(fluidId, 0);
|
||||
tank.setFluid(fluidStack);
|
||||
}
|
||||
fluidStack.amount = amount;
|
||||
tank.colorCache = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return fill(0, resource, doFill);
|
||||
}
|
||||
|
||||
public int fill(int tankIndex, FluidStack resource, boolean doFill) {
|
||||
if (tankIndex < 0 || tankIndex >= tanks.size() || resource == null)
|
||||
return 0;
|
||||
|
||||
return tanks.get(tankIndex).fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
return drain(0, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
public FluidStack drain(int tankIndex, int maxDrain, boolean doDrain) {
|
||||
if (tankIndex < 0 || tankIndex >= tanks.size())
|
||||
return null;
|
||||
|
||||
return tanks.get(tankIndex).drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
for (StandardTank tank : tanks)
|
||||
if (tankCanDrainFluid(tank, resource))
|
||||
return tank.drain(resource.amount, doDrain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection direction) {
|
||||
FluidTankInfo[] info = new FluidTankInfo[size()];
|
||||
for (int i = 0; i < size(); i++)
|
||||
info[i] = get(i).getInfo();
|
||||
return info;
|
||||
}
|
||||
|
||||
public FluidTankInfo[] getTankInfo() {
|
||||
return getTankInfo(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StandardTank get(int tankIndex) {
|
||||
if (tankIndex < 0 || tankIndex >= tanks.size())
|
||||
return null;
|
||||
return tanks.get(tankIndex);
|
||||
}
|
||||
|
||||
public void setCapacity(int tankIndex, int capacity) {
|
||||
StandardTank tank = get(tankIndex);
|
||||
tank.setCapacity(capacity);
|
||||
FluidStack fluidStack = tank.getFluid();
|
||||
if (fluidStack != null && fluidStack.amount > capacity)
|
||||
fluidStack.amount = capacity;
|
||||
}
|
||||
|
||||
// Used to push fluids to surrounding blocks, missing code from Railcraft, if needed contact CovertJaguar
|
||||
// public void outputLiquid(AdjacentTileCache cache, ITileFilter filter, ForgeDirection[] sides, int tankIndex, int amount) {
|
||||
// for (ForgeDirection side : sides) {
|
||||
// TileEntity tile = cache.getTileOnSide(side);
|
||||
// if (!filter.matches(tile)) continue;
|
||||
// IFluidHandler tank = getTankFromTile(tile);
|
||||
// if (tank == null) continue;
|
||||
// outputLiquid((IFluidHandler) tile, side, tankIndex, amount);
|
||||
// }
|
||||
// }
|
||||
public void outputLiquid(IFluidHandler[] outputs, int tankIndex, int amount) {
|
||||
for (int side = 0; side < 6; side++) {
|
||||
IFluidHandler nearbyTank = outputs[side];
|
||||
if (nearbyTank != null)
|
||||
outputLiquid(nearbyTank, ForgeDirection.getOrientation(side), tankIndex, amount);
|
||||
}
|
||||
}
|
||||
|
||||
public static IFluidHandler getTankFromTile(TileEntity tile) {
|
||||
IFluidHandler tank = null;
|
||||
if (tile instanceof IFluidHandler)
|
||||
tank = (IFluidHandler) tile;
|
||||
return tank;
|
||||
}
|
||||
|
||||
private void outputLiquid(IFluidHandler tank, ForgeDirection side, int tankIndex, int amount) {
|
||||
FluidStack available = drain(tankIndex, amount, false);
|
||||
if (available != null) {
|
||||
int used = tank.fill(side.getOpposite(), available, true);
|
||||
if (used > 0)
|
||||
drain(tankIndex, used, true);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean tankAcceptsFluid(IFluidTank tank, FluidStack fluidStack) {
|
||||
if (fluidStack == null)
|
||||
return false;
|
||||
if (tank.fill(fluidStack, false) > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean tankCanDrainFluid(IFluidTank tank, FluidStack fluidStack) {
|
||||
if (fluidStack == null)
|
||||
return false;
|
||||
FluidStack drained = tank.drain(1, false);
|
||||
if (drained != null && drained.amount > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*******************************************************************************
|
||||
* 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.fluids.tanks;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public final class FakeTank extends StandardTank {
|
||||
|
||||
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() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*******************************************************************************
|
||||
* 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.fluids.tanks;
|
||||
|
||||
import forestry.core.gui.tooltips.ToolTipLine;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public class FilteredTank extends StandardTank {
|
||||
|
||||
private final Fluid filter;
|
||||
|
||||
public FilteredTank(int capacity, Fluid filter) {
|
||||
this(capacity, filter, null);
|
||||
}
|
||||
|
||||
public FilteredTank(int capacity, Fluid filter, TileEntity tile) {
|
||||
super(capacity, tile);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
if (liquidMatchesFilter(resource))
|
||||
return super.fill(resource, doFill);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Fluid getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
public boolean liquidMatchesFilter(FluidStack resource) {
|
||||
if (resource == null || filter == null)
|
||||
return false;
|
||||
return resource.getFluid() == filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void refreshTooltip() {
|
||||
toolTip.clear();
|
||||
int amount = 0;
|
||||
if (filter != null) {
|
||||
EnumRarity rarity = filter.getRarity();
|
||||
if (rarity == null)
|
||||
rarity = EnumRarity.common;
|
||||
ToolTipLine name = new ToolTipLine(filter.getLocalizedName(), rarity.rarityColor);
|
||||
name.setSpacing(2);
|
||||
toolTip.add(name);
|
||||
if (getFluid() != null)
|
||||
amount = getFluid().amount;
|
||||
}
|
||||
toolTip.add(new ToolTipLine(String.format("%,d", amount) + " / " + String.format("%,d", getCapacity())));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/*******************************************************************************
|
||||
* 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.fluids.tanks;
|
||||
|
||||
import forestry.core.gui.tooltips.ToolTip;
|
||||
import forestry.core.gui.tooltips.ToolTipLine;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info>
|
||||
*/
|
||||
public class StandardTank extends FluidTank {
|
||||
|
||||
public static final int DEFAULT_COLOR = 0xFFFFFF;
|
||||
public int colorCache = DEFAULT_COLOR;
|
||||
private int tankIndex;
|
||||
|
||||
public StandardTank(int capacity) {
|
||||
super(capacity);
|
||||
}
|
||||
|
||||
public StandardTank(FluidStack fluid, int capacity) {
|
||||
this(capacity);
|
||||
setFluid(fluid);
|
||||
}
|
||||
|
||||
public StandardTank(int capacity, TileEntity tile) {
|
||||
this(capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public StandardTank(FluidStack fluid, int capacity, TileEntity tile) {
|
||||
this(capacity);
|
||||
this.tile = tile;
|
||||
setFluid(fluid);
|
||||
}
|
||||
|
||||
public void setTankIndex(int index) {
|
||||
this.tankIndex = index;
|
||||
}
|
||||
|
||||
public int getTankIndex() {
|
||||
return tankIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluid(FluidStack fluid) {
|
||||
super.setFluid(fluid);
|
||||
colorCache = StandardTank.DEFAULT_COLOR;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
Fluid f = getFluidType();
|
||||
if (f == null)
|
||||
return DEFAULT_COLOR;
|
||||
return f.getColor(getFluid());
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return getFluid() == null || getFluid().amount <= 0;
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return getFluid() != null && getFluid().amount == getCapacity();
|
||||
}
|
||||
|
||||
public int getRemainingSpace() {
|
||||
return capacity - getFluidAmount();
|
||||
}
|
||||
|
||||
public Fluid getFluidType() {
|
||||
return getFluid() != null ? getFluid().getFluid() : null;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
if (maxDrain <= 0)
|
||||
return null;
|
||||
return super.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
||||
@@ -30,7 +30,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 IRenderableMachine, IEnergySink, IEnergyHandler {
|
||||
|
||||
@@ -153,7 +153,7 @@ public abstract class TilePowered extends TileBase implements IRenderableMachine
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public abstract class GuiAlyzer extends GuiForestry<TileForestry> {
|
||||
protected HashMap<String, ItemStack> iconStacks = new HashMap<String, ItemStack>();
|
||||
|
||||
public GuiAlyzer(ISpeciesRoot speciesRoot, EntityPlayer player, ContainerForestry container, IInventory inventory, int pageMax, int pageSize) {
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/beealyzer.png", container);
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/beealyzer2.png", container);
|
||||
|
||||
xSize = 246;
|
||||
ySize = 238;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -243,6 +243,9 @@ public class ProxyCommon {
|
||||
}
|
||||
|
||||
public boolean isModLoaded(String modname, String versionRangeString) {
|
||||
if (!isModLoaded(modname))
|
||||
return false;
|
||||
|
||||
if (versionRangeString != null) {
|
||||
ModContainer mod = Loader.instance().getIndexedModList().get(modname);
|
||||
ArtifactVersion modVersion = mod.getProcessedVersion();
|
||||
@@ -254,7 +257,7 @@ public class ProxyCommon {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isModLoaded(modname);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object instantiateIfModLoaded(String modname, String className) {
|
||||
|
||||
@@ -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())));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*******************************************************************************
|
||||
* 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 com.google.common.collect.ForwardingList;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.nbt.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info/>
|
||||
*/
|
||||
public class NBTUtil {
|
||||
|
||||
public enum EnumNBTType {
|
||||
|
||||
END(NBTTagEnd.class),
|
||||
BYTE(NBTTagByte.class),
|
||||
SHORT(NBTTagShort.class),
|
||||
INT(NBTTagInt.class),
|
||||
LONG(NBTTagLong.class),
|
||||
FLOAT(NBTTagFloat.class),
|
||||
DOUBLE(NBTTagDouble.class),
|
||||
BYTE_ARRAY(NBTTagByteArray.class),
|
||||
STRING(NBTTagString.class),
|
||||
LIST(NBTTagList.class),
|
||||
COMPOUND(NBTTagCompound.class),
|
||||
INT_ARRAY(NBTTagIntArray.class);
|
||||
public static final EnumNBTType[] VALUES = values();
|
||||
public final Class<? extends NBTBase> classObject;
|
||||
|
||||
private EnumNBTType(Class<? extends NBTBase> c) {
|
||||
this.classObject = c;
|
||||
}
|
||||
|
||||
public static EnumNBTType fromClass(Class<? extends NBTBase> c) {
|
||||
for (EnumNBTType type : VALUES) {
|
||||
if (type.classObject == c)
|
||||
return type;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static <T extends NBTBase> NBTList<T> getNBTList(NBTTagCompound nbt, String tag, EnumNBTType type) {
|
||||
NBTTagList nbtList = nbt.getTagList(tag, type.ordinal());
|
||||
return new NBTList<T>(nbtList);
|
||||
}
|
||||
|
||||
public static class NBTList<T extends NBTBase> extends ForwardingList<T> {
|
||||
|
||||
private final ArrayList<T> backingList;
|
||||
private final NBTTagList nbtList;
|
||||
|
||||
public NBTList(NBTTagList nbtList) {
|
||||
this.nbtList = nbtList;
|
||||
backingList = ObfuscationReflectionHelper.getPrivateValue(NBTTagList.class, nbtList, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<T> delegate() {
|
||||
return backingList;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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 };
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,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;
|
||||
@@ -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.StackUtils;
|
||||
@@ -150,7 +150,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");
|
||||
|
||||
@@ -217,7 +217,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"));
|
||||
|
||||
@@ -496,8 +496,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
|
||||
|
||||
@@ -41,6 +41,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;
|
||||
@@ -48,7 +49,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;
|
||||
@@ -215,7 +215,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;
|
||||
@@ -289,7 +289,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"));
|
||||
|
||||
@@ -682,8 +682,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
|
||||
|
||||
@@ -38,7 +38,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;
|
||||
@@ -231,7 +231,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;
|
||||
|
||||
@@ -286,7 +286,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"));
|
||||
|
||||
@@ -581,7 +581,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 };
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -181,9 +181,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;
|
||||
@@ -246,8 +246,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"));
|
||||
@@ -687,8 +687,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 */
|
||||
|
||||
@@ -45,7 +45,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;
|
||||
@@ -117,7 +117,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;
|
||||
@@ -213,7 +213,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"));
|
||||
|
||||
@@ -528,8 +528,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 */
|
||||
|
||||
@@ -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;
|
||||
@@ -117,9 +117,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");
|
||||
|
||||
@@ -174,8 +174,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"));
|
||||
@@ -485,8 +485,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 */
|
||||
|
||||
@@ -103,7 +103,7 @@ public class GuiWorktable extends GuiForestryTitled<TileWorktable> {
|
||||
protected ContainerWorktable container;
|
||||
|
||||
public GuiWorktable(EntityPlayer player, TileWorktable tile) {
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/worktable.png", new ContainerWorktable(player, tile), tile);
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/worktable2.png", new ContainerWorktable(player, tile), tile);
|
||||
|
||||
ySize = 218;
|
||||
worktable = tile;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class GuiTrader extends GuiForestry<MachineTrader> {
|
||||
private final ContainerTrader container;
|
||||
|
||||
public GuiTrader(InventoryPlayer inventoryplayer, MachineTrader tile) {
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/mailtrader.png", new ContainerTrader(inventoryplayer, tile), tile);
|
||||
super(Defaults.TEXTURE_PATH_GUI + "/mailtrader2.png", new ContainerTrader(inventoryplayer, tile), tile);
|
||||
this.xSize = 226;
|
||||
this.ySize = 220;
|
||||
|
||||
|
||||
Reference in new issue
Block a user