From 42c1dc0e6110050c481d24b064a8f644f7ebc230 Mon Sep 17 00:00:00 2001 From: "petrak@" Date: Mon, 30 Jan 2023 13:49:27 -0600 Subject: [PATCH] arrow vel fix also works for spectral arrows --- .../common/misc/VelocityFudging.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java b/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java index 5a3fd722..0afa1c67 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/misc/VelocityFudging.java @@ -4,6 +4,7 @@ import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.mixin.accessor.AccessorAbstractArrow; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.phys.Vec3; public class VelocityFudging { @@ -17,12 +18,15 @@ public class VelocityFudging { } }); - HexAPI.instance().registerSpecialVelocityGetter(EntityType.ARROW, arrow -> { - if (((AccessorAbstractArrow) arrow).hex$isInGround()) { - return Vec3.ZERO; - } else { - return arrow.getDeltaMovement(); - } - }); + HexAPI.instance().registerSpecialVelocityGetter(EntityType.ARROW, VelocityFudging::arrowVelocitizer); + HexAPI.instance().registerSpecialVelocityGetter(EntityType.SPECTRAL_ARROW, VelocityFudging::arrowVelocitizer); + } + + private static Vec3 arrowVelocitizer(AbstractArrow arrow) { + if (((AccessorAbstractArrow) arrow).hex$isInGround()) { + return Vec3.ZERO; + } else { + return arrow.getDeltaMovement(); + } } }