Class PrefabUtil

java.lang.Object
com.hypixel.hytale.server.core.util.PrefabUtil

public class PrefabUtil extends Object
Since:
12.06.2020
  • Field Details

  • Constructor Details

    • PrefabUtil

      public PrefabUtil()
  • Method Details

    • prefabMatchesAtPosition

      public static boolean prefabMatchesAtPosition(@Nonnull IPrefabBuffer prefabBuffer, World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation yaw, Random random)
    • canPlacePrefab

      public static boolean canPlacePrefab(@Nonnull IPrefabBuffer prefabBuffer, World world, @Nonnull org.joml.Vector3ic position, @Nonnull Rotation yaw, @Nullable it.unimi.dsi.fastutil.ints.IntSet mask, Random random, boolean ignoreOrigin)
    • getNextPrefabId

      public static int getNextPrefabId()
    • loadPasteRegionIfInMemory

      @Nonnull public static PrefabUtil.PasteRegion loadPasteRegionIfInMemory(@Nonnull IPrefabBuffer prefab, @Nonnull World world, @Nonnull org.joml.Vector3ic origin, @Nonnull PrefabRotation rotation)
      Loads the chunk data required to paste the specified prefab buffer with the provided origin position and rotation, if already in memory, into a PrefabUtil.PasteRegion.
      Parameters:
      prefab - The prefab to load the chunks for. Must not be null.
      world - The world in which chunks will be loaded. Must not be null.
      origin - The world coordinates at which the prefab will be pasted. Must not be null.
      rotation - The rotation to be applied to the prefab. Must not be null.
      Returns:
      A PrefabUtil.PasteRegion containing the loaded chunks. The region may be incomplete if any chunks are not currently in memory. This can be checked via PrefabUtil.PasteRegion.isFullyLoaded().
    • loadPasteRegionAsync

      @Nonnull public static CompletableFuture<PrefabUtil.PasteRegion> loadPasteRegionAsync(@Nonnull IPrefabBuffer prefab, @Nonnull World world, @Nonnull org.joml.Vector3ic origin, @Nonnull PrefabRotation rotation, int chunkLoadFlags)
      Asynchronously loads the chunks required to paste the specified prefab buffer with the provided origin position and rotation. The returned CompletableFuture holds a PrefabUtil.PasteRegion containing the loaded chunks.
      Parameters:
      prefab - The prefab to load the chunks for. Must not be null.
      world - The world in which chunks will be loaded. Must not be null.
      origin - The world coordinates at which the prefab will be pasted. Must not be null.
      rotation - The rotation to be applied to the prefab. Must not be null.
      chunkLoadFlags - The flags specifying the chunk loading behavior for the resulting load requests.
      Returns:
      A CompletableFuture that completes with a PrefabUtil.PasteRegion containing the loaded chunks. The region may be incomplete depending on the flags used to request the chunks. This can be checked via PrefabUtil.PasteRegion.isFullyLoaded().
    • paste

      public static void paste(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation yaw, @Nonnull Random random, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Pastes a prefab from the given buffer into the specified world at a defined position, with a specified rotation and default settings for the paste and set-block behavior.
      Parameters:
      buffer - The prefab buffer that contains the data to be pasted. Must not be null.
      world - The world in which the prefab will be pasted. Must not be null.
      position - The position in the world where the prefab will be pasted. Must not be null.
      yaw - The rotation to apply to the prefab during pasting. Must not be null.
      random - The random instance for procedural generation and randomization during the pasting process. Must not be null.
      componentAccessor - The entity store ComponentAccessor for the world.
    • paste

      public static void paste(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation yaw, @Nonnull Random random, int pasteFlags, int setBlockSettings, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Pastes a prefab from the given buffer into the specified world at a defined position, with a specified rotation and settings for the paste and set-block behavior.
      Parameters:
      buffer - The prefab buffer that contains the data to be pasted. Must not be null.
      world - The world in which the prefab will be pasted. Must not be null.
      position - The position in the world where the prefab will be pasted. Must not be null.
      yaw - The rotation to apply to the prefab during pasting. Must not be null.
      random - The random instance for procedural generation and randomization during the pasting process. Must not be null.
      pasteFlags - The flags that control the behavior of the paste operation. See PrefabUtil.Flags.
      setBlockSettings - The flags that control the behavior of block changes in the world. See SetBlockSettings.
      componentAccessor - The entity store ComponentAccessor for the world.
    • paste

      public static void paste(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation yaw, @Nonnull Random random, int pasteFlags, int setBlockSettings, @Nonnull Consumer<Holder<ChunkStore>> blockEntityConsumer, @Nonnull Consumer<Holder<EntityStore>> entityConsumer, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Pastes a prefab from the given buffer into the specified world at a defined position, with a specified rotation and settings for the paste and set-block behavior.
      Parameters:
      buffer - The prefab buffer that contains the data to be pasted. Must not be null.
      world - The world in which the prefab will be pasted. Must not be null.
      position - The position in the world where the prefab will be pasted. Must not be null.
      yaw - The rotation to apply to the prefab during pasting. Must not be null.
      random - The random instance for procedural generation and randomization during the pasting process. Must not be null.
      pasteFlags - The flags that control the behavior of the paste operation. See PrefabUtil.Flags.
      setBlockSettings - The flags that control the behavior of block changes in the world. See SetBlockSettings.
      blockEntityConsumer - A consumer to handle any block entities created during the paste operation. Must not be null.
      entityConsumer - A consumer to handle any entities created during the paste operation. Must not be null.
      componentAccessor - The entity store ComponentAccessor for the world.
    • paste

      public static void paste(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation yaw, @Nonnull Random random, int pasteFlags, int setBlockSettings, @Nullable PrefabUtil.PasteRegion pasteRegion, @Nonnull Consumer<Holder<ChunkStore>> blockEntityConsumer, @Nonnull Consumer<Holder<EntityStore>> entityConsumer, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Pastes a prefab from the given buffer into the specified world at a defined position, with a specified rotation and settings for the paste and set-block behavior.
      Parameters:
      buffer - The prefab buffer that contains the data to be pasted. Must not be null.
      world - The world in which the prefab will be pasted. Must not be null.
      position - The position in the world where the prefab will be pasted. Must not be null.
      yaw - The rotation to apply to the prefab during pasting. Must not be null.
      random - The random instance for procedural generation and randomization during the pasting process. Must not be null.
      pasteFlags - The flags that control the behavior of the paste operation. See PrefabUtil.Flags.
      setBlockSettings - The flags that control the behavior of block changes in the world. See SetBlockSettings.
      pasteRegion - A preloaded PrefabUtil.PasteRegion containing the chunks at the paste area in the world.
      blockEntityConsumer - A consumer of any block entities created during the paste operation. Must not be null.
      entityConsumer - A consumer of any entities created during the paste operation. Must not be null.
      componentAccessor - The entity store ComponentAccessor for the world.
    • remove

      public static void remove(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation prefabRotation, @Nonnull Random random, int pasteFlags, int setBlockSettings, double brokenParticlesRate)
      Removes a specified prefab buffer from the world at the given position with the specified settings.
      Parameters:
      buffer - The prefab buffer to be removed, providing the structure data.
      world - The world in which the structure is located.
      position - The position in the world where the prefab should be removed.
      prefabRotation - The rotation of the prefab that affects how it is removed.
      random - A random instance used to handle stochastic processes during removal.
      pasteFlags - Flags defining the behavior or conditions for removing the prefab.
      setBlockSettings - Settings specifying how blocks are handled during removal.
      brokenParticlesRate - Specifies the rate at which particles are generated for broken blocks.
    • remove

      public static void remove(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation prefabRotation, @Nonnull Random random, int pasteFlags, int setBlockSettings, double brokenParticlesRate, @Nullable PrefabUtil.PasteRegion pasteRegion)
      Removes a specified prefab buffer from the world at the given position with the specified settings.
      Parameters:
      buffer - The prefab buffer to be removed, providing the structure data.
      world - The world in which the structure is located.
      position - The position in the world where the prefab should be removed.
      prefabRotation - The rotation of the prefab that affects how it is removed.
      random - A random instance used to handle stochastic processes during removal.
      pasteFlags - Flags defining the behavior or conditions for removing the prefab.
      setBlockSettings - Settings specifying how blocks are handled during removal.
      brokenParticlesRate - Specifies the rate at which particles are generated for broken blocks.
      pasteRegion - The region of the world that the prefab is being removed from.
    • paste

      @Deprecated(forRemoval=true, since="2026-06-16") public static void paste(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation yaw, boolean force, Random random, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Pastes a prefab from the given buffer into the specified world at a defined position, with a specified rotation and default settings for the paste and set-block behavior.
    • paste

      @Deprecated(forRemoval=true, since="2026-06-16") public static void paste(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation yaw, boolean force, Random random, int setBlockSettings, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Pastes a prefab from the given buffer into the specified world at a defined position, with a specified rotation and default settings for the paste and set-block behavior.
    • paste

      @Deprecated(forRemoval=true, since="2026-06-16") public static void paste(@Nonnull IPrefabBuffer buffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, @Nonnull Rotation yaw, boolean force, Random random, int setBlockSettings, boolean technicalPaste, boolean pasteAnchorAsBlock, boolean loadEntities, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Pastes a prefab from the given buffer into the specified world at a defined position, with a specified rotation and default settings for the paste and set-block behavior.
    • remove

      @Deprecated(forRemoval=true, since="2026-06-16") public static void remove(@Nonnull IPrefabBuffer prefabBuffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, boolean force, @Nonnull Random random, int setBlockSettings)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Removes a prefab from the given world at the specified position, applying the provided settings and options.
    • remove

      @Deprecated(forRemoval=true, since="2026-06-16") public static void remove(@Nonnull IPrefabBuffer prefabBuffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, boolean force, @Nonnull Random random, int setBlockSettings, double brokenParticlesRate)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Removes a prefab from the given world at the specified position, applying the provided settings and options.
    • remove

      @Deprecated(forRemoval=true, since="2026-06-16") public static void remove(@Nonnull IPrefabBuffer prefabBuffer, @Nonnull World world, @Nonnull org.joml.Vector3i position, Rotation prefabRotation, boolean force, @Nonnull Random random, int setBlockSettings, double brokenParticlesRate)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Removes a prefab from the given world at the specified position, applying the provided settings and options.