From feed1ee6c0eec794e56622c5c47d9df2c4a3dfef Mon Sep 17 00:00:00 2001 From: minjaesong Date: Mon, 26 Aug 2024 01:47:41 +0900 Subject: [PATCH] fix: touching the bottom of the world would crash the game because setFluid did not coerce the coords --- src/net/torvald/terrarum/gameworld/GameWorld.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/net/torvald/terrarum/gameworld/GameWorld.kt b/src/net/torvald/terrarum/gameworld/GameWorld.kt index 921ee501b..1b44f2161 100644 --- a/src/net/torvald/terrarum/gameworld/GameWorld.kt +++ b/src/net/torvald/terrarum/gameworld/GameWorld.kt @@ -770,6 +770,8 @@ open class GameWorld( wallDamages[LandUtil.getBlockAddr(this, x, y)] ?: 0f fun setFluid(x: Int, y: Int, fluidType: ItemID, fill: Float) { + val (x, y) = coerceXY(x, y) + if (!fluidType.isFluid() && fluidType != Block.AIR) throw IllegalArgumentException("Fluid type is not actually fluid: $fluidType") /*if (x == 60 && y == 256) {