public class WorldUtil
extends java.lang.Object
| Constructor and Description |
|---|
WorldUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends net.minecraft.world.storage.WorldSavedData> |
getSaveData(net.minecraft.world.server.ServerWorld world,
java.lang.String name,
java.util.function.Supplier<T> defaultData)
Get a saved instance (own implementation) of
WorldSavedData. |
static net.minecraft.world.server.ServerWorld |
getServerWorld(net.minecraft.entity.Entity entity,
net.minecraft.world.dimension.DimensionType type)
Get the
ServerWorld from the DimensionType |
static net.minecraft.world.server.ServerWorld |
getServerWorld(net.minecraft.server.MinecraftServer server,
net.minecraft.world.dimension.DimensionType type)
Get the
ServerWorld from the DimensionType |
static net.minecraft.util.math.RayTraceResult |
rayTraceServerSide(net.minecraft.entity.Entity entity,
double range)
Raytrace from an entities look vector for collisions in range.
|
static net.minecraft.util.math.RayTraceResult |
rayTraceServerSide(net.minecraft.entity.Entity entity,
double range,
net.minecraft.util.math.RayTraceContext.BlockMode blockMode,
net.minecraft.util.math.RayTraceContext.FluidMode fluidMode)
Raytrace from an entities look vector for collisions in range.
|
static void |
teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.dimension.DimensionType type,
net.minecraft.util.math.BlockPos pos)
Teleports any entity to a given location in a given
ServerWorld. |
static void |
teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.dimension.DimensionType type,
double x,
double y,
double z,
float yaw,
float pitch)
Teleports any entity to a given location in a given
DimensionType. |
static void |
teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.dimension.DimensionType type,
net.minecraft.util.math.Vec3d pos)
Teleports any entity to a given location in a given
ServerWorld. |
static void |
teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.server.ServerWorld world,
net.minecraft.util.math.BlockPos pos)
Teleports any entity to a given location in a given
ServerWorld. |
static void |
teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.server.ServerWorld world,
double x,
double y,
double z,
float yaw,
float pitch)
Teleports any entity to a given location in a given
ServerWorld. |
static void |
teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.server.ServerWorld world,
net.minecraft.util.math.Vec3d pos)
Teleports any entity to a given location in a given
ServerWorld. |
public static net.minecraft.util.math.RayTraceResult rayTraceServerSide(net.minecraft.entity.Entity entity,
double range)
RayTraceContext.BlockMode.OUTLINE and
fluid mode RayTraceContext.FluidMode.NONE.entity - Entity from where we get the look vectorrange - Range in blocksWorldUtil#rayTraceServerSide(Entity, double, BlockMode, FluidMode)public static net.minecraft.util.math.RayTraceResult rayTraceServerSide(net.minecraft.entity.Entity entity,
double range,
net.minecraft.util.math.RayTraceContext.BlockMode blockMode,
net.minecraft.util.math.RayTraceContext.FluidMode fluidMode)
entity - Entity from where we get the look vectorrange - Range in blocksblockMode - Mode for block collisionsfluidMode - Mode for fluid collisionspublic static <T extends net.minecraft.world.storage.WorldSavedData> T getSaveData(net.minecraft.world.server.ServerWorld world,
java.lang.String name,
java.util.function.Supplier<T> defaultData)
WorldSavedData. If it does not exist, a new one is created.T - Custom world save data classworld - Server worldname - Name of this datadefaultData - Supplier for creating an instance and for the default instancepublic static net.minecraft.world.server.ServerWorld getServerWorld(net.minecraft.entity.Entity entity,
net.minecraft.world.dimension.DimensionType type)
ServerWorld from the DimensionTypeentity - An entity used to get the server instance with Entity.getServer()type - The dimension typepublic static net.minecraft.world.server.ServerWorld getServerWorld(net.minecraft.server.MinecraftServer server,
net.minecraft.world.dimension.DimensionType type)
ServerWorld from the DimensionTypeserver - The server instancetype - The dimension typepublic static void teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.dimension.DimensionType type,
net.minecraft.util.math.BlockPos pos)
ServerWorld. Don't change the yaw and pitch of the
entity.entity - The entity to teleporttype - The dimension type where the entity should be teleported. Can be the same as the current dimension type
or a different onepos - The position the entity should be teleported topublic static void teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.dimension.DimensionType type,
net.minecraft.util.math.Vec3d pos)
ServerWorld. Don't change the yaw and pitch of the
entity.entity - The entity to teleporttype - The dimension type where the entity should be teleported. Can be the same as the current dimension type
or a different onepos - The position the entity should be teleported topublic static void teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.server.ServerWorld world,
net.minecraft.util.math.BlockPos pos)
ServerWorld. Don't change the yaw and pitch of the
entity.entity - The entity to teleportworld - The server world where the entity should be teleported. Can be the same as the current world or a
different onepos - The position the entity should be teleported topublic static void teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.server.ServerWorld world,
net.minecraft.util.math.Vec3d pos)
ServerWorld. Don't change the yaw and pitch of the
entity.entity - The entity to teleportworld - The server world where the entity should be teleported. Can be the same as the current world or a
different onepos - The position the entity should be teleported topublic static void teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.dimension.DimensionType type,
double x,
double y,
double z,
float yaw,
float pitch)
DimensionType.entity - The entity to teleporttype - The dimension type where the entity should be teleported. Can be the same as the current dimension type
or a different onex - X-Coordinatey - Y-Coordinatez - Z-Coordinateyaw - Yawpitch - Pitchpublic static void teleportEntity(net.minecraft.entity.Entity entity,
net.minecraft.world.server.ServerWorld world,
double x,
double y,
double z,
float yaw,
float pitch)
ServerWorld.entity - The entity to teleportworld - The server world where the entity should be teleported. Can be the same as the current world or a
different onex - X-Coordinatey - Y-Coordinatez - Z-Coordinateyaw - Yawpitch - Pitch