l33tmaan / ACulinaryArtillery---.NET7

4 stars 10 forks source link

Spile dripCount has unspecified unit and is ignored #21

Open bluelightning32 opened 6 months ago

bluelightning32 commented 6 months ago

No matter what I set the dripCount to, the drip size is always 10mL. The problem is with this code in BlockEntitySpile.cs:

                ItemStack drip = new ItemStack(Api.World.GetItem(new AssetLocation(xylem.sap)));

                container.TryPutLiquid(containerpos, drip, xylem.dripCount);

The 3rd parameter of TryPutLiquid is float desiredLitres. Since dripCount is an int and it defaults to 1, that would imply that each drip is 1L (vs the observed 10mL). However, TryPutLiquid will not transfer more liquid to the container than the drip item stack had available. The drip item stack is always created with exactly 1 portion, and that 1 portion is 10mL.

The best way to fix it would be to copy the BEFruitpress's logic.

  1. Create the drip item stack with 999999 items.
  2. Delete the dripCount field from the SapProperties, because it has an undefined unit.
  3. Create a new float dripLitres field (matches the litre spelling in the rest of the game) in SapProperties, and use that as the 3rd argument to TryPutLiquid.