More fluid container integration, removed dead code
This commit is contained in:
parent
d332ad49b7
commit
34d55f72ea
8 changed files with 37 additions and 127 deletions
|
@ -9,7 +9,6 @@ import mekanism.client.model.ModelAtomicDisassembler;
|
|||
import mekanism.client.model.ModelEnergyCube;
|
||||
import mekanism.client.model.ModelEnergyCube.ModelEnergyCore;
|
||||
import mekanism.client.model.ModelFlamethrower;
|
||||
import mekanism.client.model.ModelFluidTank;
|
||||
import mekanism.client.model.ModelFreeRunners;
|
||||
import mekanism.client.model.ModelGasMask;
|
||||
import mekanism.client.model.ModelGasTank;
|
||||
|
@ -87,7 +86,6 @@ public class ItemRenderingHandler implements IItemRenderer
|
|||
public ModelScubaTank scubaTank = new ModelScubaTank();
|
||||
public ModelFreeRunners freeRunners = new ModelFreeRunners();
|
||||
public ModelAtomicDisassembler atomicDisassembler = new ModelAtomicDisassembler();
|
||||
public ModelFluidTank portableTank = new ModelFluidTank();
|
||||
public ModelFlamethrower flamethrower = new ModelFlamethrower();
|
||||
|
||||
private final RenderBalloon balloonRenderer = new RenderBalloon();
|
||||
|
@ -515,11 +513,11 @@ public class ItemRenderingHandler implements IItemRenderer
|
|||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "FluidTank.png"));
|
||||
|
||||
ItemBlockMachine itemMachine = (ItemBlockMachine)item.getItem();
|
||||
float targetScale = (float)(itemMachine.getFluidStack(item) != null ? itemMachine.getFluidStack(item).amount : 0)/itemMachine.getCapacity(item);
|
||||
FluidTankTier tier = FluidTankTier.values()[itemMachine.getBaseTier(item).ordinal()];
|
||||
Fluid fluid = itemMachine.getFluidStack(item) != null ? itemMachine.getFluidStack(item).getFluid() : null;
|
||||
portableTankRenderer.render(tier, fluid, itemMachine.getPrevScale(item), false, null, -0.5, -0.5, -0.5);
|
||||
portableTankRenderer.render(tier, fluid, targetScale, false, null, -0.5, -0.5, -0.5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -50,18 +50,4 @@ public interface IElectricChest
|
|||
* @return authenticated value
|
||||
*/
|
||||
public boolean getLocked(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Sets the 'open' value of this electric chest to a new value.
|
||||
* @param itemStack - electric chest ItemStack
|
||||
* @param open - new value
|
||||
*/
|
||||
public void setOpen(ItemStack itemStack, boolean open);
|
||||
|
||||
/**
|
||||
* Retrieves the 'open' value of this electric chest.
|
||||
* @param itemStack - electric chest ItemStack
|
||||
* @return open value
|
||||
*/
|
||||
public boolean getOpen(ItemStack itemStack);
|
||||
}
|
||||
|
|
|
@ -543,7 +543,6 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
|||
ItemStack filled = new ItemStack(item, 1, type.meta);
|
||||
itemMachine.setBaseTier(filled, BaseTier.ULTIMATE);
|
||||
itemMachine.setFluidStack(new FluidStack(f, itemMachine.getCapacity(filled)), filled);
|
||||
itemMachine.setPrevScale(filled, 1);
|
||||
list.add(filled);
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mekanism.common.inventory;
|
||||
|
||||
import mekanism.common.base.IElectricChest;
|
||||
import mekanism.common.base.ISustainedInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryBasic;
|
||||
|
@ -46,22 +45,12 @@ public class InventoryElectricChest extends InventoryBasic
|
|||
public void openInventory()
|
||||
{
|
||||
read();
|
||||
|
||||
if(getStack() != null)
|
||||
{
|
||||
((IElectricChest)getStack().getItem()).setOpen(getStack(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
write();
|
||||
|
||||
if(getStack() != null)
|
||||
{
|
||||
((IElectricChest)getStack().getItem()).setOpen(getStack(), false);
|
||||
}
|
||||
}
|
||||
|
||||
public void write()
|
||||
|
|
|
@ -456,18 +456,6 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(type == MachineType.FLUID_TANK)
|
||||
{
|
||||
if(world != null && !world.isRemote)
|
||||
{
|
||||
float targetScale = (float)(getFluidStack(itemstack) != null ? getFluidStack(itemstack).amount : 0)/getCapacity(itemstack);
|
||||
|
||||
if(Math.abs(getPrevScale(itemstack) - targetScale) > 0.01)
|
||||
{
|
||||
setPrevScale(itemstack, (9*getPrevScale(itemstack) + targetScale)/10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -797,48 +785,6 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
|||
|
||||
return itemStack.stackTagCompound.getBoolean("locked");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOpen(ItemStack itemStack, boolean open)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setBoolean("open", open);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getOpen(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getBoolean("open");
|
||||
}
|
||||
|
||||
public void setPrevScale(ItemStack itemStack, float prevLidAngle)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setFloat("prevScale", prevLidAngle);
|
||||
}
|
||||
|
||||
public float getPrevScale(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getFloat("prevScale");
|
||||
}
|
||||
|
||||
public void setBucketMode(ItemStack itemStack, boolean bucketMode)
|
||||
{
|
||||
|
|
|
@ -350,10 +350,21 @@ public class TileEntityFluidTank extends TileEntityContainerBlock implements IAc
|
|||
int needed = fluidTank.getCapacity()-fluidTank.getFluidAmount();
|
||||
|
||||
Coord4D top = Coord4D.get(this).getFromSide(ForgeDirection.UP);
|
||||
TileEntity topTile = top.getTileEntity(worldObj);
|
||||
|
||||
if(top.getTileEntity(worldObj) instanceof TileEntityFluidTank)
|
||||
if(topTile instanceof TileEntityFluidTank)
|
||||
{
|
||||
needed += ((TileEntityFluidTank)top.getTileEntity(worldObj)).getCurrentNeeded();
|
||||
TileEntityFluidTank topTank = (TileEntityFluidTank)topTile;
|
||||
|
||||
if(fluidTank.getFluid() != null && topTank.fluidTank.getFluid() != null)
|
||||
{
|
||||
if(fluidTank.getFluid().getFluid() != topTank.fluidTank.getFluid().getFluid())
|
||||
{
|
||||
return needed;
|
||||
}
|
||||
}
|
||||
|
||||
needed += topTank.getCurrentNeeded();
|
||||
}
|
||||
|
||||
return needed;
|
||||
|
|
|
@ -21,6 +21,7 @@ import mekanism.common.integration.IComputerIntegration;
|
|||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.FluidContainerUtils;
|
||||
import mekanism.common.util.FluidContainerUtils.FluidChecker;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.PipeUtils;
|
||||
|
@ -84,11 +85,23 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
|
|||
{
|
||||
if(inventory[0].getItem() instanceof IFluidContainerItem)
|
||||
{
|
||||
FluidContainerUtils.handleContainerItemEmpty(this, fluidTank, 0, 1);
|
||||
FluidContainerUtils.handleContainerItemEmpty(this, fluidTank, 0, 1, new FluidChecker() {
|
||||
@Override
|
||||
public boolean isValid(Fluid f)
|
||||
{
|
||||
return f.canBePlacedInWorld();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(FluidContainerRegistry.isFilledContainer(inventory[0]))
|
||||
{
|
||||
FluidContainerUtils.handleRegistryItemEmpty(this, fluidTank, 0, 1);
|
||||
FluidContainerUtils.handleRegistryItemEmpty(this, fluidTank, 0, 1, new FluidChecker() {
|
||||
@Override
|
||||
public boolean isValid(Fluid f)
|
||||
{
|
||||
return f.canBePlacedInWorld();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import mekanism.api.Coord4D;
|
|||
import mekanism.api.ISalinationSolar;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.Range4D;
|
||||
import mekanism.api.util.StackUtils;
|
||||
import mekanism.client.SparkleAnimation.INodeChecker;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.base.IActiveState;
|
||||
|
@ -229,46 +228,15 @@ public class TileEntityThermalEvaporationController extends TileEntityThermalEva
|
|||
|
||||
private void manageBuckets()
|
||||
{
|
||||
if(inventory[2] != null)
|
||||
if(inventory[2] != null && outputTank.getFluid() != null)
|
||||
{
|
||||
if(outputTank.getFluid() != null && outputTank.getFluid().amount >= FluidContainerRegistry.BUCKET_VOLUME)
|
||||
if(inventory[2].getItem() instanceof IFluidContainerItem)
|
||||
{
|
||||
if(FluidContainerRegistry.isEmptyContainer(inventory[2]))
|
||||
{
|
||||
ItemStack tempStack = FluidContainerRegistry.fillFluidContainer(outputTank.getFluid(), inventory[2]);
|
||||
|
||||
if(tempStack != null)
|
||||
{
|
||||
if(inventory[3] == null)
|
||||
{
|
||||
outputTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
|
||||
|
||||
inventory[3] = tempStack;
|
||||
inventory[2].stackSize--;
|
||||
|
||||
if(inventory[2].stackSize <= 0)
|
||||
{
|
||||
inventory[2] = null;
|
||||
}
|
||||
|
||||
markDirty();
|
||||
}
|
||||
else if(StackUtils.equalsWildcardWithNBT(tempStack, inventory[3]) && tempStack.getMaxStackSize() > inventory[3].stackSize)
|
||||
{
|
||||
outputTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
|
||||
|
||||
inventory[3].stackSize++;
|
||||
inventory[2].stackSize--;
|
||||
|
||||
if(inventory[2].stackSize <= 0)
|
||||
{
|
||||
inventory[2] = null;
|
||||
}
|
||||
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
FluidContainerUtils.handleContainerItemFill(this, outputTank, 2, 3);
|
||||
}
|
||||
else if(FluidContainerRegistry.isEmptyContainer(inventory[2]))
|
||||
{
|
||||
FluidContainerUtils.handleRegistryItemFill(this, outputTank, 2, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue