Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- prefabMatchesAtPosition(IPrefabBuffer, World, Vector3i, Rotation, Random)
- canPlacePrefab(IPrefabBuffer, World, Vector3ic, Rotation, IntSet, Random, boolean)
- getNextPrefabId()
- loadPasteRegionIfInMemory(IPrefabBuffer, World, Vector3ic, PrefabRotation)
- loadPasteRegionAsync(IPrefabBuffer, World, Vector3ic, PrefabRotation, int)
- paste(IPrefabBuffer, World, Vector3i, Rotation, Random, ComponentAccessor)
- paste(IPrefabBuffer, World, Vector3i, Rotation, Random, int, int, ComponentAccessor)
- paste(IPrefabBuffer, World, Vector3i, Rotation, Random, int, int, Consumer, Consumer, ComponentAccessor)
- paste(IPrefabBuffer, World, Vector3i, Rotation, Random, int, int, PrefabUtil.PasteRegion, Consumer, Consumer, ComponentAccessor)
- remove(IPrefabBuffer, World, Vector3i, Rotation, Random, int, int, double)
- remove(IPrefabBuffer, World, Vector3i, Rotation, Random, int, int, double, PrefabUtil.PasteRegion)
- paste(IPrefabBuffer, World, Vector3i, Rotation, boolean, Random, ComponentAccessor)
- paste(IPrefabBuffer, World, Vector3i, Rotation, boolean, Random, int, ComponentAccessor)
- paste(IPrefabBuffer, World, Vector3i, Rotation, boolean, Random, int, boolean, boolean, boolean, ComponentAccessor)
- remove(IPrefabBuffer, World, Vector3i, boolean, Random, int)
- remove(IPrefabBuffer, World, Vector3i, boolean, Random, int, double)
- remove(IPrefabBuffer, World, Vector3i, Rotation, boolean, Random, int, double)
Class PrefabUtil
java.lang.Object
com.hypixel.hytale.server.core.util.PrefabUtil
- Since:
- 12.06.2020
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBit flags used for configuring the behavior of a prefab paste.static final classRepresents the region of the world that a prefab is being pasted into. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Consumer<Holder<ChunkStore>> static final Consumer<Holder<EntityStore>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanPlacePrefab(IPrefabBuffer prefabBuffer, World world, org.joml.Vector3ic position, Rotation yaw, it.unimi.dsi.fastutil.ints.IntSet mask, Random random, boolean ignoreOrigin) static intloadPasteRegionAsync(IPrefabBuffer prefab, World world, org.joml.Vector3ic origin, PrefabRotation rotation, int chunkLoadFlags) Asynchronously loads the chunks required to paste the specified prefab buffer with the provided origin position and rotation.static PrefabUtil.PasteRegionloadPasteRegionIfInMemory(IPrefabBuffer prefab, World world, org.joml.Vector3ic origin, 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 aPrefabUtil.PasteRegion.static voidpaste(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation yaw, boolean force, Random random, int setBlockSettings, boolean technicalPaste, boolean pasteAnchorAsBlock, boolean loadEntities, ComponentAccessor<EntityStore> componentAccessor) Deprecated, for removal: This API element is subject to removal in a future version.static voidpaste(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation yaw, boolean force, Random random, int setBlockSettings, ComponentAccessor<EntityStore> componentAccessor) Deprecated, for removal: This API element is subject to removal in a future version.static voidpaste(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation yaw, boolean force, Random random, ComponentAccessor<EntityStore> componentAccessor) Deprecated, for removal: This API element is subject to removal in a future version.static voidpaste(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation yaw, Random random, int pasteFlags, int setBlockSettings, 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.static voidpaste(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation yaw, Random random, int pasteFlags, int setBlockSettings, PrefabUtil.PasteRegion pasteRegion, Consumer<Holder<ChunkStore>> blockEntityConsumer, Consumer<Holder<EntityStore>> entityConsumer, 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.static voidpaste(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation yaw, Random random, int pasteFlags, int setBlockSettings, Consumer<Holder<ChunkStore>> blockEntityConsumer, Consumer<Holder<EntityStore>> entityConsumer, 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.static voidpaste(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation yaw, Random random, 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.static booleanprefabMatchesAtPosition(IPrefabBuffer prefabBuffer, World world, org.joml.Vector3i position, Rotation yaw, Random random) static voidremove(IPrefabBuffer prefabBuffer, World world, org.joml.Vector3i position, boolean force, Random random, int setBlockSettings) Deprecated, for removal: This API element is subject to removal in a future version.static voidremove(IPrefabBuffer prefabBuffer, World world, org.joml.Vector3i position, boolean force, Random random, int setBlockSettings, double brokenParticlesRate) Deprecated, for removal: This API element is subject to removal in a future version.static voidremove(IPrefabBuffer prefabBuffer, World world, org.joml.Vector3i position, Rotation prefabRotation, boolean force, Random random, int setBlockSettings, double brokenParticlesRate) Deprecated, for removal: This API element is subject to removal in a future version.static voidremove(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation prefabRotation, Random random, int pasteFlags, int setBlockSettings, double brokenParticlesRate) Removes a specified prefab buffer from the world at the given position with the specified settings.static voidremove(IPrefabBuffer buffer, World world, org.joml.Vector3i position, Rotation prefabRotation, Random random, int pasteFlags, int setBlockSettings, double brokenParticlesRate, PrefabUtil.PasteRegion pasteRegion) Removes a specified prefab buffer from the world at the given position with the specified settings.
-
Field Details
-
NOOP_BLOCK_ENTITY_CONSUMER
-
NOOP_ENTITY_CONSUMER
-
-
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 aPrefabUtil.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.PasteRegioncontaining the loaded chunks. The region may be incomplete if any chunks are not currently in memory. This can be checked viaPrefabUtil.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 aPrefabUtil.PasteRegioncontaining 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.PasteRegioncontaining the loaded chunks. The region may be incomplete depending on the flags used to request the chunks. This can be checked viaPrefabUtil.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 storeComponentAccessorfor 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. SeePrefabUtil.Flags.setBlockSettings- The flags that control the behavior of block changes in the world. SeeSetBlockSettings.componentAccessor- The entity storeComponentAccessorfor 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. SeePrefabUtil.Flags.setBlockSettings- The flags that control the behavior of block changes in the world. SeeSetBlockSettings.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 storeComponentAccessorfor 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. SeePrefabUtil.Flags.setBlockSettings- The flags that control the behavior of block changes in the world. SeeSetBlockSettings.pasteRegion- A preloadedPrefabUtil.PasteRegioncontaining 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 storeComponentAccessorfor 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.
-
paste(IPrefabBuffer, World, Vector3i, Rotation, Random, int, int, ComponentAccessor)