From 35f513a2a0f8eb104d62feaa66fc8aee2cabd049 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Wed, 16 Mar 2022 22:57:30 -0700 Subject: [PATCH] Contraptions were too lit - Fix bug causing potentially moving contraptions to re-upload their light every tick - Reduces tick stutter with large amounts of contraptions --- .../com/jozufozu/flywheel/util/box/ImmutableBox.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/jozufozu/flywheel/util/box/ImmutableBox.java b/src/main/java/com/jozufozu/flywheel/util/box/ImmutableBox.java index 10a5c7a91..f87903d96 100644 --- a/src/main/java/com/jozufozu/flywheel/util/box/ImmutableBox.java +++ b/src/main/java/com/jozufozu/flywheel/util/box/ImmutableBox.java @@ -42,6 +42,15 @@ public interface ImmutableBox { return getMinX() == other.getMinX() && getMinY() == other.getMinY() && getMinZ() == other.getMinZ() && getMaxX() == other.getMaxX() && getMaxY() == other.getMaxY() && getMaxZ() == other.getMaxZ(); } + default boolean sameAs(ImmutableBox other, int margin) { + return getMinX() == other.getMinX() - margin && + getMinY() == other.getMinY() - margin && + getMinZ() == other.getMinZ() - margin && + getMaxX() == other.getMaxX() + margin && + getMaxY() == other.getMaxY() + margin && + getMaxZ() == other.getMaxZ() + margin; + } + default boolean sameAs(AABB other) { return getMinX() == Math.floor(other.minX) && getMinY() == Math.floor(other.minY)