Fabric API

Fabric API

152M Downloads

Viscosity docs and values don't match

Juuxel opened this issue ยท 0 comments

commented

See discord discussion from June: https://discord.com/channels/507304429255393322/566276937035546624/1381974723977678970

The transfer API docs claim that this formula can be used to calculate the viscosity of a flowable fluid:

/**
* For flowable fluids, the viscosity should match {@code VISCOSITY_RATIO} * {@link FlowableFluid#getMaxFlowDistance}.
*/
public static final int VISCOSITY_RATIO = 200;

However, TAPI itself doesn't follow this formula. The max flow distances for water and lava are normally 4 and 2 respectively, so they should have viscosities 800 and 400, but they're defined as 1000 and 6000 instead.

To make matters worse, there's yet another incorrect constant for viscosity (LAVA_VISCOSITY_NETHER) which does not match the expected value calculated with the formula, nor does it even match the viscosity of another fluid with the same flow distance (water).

public static final int WATER_VISCOSITY = 1000;
public static final int LAVA_VISCOSITY = 6000;
public static final int LAVA_VISCOSITY_NETHER = 2000;

I'm not sure if these values are useful at all - if they aren't, the viscosity attribute should probably be deprecated. The ratio constant is clearly wrong and should be deprecated for removal.