Class FabricDimensions
java.lang.Object
net.fabricmc.fabric.api.dimension.v1.FabricDimensions
This class consists exclusively of static methods that operate on world dimensions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends Entity>
Eteleport
(E teleported, ServerWorld destination, TeleportTarget target) Teleports an entity to a different dimension, placing it at the specified destination.
-
Method Details
-
teleport
@Nullable public static <E extends Entity> E teleport(E teleported, ServerWorld destination, TeleportTarget target) Teleports an entity to a different dimension, placing it at the specified destination.Using this method will circumvent Vanilla's portal placement code.
When teleporting to another dimension, the entity may be replaced with a new entity in the target dimension. This is not the case for players, but needs to be accounted for by the caller.
- Type Parameters:
E
- the type of the teleported entity- Parameters:
teleported
- the entity to teleportdestination
- the dimension the entity will be teleported totarget
- where the entity will be placed in the target world. As in Vanilla, the target's velocity is not applied to players. If target is null, the entity will not be teleported.- Returns:
- Returns the teleported entity in the target dimension, which may be a new entity or
teleported
, depending on the entity type. - Throws:
IllegalStateException
- if this method is called on a client entity
-