Interface WorldFluidNms


@Internal public interface WorldFluidNms
What world fluids (D46) need from the server's own classes: client-only key biomes in the registry data, biome-only chunk updates, and the attribute modifiers of viscosity. MachineEngine's own; addons use WorldFluids.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    A biome sent only to clients: a copy of the base biome with these colors (0xRRGGBB).
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    checkBiomeWriter(int clientSize)
    Writes random biome sections as sendBiomes(Collection, World, int, int, LongToIntFunction, int) does and reads them back with the server's own reader, as the client does.
    void
    install(@NotNull net.kyori.adventure.key.Key baseBiome, @NotNull List<WorldFluidNms.KeyBiome> keyBiomes, @Nullable Integer uniformWater, @NotNull IntConsumer onBaseCount, @NotNull Consumer<String> log)
    Rewrites the biome registry data sent to each joining player: keyBiomes are appended after the server's biomes (key biome i gets client id base + i), and with uniformWater every server biome's water color becomes that color.
    boolean
    sendBiomes(@NotNull Collection<? extends org.bukkit.entity.Player> viewers, @NotNull org.bukkit.World world, int chunkX, int chunkZ, @NotNull LongToIntFunction cellIds, int clientSize)
    Sends only a chunk's biomes (no blocks, no light) to viewers.
    void
     
    void
    viscosity(@NotNull org.bukkit.entity.Player player, @Nullable Viscosity viscosity)
    Applies a fluid's viscosity to a player as attribute modifiers, or removes them (null).
  • Method Details

    • install

      void install(@NotNull @NotNull net.kyori.adventure.key.Key baseBiome, @NotNull @NotNull List<WorldFluidNms.KeyBiome> keyBiomes, @Nullable @Nullable Integer uniformWater, @NotNull @NotNull IntConsumer onBaseCount, @NotNull @NotNull Consumer<String> log)
      Rewrites the biome registry data sent to each joining player: keyBiomes are appended after the server's biomes (key biome i gets client id base + i), and with uniformWater every server biome's water color becomes that color.
      Parameters:
      onBaseCount - receives the number of server biomes (base) at each join
    • uninstall

      void uninstall()
    • sendBiomes

      boolean sendBiomes(@NotNull @NotNull Collection<? extends org.bukkit.entity.Player> viewers, @NotNull @NotNull org.bukkit.World world, int chunkX, int chunkZ, @NotNull @NotNull LongToIntFunction cellIds, int clientSize)
      Sends only a chunk's biomes (no blocks, no light) to viewers. Runs on the chunk's thread.
      Parameters:
      cellIds - the client biome id of a cell (packed like BlockPos.asLong, in cell coordinates), or -1 to keep the chunk's own biome there
      clientSize - the number of biomes the client knows (server biomes and key biomes)
      Returns:
      false when the chunk is not loaded
    • checkBiomeWriter

      @NotNull @NotNull String checkBiomeWriter(int clientSize)
      Writes random biome sections as sendBiomes(Collection, World, int, int, LongToIntFunction, int) does and reads them back with the server's own reader, as the client does.
      Returns:
      how many of how many sections read back the same ("200/200" when the format is right)
    • viscosity

      void viscosity(@NotNull @NotNull org.bukkit.entity.Player player, @Nullable @Nullable Viscosity viscosity)
      Applies a fluid's viscosity to a player as attribute modifiers, or removes them (null).