Search in sources :

Example 6 with InterpolatedChasingValue

use of com.simibubi.create.foundation.utility.animation.InterpolatedChasingValue in project Create by Creators-of-Create.

the class MountedFluidStorage method updateFluid.

public void updateFluid(FluidStack fluid) {
    tank.setFluid(fluid);
    if (!(te instanceof FluidTankTileEntity))
        return;
    float fillState = tank.getFluidAmount() / (float) tank.getCapacity();
    FluidTankTileEntity tank = (FluidTankTileEntity) te;
    if (tank.getFluidLevel() == null)
        tank.setFluidLevel(new InterpolatedChasingValue().start(fillState));
    tank.getFluidLevel().target(fillState);
    IFluidTank tankInventory = tank.getTankInventory();
    if (tankInventory instanceof SmartFluidTank)
        ((SmartFluidTank) tankInventory).setFluid(fluid);
}
Also used : InterpolatedChasingValue(com.simibubi.create.foundation.utility.animation.InterpolatedChasingValue) CreativeFluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity) FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity) IFluidTank(net.minecraftforge.fluids.IFluidTank) CreativeSmartFluidTank(com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity.CreativeSmartFluidTank) SmartFluidTank(com.simibubi.create.foundation.fluid.SmartFluidTank)

Aggregations

InterpolatedChasingValue (com.simibubi.create.foundation.utility.animation.InterpolatedChasingValue)6 BlockPos (net.minecraft.core.BlockPos)2 Direction (net.minecraft.core.Direction)2 AxisDirection (net.minecraft.core.Direction.AxisDirection)2 CreativeFluidTankTileEntity (com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity)1 CreativeSmartFluidTank (com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity.CreativeSmartFluidTank)1 FluidTankTileEntity (com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity)1 Shape (com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape)1 BeltFunnelBlock (com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock)1 SmartFluidTank (com.simibubi.create.foundation.fluid.SmartFluidTank)1 HashSet (java.util.HashSet)1 CompoundTag (net.minecraft.nbt.CompoundTag)1 IntTag (net.minecraft.nbt.IntTag)1 ListTag (net.minecraft.nbt.ListTag)1 Tag (net.minecraft.nbt.Tag)1 BlockState (net.minecraft.world.level.block.state.BlockState)1 FluidAttributes (net.minecraftforge.fluids.FluidAttributes)1 FluidStack (net.minecraftforge.fluids.FluidStack)1 IFluidTank (net.minecraftforge.fluids.IFluidTank)1 FluidTank (net.minecraftforge.fluids.capability.templates.FluidTank)1