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;
}
}
Aggregations