From ada80d9d0391b43cc537911c0a1401bdf50e9e5d Mon Sep 17 00:00:00 2001 From: WakelessSloth56 Date: Tue, 28 Jun 2022 02:19:42 +0800 Subject: [PATCH] feat(utils): method for teleporting entity to vec3 --- .../org/auioc/mcmod/arnicalib/utils/game/EntityUtils.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/auioc/mcmod/arnicalib/utils/game/EntityUtils.java b/src/main/java/org/auioc/mcmod/arnicalib/utils/game/EntityUtils.java index dbbcb5bd..6fd5be7f 100644 --- a/src/main/java/org/auioc/mcmod/arnicalib/utils/game/EntityUtils.java +++ b/src/main/java/org/auioc/mcmod/arnicalib/utils/game/EntityUtils.java @@ -4,7 +4,7 @@ import java.util.function.Function; import java.util.function.Predicate; import javax.annotation.Nullable; -import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySelector; import net.minecraft.world.entity.LivingEntity; @@ -23,10 +23,14 @@ public class EntityUtils { /*================================================================================================================*/ // #region Teleport - public static void teleportTo(Entity entity, BlockPos pos) { + public static void teleportTo(Entity entity, Vec3i pos) { entity.teleportTo(pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D); } + public static void teleportTo(Entity entity, Vec3 pos) { + entity.teleportTo(pos.x, pos.y, pos.z); + } + // #endregion Teleport /*================================================================================================================*/