Search in sources :

Example 1 with LerpedFloat

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

the class TransparentStraightPipeRenderer method renderSafe.

@Override
protected void renderSafe(StraightPipeTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
    FluidTransportBehaviour pipe = te.getBehaviour(FluidTransportBehaviour.TYPE);
    if (pipe == null)
        return;
    for (Direction side : Iterate.directions) {
        Flow flow = pipe.getFlow(side);
        if (flow == null)
            continue;
        FluidStack fluidStack = flow.fluid;
        if (fluidStack.isEmpty())
            continue;
        LerpedFloat progress = flow.progress;
        if (progress == null)
            continue;
        float value = progress.getValue(partialTicks);
        boolean inbound = flow.inbound;
        if (value == 1) {
            if (inbound) {
                Flow opposite = pipe.getFlow(side.getOpposite());
                if (opposite == null)
                    value -= 1e-6f;
            } else {
                FluidTransportBehaviour adjacent = TileEntityBehaviour.get(te.getLevel(), te.getBlockPos().relative(side), FluidTransportBehaviour.TYPE);
                if (adjacent == null)
                    value -= 1e-6f;
                else {
                    Flow other = adjacent.getFlow(side.getOpposite());
                    if (other == null || !other.inbound && !other.complete)
                        value -= 1e-6f;
                }
            }
        }
        FluidRenderer.renderFluidStream(fluidStack, side, 3 / 16f, value, inbound, buffer, ms, light);
    }
}
Also used : LerpedFloat(com.simibubi.create.foundation.utility.animation.LerpedFloat) FluidStack(net.minecraftforge.fluids.FluidStack) FluidTransportBehaviour(com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour) Direction(net.minecraft.core.Direction) Flow(com.simibubi.create.content.contraptions.fluids.PipeConnection.Flow)

Example 2 with LerpedFloat

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

the class SmartFluidTankBehaviour method tick.

@Override
public void tick() {
    super.tick();
    if (syncCooldown > 0) {
        syncCooldown--;
        if (syncCooldown == 0 && queuedSync)
            updateFluids();
    }
    forEach(te -> {
        LerpedFloat fluidLevel = te.getFluidLevel();
        if (fluidLevel != null)
            fluidLevel.tickChaser();
    });
}
Also used : LerpedFloat(com.simibubi.create.foundation.utility.animation.LerpedFloat)

Example 3 with LerpedFloat

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

the class LinkedControllerItemRenderer method tick.

static void tick() {
    if (Minecraft.getInstance().isPaused())
        return;
    boolean active = LinkedControllerClientHandler.MODE != Mode.IDLE;
    equipProgress.chase(active ? 1 : 0, .2f, Chaser.EXP);
    equipProgress.tickChaser();
    if (!active)
        return;
    for (int i = 0; i < buttons.size(); i++) {
        LerpedFloat lerpedFloat = buttons.get(i);
        lerpedFloat.chase(LinkedControllerClientHandler.currentlyPressed.contains(i) ? 1 : 0, .4f, Chaser.EXP);
        lerpedFloat.tickChaser();
    }
}
Also used : LerpedFloat(com.simibubi.create.foundation.utility.animation.LerpedFloat)

Aggregations

LerpedFloat (com.simibubi.create.foundation.utility.animation.LerpedFloat)3 FluidTransportBehaviour (com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour)1 Flow (com.simibubi.create.content.contraptions.fluids.PipeConnection.Flow)1 Direction (net.minecraft.core.Direction)1 FluidStack (net.minecraftforge.fluids.FluidStack)1