From 1545f62ff355f35c027c7624036a01e5d26d7107 Mon Sep 17 00:00:00 2001 From: chylex <contact@chylex.com> Date: Fri, 18 Jan 2019 12:48:11 +0100 Subject: [PATCH] Fix invalid Line particle shape when amount of points equals 1 --- src/main/java/chylex/hee/game/particle/util/IShape.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/chylex/hee/game/particle/util/IShape.kt b/src/main/java/chylex/hee/game/particle/util/IShape.kt index d52bcf90..edb7f3b4 100644 --- a/src/main/java/chylex/hee/game/particle/util/IShape.kt +++ b/src/main/java/chylex/hee/game/particle/util/IShape.kt @@ -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)) } } }