Class WindManager

java.lang.Object
net.frozenblock.lib.wind.api.WindManager

public class WindManager extends Object
Handles wind on the server side.

One instance is created per ServerLevel.

  • Field Details

    • EXTENSION_PROVIDERS

      public static final Map<Function<WindManager,WindManagerExtension>,Integer> EXTENSION_PROVIDERS
    • attachedExtensions

      public final List<WindManagerExtension> 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

      public static void addExtension(Function<WindManager,WindManagerExtension> extension, int priority)
      Parameters:
      extension - The WindManagerExtension to add.
      priority - The priority of the added WindManagerExtension. The lower the value, the earlier it will run.
    • addExtension

      public static void addExtension(Function<WindManager,WindManagerExtension> extension)
      Adds a WindManagerExtension with a priority of 1000.
      Parameters:
      extension - The WindManagerExtension to add.
    • addWindDisturbanceAndSync

      public void addWindDisturbanceAndSync(@NotNull @NotNull WindDisturbance<?> windDisturbance)
      Adds a WindDisturbance to the world and syncs if with the client if possible.
      Parameters:
      windDisturbance - The WindDisturbance to add to the world and send to the client.
    • addWindDisturbance

      public void addWindDisturbance(@NotNull @NotNull WindDisturbance<?> windDisturbance)
      Adds a WindDisturbance to the world.
      Parameters:
      windDisturbance - The WindDisturbance to 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 the WindManager used for a given ServerLevel.
      Parameters:
      level - The ServerLevel to obtain the WindManager for.
      Returns:
      the WindManager used for the given ServerLevel.
    • createData

      @NotNull public net.minecraft.world.level.saveddata.SavedData.Factory<WindStorage> createData()
    • tick

      public void tick(@NotNull @NotNull net.minecraft.server.level.ServerLevel level)
    • createSyncPacket

      @NotNull public @NotNull WindSyncPacket 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 specified BlockPos.
      Parameters:
      pos - The BlockPos to 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 specified BlockPos, multiplied.
      Parameters:
      pos - The BlockPos to 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 specified BlockPos, multiplied and clamped.
      Parameters:
      pos - The BlockPos to 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 specified Vec3.
      Parameters:
      pos - The Vec3 to 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 specified Vec3, multiplied.
      Parameters:
      pos - The Vec3 to 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 specified Vec3, multiplied and clamped.
      Parameters:
      pos - The BlockPos to 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 specified Vec3, multiplied, clamped, and with a separately multiplied wind disturbance value.
      Parameters:
      pos - The BlockPos to 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 of WindDisturbances at a given position.
      Parameters:
      windDisturbances - The list of WindDisturbances to calculate from.
      level - The provided Level.
      pos - The Vec3 being checked.
      Returns:
      the strength and movement out of a provided list of WindDisturbances at a given position.