Search in sources :

Example 6 with BasinTileEntity

use of com.simibubi.create.content.contraptions.processing.BasinTileEntity in project Create by Creators-of-Create.

the class BasinFluidParticle method tick.

@Override
public void tick() {
    super.tick();
    quadSize = targetPos != null ? Math.max(1 / 32f, ((1f * age) / lifetime) / 8) : 1 / 8f * (1 - ((Math.abs(age - (lifetime / 2)) / (1f * lifetime))));
    if (age % 2 == 0) {
        if (!AllBlocks.BASIN.has(level.getBlockState(basinPos))) {
            remove();
            return;
        }
        BlockEntity tileEntity = level.getBlockEntity(basinPos);
        if (tileEntity instanceof BasinTileEntity) {
            float totalUnits = ((BasinTileEntity) tileEntity).getTotalFluidUnits(0);
            if (totalUnits < 1)
                totalUnits = 0;
            float fluidLevel = Mth.clamp(totalUnits / 2000, 0, 1);
            y = 2 / 16f + basinPos.getY() + 12 / 16f * fluidLevel + yOffset;
        }
    }
    if (targetPos != null) {
        float progess = (1f * age) / lifetime;
        Vec3 currentPos = centerOfBasin.add(targetPos.subtract(centerOfBasin).scale(progess));
        x = currentPos.x;
        z = currentPos.z;
    }
}
Also used : BasinTileEntity(com.simibubi.create.content.contraptions.processing.BasinTileEntity) Vec3(net.minecraft.world.phys.Vec3) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Aggregations

BasinTileEntity (com.simibubi.create.content.contraptions.processing.BasinTileEntity)6 ItemStack (net.minecraft.world.item.ItemStack)4 SmartInventory (com.simibubi.create.foundation.item.SmartInventory)2 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)2 ProcessingRecipe (com.simibubi.create.content.contraptions.processing.ProcessingRecipe)1 SmartFluidTankBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour)1 TankSegment (com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment)1 ItemParticleOption (net.minecraft.core.particles.ItemParticleOption)1 ItemEntity (net.minecraft.world.entity.item.ItemEntity)1 CraftingRecipe (net.minecraft.world.item.crafting.CraftingRecipe)1 Recipe (net.minecraft.world.item.crafting.Recipe)1 AABB (net.minecraft.world.phys.AABB)1 Vec3 (net.minecraft.world.phys.Vec3)1 IShapedRecipe (net.minecraftforge.common.crafting.IShapedRecipe)1 IItemHandler (net.minecraftforge.items.IItemHandler)1