Package net.jcm.vsch.util
Class VSCHUtils
java.lang.Object
net.jcm.vsch.util.VSCHUtils
The main class where all handy utility functions used by VSCH are stored.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.joml.Vector3dclampVector(org.joml.Vector3d force, double limit) Clamps all axis of a Vector3d between -limit and +limit (not abs).static net.minecraft.server.level.ServerLeveldimToLevel(String dimensionString) static StringdimToVSDim(String dimension) Converts a normal dimension id string of'namespace:dimension_name'to a VS dimension id string'minecraft:dimension:namespace:dimension_name'static VSCHUtils.DistanceInfogetDistanceToPlanet(net.minecraft.nbt.CompoundTag planetData, net.minecraft.world.phys.Vec3 position) Determines if a Vec3 position is colliding with / inside a planet.static List<org.valkyrienskies.core.api.ships.LoadedServerShip>getLoadedShipsInLevel(net.minecraft.server.level.ServerLevel level) static net.minecraft.nbt.CompoundTaggetNearestPlanet(net.minecraft.world.level.LevelAccessor world, net.minecraft.world.phys.Vec3 position, String dimensionId) Gets the nearest (if available) planet to the position in the dimensionId.static net.lointain.cosmos.network.CosmosModVariables.PlayerVariablesgetPlayerCap(net.minecraft.world.entity.player.Player player) Gets a players Cosmos variables capability.static net.minecraft.network.chat.Componentstatic net.minecraft.server.level.ServerLevelregisteryDimToLevel(String dimension) GetServerLevelfrom a VS dimension ID.static org.joml.primitives.AABBdtransformToAABBd(org.valkyrienskies.core.api.ships.properties.ShipTransform transform, org.joml.primitives.AABBic shipAABB) Takes in aShipTransformand its shipAABBic(its shipyardAABBic) and returns a world-basedAABBdusing the transform
Basically the same asShip#getWorldAABB()but can take in a specified transform and ship AABBicstatic StringvsDimToDim(String dimension) Converts a VS dimension id string of'minecraft:dimension:namespace:dimension_name'to a normal dimension id string of'namespace:dimension_name'
-
Constructor Details
-
VSCHUtils
public VSCHUtils()
-
-
Method Details
-
vsDimToDim
Converts a VS dimension id string of'minecraft:dimension:namespace:dimension_name'to a normal dimension id string of'namespace:dimension_name'- Parameters:
dimension- The VS format dimension id string- Returns:
- The converted dimension id string
- See Also:
-
dimToVSDim
Converts a normal dimension id string of'namespace:dimension_name'to a VS dimension id string'minecraft:dimension:namespace:dimension_name'- Parameters:
dimension- The normal format dimension id string- Returns:
- The converted VS dimension id string
- See Also:
-
transformToAABBd
public static org.joml.primitives.AABBd transformToAABBd(org.valkyrienskies.core.api.ships.properties.ShipTransform transform, org.joml.primitives.AABBic shipAABB) Takes in aShipTransformand its shipAABBic(its shipyardAABBic) and returns a world-basedAABBdusing the transform
Basically the same asShip#getWorldAABB()but can take in a specified transform and ship AABBic- Parameters:
transform- The ship transform to useshipAABB- The shipyard AABBic of the ship- Returns:
- The world based AABBd
-
registeryDimToLevel
GetServerLevelfrom a VS dimension ID.- Parameters:
dimension- The dimension ID string in format registry_namespace:registry_name:dimension_namespace:dimension_name- Returns:
- A
ServerLevelinstance with the dimension ID given
-
dimToLevel
-
getNearestPlanet
@Nullable public static net.minecraft.nbt.CompoundTag getNearestPlanet(net.minecraft.world.level.LevelAccessor world, net.minecraft.world.phys.Vec3 position, String dimensionId) Gets the nearest (if available) planet to the position in the dimensionId.- Parameters:
world- A LevelAccessor for getting Cosmos world variablesposition- The position to get the nearest planet fromdimensionId- The (normal format) dimension id to get planets from- Returns:
- A CompoundTag of the nearest planets data, or null if it couldn't be found
-
getDistanceToPlanet
public static VSCHUtils.DistanceInfo getDistanceToPlanet(@Nonnull net.minecraft.nbt.CompoundTag planetData, net.minecraft.world.phys.Vec3 position) Determines if a Vec3 position is colliding with / inside a planet. If the needed data from planetData is missing, that data will default to 0.0- Parameters:
planetData- A CompoundTag (nbt) of the planets data.position- The position to check- Returns:
- Distance to the planet's surface
- See Also:
-
getPlayerCap
public static net.lointain.cosmos.network.CosmosModVariables.PlayerVariables getPlayerCap(net.minecraft.world.entity.player.Player player) Gets a players Cosmos variables capability.- Parameters:
player- The player to get the capability of.- Returns:
- The player's capability, or null if it does not exists.
-
clampVector
public static org.joml.Vector3d clampVector(org.joml.Vector3d force, double limit) Clamps all axis of a Vector3d between -limit and +limit (not abs).- Parameters:
force- the vector to clamplimit- the limit to clamp all axis to- Returns:
- clamped
force
-
getLoadedShipsInLevel
public static List<org.valkyrienskies.core.api.ships.LoadedServerShip> getLoadedShipsInLevel(net.minecraft.server.level.ServerLevel level) -
getWarningComponent
public static net.minecraft.network.chat.Component getWarningComponent()
-