MCPcopy Create free account
hub / github.com/McJty/TutorialV3 / placeEntity

Method placeEntity

src/main/java/com/example/tutorialv3/varia/Tools.java:28–37  ·  view source on GitHub ↗
(Entity entity, ServerLevel currentWorld, ServerLevel destWorld, float yaw, Function<Boolean, Entity> repositionEntity)

Source from the content-addressed store, hash-verified

26 public static void teleport(ServerPlayer entity, ServerLevel destination, BlockPos pos, boolean findTop) {
27 entity.changeDimension(destination, new ITeleporter() {
28 @Override
29 public Entity placeEntity(Entity entity, ServerLevel currentWorld, ServerLevel destWorld, float yaw, Function<Boolean, Entity> repositionEntity) {
30 entity = repositionEntity.apply(false);
31 int y = pos.getY();
32 if (findTop) {
33 y = destination.getHeight(Heightmap.Types.WORLD_SURFACE_WG, pos.getX(), pos.getZ());
34 }
35 entity.teleportTo(pos.getX(), y, pos.getZ());
36 return entity;
37 }
38 });
39 }
40

Callers

nothing calls this directly

Calls 1

teleportToMethod · 0.80

Tested by

no test coverage detected