Skip to content

Commit

Permalink
feat(utils): method for teleporting entity to vec3
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Jun 27, 2022
1 parent dab0bfa commit ada80d9
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -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;
Expand All @@ -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

/*================================================================================================================*/
Expand Down

0 comments on commit ada80d9

Please sign in to comment.