1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion-2.git synced 2025-04-14 12:15:44 +02:00

Fix invalid Line particle shape when amount of points equals 1

This commit is contained in:
chylex 2019-01-18 12:48:11 +01:00
parent f8660f4af5
commit 1545f62ff3

View File

@ -26,6 +26,9 @@ interface IShape{
constructor(startPoint: Vec3d, endPoint: Vec3d, distanceBetweenPoints: Double) : this(startPoint, endPoint, (startPoint.distanceTo(endPoint) / distanceBetweenPoints).ceilToInt())
constructor(startPos: BlockPos, endPos: BlockPos, distanceBetweenPoints: Double) : this(startPos.center, endPos.center, distanceBetweenPoints)
override val points: Collection<Vec3d> = (0 until points).map { startPoint.offsetTowards(endPoint, it.toDouble() / (points - 1)) }
override val points: Collection<Vec3d> = if (points == 1)
listOf(startPoint)
else
(0 until points).map { startPoint.offsetTowards(endPoint, it.toDouble() / (points - 1)) }
}
}