Package net.frozenblock.lib.wind.api
Class WindManager
java.lang.Object
net.frozenblock.lib.wind.api.WindManager
Handles wind on the server side.
One instance is created per ServerLevel.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List<WindManagerExtension> net.minecraft.world.phys.Vec3static final Map<Function<WindManager, WindManagerExtension>, Integer> doubledoubledoublenet.minecraft.world.level.levelgen.synth.ImprovedNoisebooleanlonglongdoubledoubledouble -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddExtension(Function<WindManager, WindManagerExtension> extension) Adds aWindManagerExtensionwith a priority of 1000.static voidaddExtension(Function<WindManager, WindManagerExtension> extension, int priority) Adds aWindManagerExtension.voidaddWindDisturbance(@NotNull WindDisturbance<?> windDisturbance) Adds aWindDisturbanceto the world.voidaddWindDisturbanceAndSync(@NotNull WindDisturbance<?> windDisturbance) Adds aWindDisturbanceto the world and syncs if with the client if possible.static @NotNull com.mojang.datafixers.util.Pair<Double, net.minecraft.world.phys.Vec3> calculateWindDisturbance(@NotNull List<WindDisturbance<?>> windDisturbances, @NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.world.phys.Vec3 pos) Calculates the strength and movement out of a provided list ofWindDisturbances at a given position.voidClears all wind disturbances running on the current tick, and the stash of wind disturbances to run the next tick.voidClears all wind disturbances running on the current tick, and replaces them with the stash of wind disturbances to run on the next tick.voidClears all wind disturbances running on the current tick.net.minecraft.world.level.saveddata.SavedData.Factory<WindStorage> @NotNull WindSyncPacketstatic @NotNull WindManagergetWindManager(@NotNull net.minecraft.server.level.ServerLevel level) Returns theWindManagerused for a givenServerLevel.@NotNull net.minecraft.world.phys.Vec3getWindMovement(@NotNull net.minecraft.core.BlockPos pos) Returns the wind movement at the bottom center of a specifiedBlockPos.@NotNull net.minecraft.world.phys.Vec3getWindMovement(@NotNull net.minecraft.core.BlockPos pos, double scale) Returns the wind movement at the bottom center of a specifiedBlockPos, multiplied.@NotNull net.minecraft.world.phys.Vec3getWindMovement(@NotNull net.minecraft.core.BlockPos pos, double scale, double clamp) Returns the wind movement at the bottom center of a specifiedBlockPos, multiplied and clamped.@NotNull net.minecraft.world.phys.Vec3getWindMovement(@NotNull net.minecraft.world.phys.Vec3 pos) Returns the wind movement at the center of a specifiedVec3.@NotNull net.minecraft.world.phys.Vec3getWindMovement(@NotNull net.minecraft.world.phys.Vec3 pos, double scale) Returns the wind movement at a specifiedVec3, multiplied.@NotNull net.minecraft.world.phys.Vec3getWindMovement(@NotNull net.minecraft.world.phys.Vec3 pos, double scale, double clamp) Returns the wind movement at a specifiedVec3, multiplied and clamped.@NotNull net.minecraft.world.phys.Vec3getWindMovement(@NotNull net.minecraft.world.phys.Vec3 pos, double scale, double clamp, double windDisturbanceScale) Returns the wind movement at a specifiedVec3, multiplied, clamped, and with a separately multiplied wind disturbance value.@NotNull net.minecraft.world.phys.Vec3getWindMovement3D(@NotNull net.minecraft.core.BlockPos pos, double stretch) Deprecated.@NotNull net.minecraft.world.phys.Vec3getWindMovement3D(@NotNull net.minecraft.core.BlockPos pos, double scale, double stretch) Deprecated.@NotNull net.minecraft.world.phys.Vec3getWindMovement3D(@NotNull net.minecraft.core.BlockPos pos, double scale, double clamp, double stretch) Deprecated.@NotNull net.minecraft.world.phys.Vec3getWindMovement3D(@NotNull net.minecraft.world.phys.Vec3 pos, double stretch) Deprecated.@NotNull net.minecraft.world.phys.Vec3getWindMovement3D(@NotNull net.minecraft.world.phys.Vec3 pos, double scale, double stretch) Deprecated.@NotNull net.minecraft.world.phys.Vec3getWindMovement3D(@NotNull net.minecraft.world.phys.Vec3 pos, double scale, double clamp, double stretch) Deprecated.voidsendSync(@NotNull net.minecraft.server.level.ServerLevel level) voidsendSyncToPlayer(@NotNull WindSyncPacket packet, @NotNull net.minecraft.server.level.ServerPlayer player) voidtick(@NotNull net.minecraft.server.level.ServerLevel level)
-
Field Details
-
EXTENSION_PROVIDERS
-
attachedExtensions
-
overrideWind
public boolean overrideWind -
time
public long time -
commandWind
public net.minecraft.world.phys.Vec3 commandWind -
windX
public double windX -
windY
public double windY -
windZ
public double windZ -
laggedWindX
public double laggedWindX -
laggedWindY
public double laggedWindY -
laggedWindZ
public double laggedWindZ -
seed
public long seed -
noise
public net.minecraft.world.level.levelgen.synth.ImprovedNoise noise
-
-
Constructor Details
-
WindManager
public WindManager(@NotNull @NotNull net.minecraft.server.level.ServerLevel level)
-
-
Method Details
-
addExtension
Adds aWindManagerExtension.- Parameters:
extension- TheWindManagerExtensionto add.priority- The priority of the addedWindManagerExtension. The lower the value, the earlier it will run.
-
addExtension
Adds aWindManagerExtensionwith a priority of 1000.- Parameters:
extension- TheWindManagerExtensionto add.
-
addWindDisturbanceAndSync
Adds aWindDisturbanceto the world and syncs if with the client if possible.- Parameters:
windDisturbance- TheWindDisturbanceto add to the world and send to the client.
-
addWindDisturbance
Adds aWindDisturbanceto the world.- Parameters:
windDisturbance- TheWindDisturbanceto add.
-
clearWindDisturbances
public void clearWindDisturbances()Clears all wind disturbances running on the current tick. -
clearAllWindDisturbances
public void clearAllWindDisturbances()Clears all wind disturbances running on the current tick, and the stash of wind disturbances to run the next tick. -
clearAndSwitchWindDisturbances
public void clearAndSwitchWindDisturbances()Clears all wind disturbances running on the current tick, and replaces them with the stash of wind disturbances to run on the next tick. -
getWindManager
@NotNull public static @NotNull WindManager getWindManager(@NotNull @NotNull net.minecraft.server.level.ServerLevel level) Returns theWindManagerused for a givenServerLevel.- Parameters:
level- TheServerLevelto obtain theWindManagerfor.- Returns:
- the
WindManagerused for the givenServerLevel.
-
createData
-
tick
public void tick(@NotNull @NotNull net.minecraft.server.level.ServerLevel level) -
createSyncPacket
-
sendSync
public void sendSync(@NotNull @NotNull net.minecraft.server.level.ServerLevel level) -
sendSyncToPlayer
public void sendSyncToPlayer(@NotNull @NotNull WindSyncPacket packet, @NotNull @NotNull net.minecraft.server.level.ServerPlayer player) -
getWindMovement
@NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement(@NotNull @NotNull net.minecraft.core.BlockPos pos) Returns the wind movement at the bottom center of a specifiedBlockPos.- Parameters:
pos- TheBlockPosto check.- Returns:
- the wind movement at the center of the specified
BlockPos.
-
getWindMovement
@NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement(@NotNull @NotNull net.minecraft.core.BlockPos pos, double scale) Returns the wind movement at the bottom center of a specifiedBlockPos, multiplied.- Parameters:
pos- TheBlockPosto check.scale- Multiplies the returned value.- Returns:
- the wind movement at the bottom center of the specified
BlockPos, multiplied.
-
getWindMovement
@NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement(@NotNull @NotNull net.minecraft.core.BlockPos pos, double scale, double clamp) Returns the wind movement at the bottom center of a specifiedBlockPos, multiplied and clamped.- Parameters:
pos- TheBlockPosto check.scale- Multiplies the returned value.clamp- Clamps the returned value between the negative and positive versions of this value.- Returns:
- the wind movement at the bottom center of the specified
BlockPos, multiplied and clamped.
-
getWindMovement
@NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement(@NotNull @NotNull net.minecraft.world.phys.Vec3 pos) Returns the wind movement at the center of a specifiedVec3.- Parameters:
pos- TheVec3to check.- Returns:
- the wind movement at the specified
Vec3.
-
getWindMovement
@NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement(@NotNull @NotNull net.minecraft.world.phys.Vec3 pos, double scale) Returns the wind movement at a specifiedVec3, multiplied.- Parameters:
pos- TheVec3to check.scale- Multiplies the returned value.- Returns:
- the wind movement at the specified
Vec3, multiplied.
-
getWindMovement
@NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement(@NotNull @NotNull net.minecraft.world.phys.Vec3 pos, double scale, double clamp) Returns the wind movement at a specifiedVec3, multiplied and clamped.- Parameters:
pos- TheBlockPosto check.scale- Multiplies the returned value.clamp- Clamps the returned value between the negative and positive versions of this value.- Returns:
- the wind movement at the specified
Vec3, multiplied and clamped.
-
getWindMovement
@NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement(@NotNull @NotNull net.minecraft.world.phys.Vec3 pos, double scale, double clamp, double windDisturbanceScale) Returns the wind movement at a specifiedVec3, multiplied, clamped, and with a separately multiplied wind disturbance value.- Parameters:
pos- TheBlockPosto check.scale- Multiplies the returned value.clamp- Clamps the returned value between the negative and positive versions of this value.windDisturbanceScale- Multiplies the wind disturbance value.- Returns:
- the wind movement at the specified
Vec3, multiplied, clamped, and with a separately multiplied wind disturbance value.
-
getWindMovement3D
@Deprecated @NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement3D(@NotNull @NotNull net.minecraft.core.BlockPos pos, double stretch) Deprecated. -
getWindMovement3D
@Deprecated @NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement3D(@NotNull @NotNull net.minecraft.core.BlockPos pos, double scale, double stretch) Deprecated. -
getWindMovement3D
@Deprecated @NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement3D(@NotNull @NotNull net.minecraft.core.BlockPos pos, double scale, double clamp, double stretch) Deprecated. -
getWindMovement3D
@Deprecated @NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement3D(@NotNull @NotNull net.minecraft.world.phys.Vec3 pos, double stretch) Deprecated. -
getWindMovement3D
@Deprecated @NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement3D(@NotNull @NotNull net.minecraft.world.phys.Vec3 pos, double scale, double stretch) Deprecated. -
getWindMovement3D
@Deprecated @NotNull public @NotNull net.minecraft.world.phys.Vec3 getWindMovement3D(@NotNull @NotNull net.minecraft.world.phys.Vec3 pos, double scale, double clamp, double stretch) Deprecated. -
calculateWindDisturbance
@NotNull public static @NotNull com.mojang.datafixers.util.Pair<Double,net.minecraft.world.phys.Vec3> calculateWindDisturbance(@NotNull @NotNull List<WindDisturbance<?>> windDisturbances, @NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.world.phys.Vec3 pos) Calculates the strength and movement out of a provided list ofWindDisturbances at a given position.- Parameters:
windDisturbances- The list ofWindDisturbances to calculate from.level- The providedLevel.pos- TheVec3being checked.- Returns:
- the strength and movement out of a provided list of
WindDisturbances at a given position.
-