Contents
Class PersistentPrefabPreview
java.lang.Object
com.hypixel.hytale.server.core.modules.entity.component.PersistentPrefabPreview
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
Persists a prefab-preview ("hologram") anchor: which prefab to show and how many bottom layers of it
are currently visible. The resolved block data is not persisted. On load the runtime
PrefabPreview component re-resolves the blocks from the prefab key.
Tint is derived from the anchor's world position by default. A caller may instead pin an explicit biome/water tint, which is persisted so it survives restarts.
- See Also:
-
Field Summary
FieldsFields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionPersistentPrefabPreview(String prefabKey, int visibleLayerCount) PersistentPrefabPreview(String prefabKey, int visibleLayerCount, int biomeTint, int waterTint) -
Method Summary
Modifier and TypeMethodDescriptionclone()intintintbooleanstatic voidremove(Store<EntityStore> store, Ref<EntityStore> ref) voidsetVisibleLayerCount(int visibleLayerCount) static Ref<EntityStore> spawn(Store<EntityStore> store, org.joml.Vector3d position, Rotation3f rotation, String prefabKey, int visibleLayerCount) Spawns a prefab-preview ("hologram") entity showing the lowestvisibleLayerCountlayers of the prefab at the given position, tinted to match the local biome.static Ref<EntityStore> spawn(Store<EntityStore> store, org.joml.Vector3d position, Rotation3f rotation, String prefabKey, int visibleLayerCount, int biomeTint, int waterTint) Spawns a prefab preview with an explicit biome/water tint instead of deriving one from the world.static voidupdateLayers(Store<EntityStore> store, Ref<EntityStore> ref, int visibleLayerCount) Changes how many bottom layers a spawned preview shows, updating both the persisted state and the live synced component.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Field Details
-
CODEC
-
-
Constructor Details
-
PersistentPrefabPreview
-
PersistentPrefabPreview
public PersistentPrefabPreview(@Nonnull String prefabKey, int visibleLayerCount, int biomeTint, int waterTint)
-
-
Method Details
-
getComponentType
-
spawn
@Nonnull public static Ref<EntityStore> spawn(@Nonnull Store<EntityStore> store, @Nonnull org.joml.Vector3d position, @Nonnull Rotation3f rotation, @Nonnull String prefabKey, int visibleLayerCount) Spawns a prefab-preview ("hologram") entity showing the lowestvisibleLayerCountlayers of the prefab at the given position, tinted to match the local biome. The prefab resolves to blocks on the world thread, so call this from the thread that owns the store. -
spawn
@Nonnull public static Ref<EntityStore> spawn(@Nonnull Store<EntityStore> store, @Nonnull org.joml.Vector3d position, @Nonnull Rotation3f rotation, @Nonnull String prefabKey, int visibleLayerCount, int biomeTint, int waterTint) Spawns a prefab preview with an explicit biome/water tint instead of deriving one from the world. -
updateLayers
public static void updateLayers(@Nonnull Store<EntityStore> store, @Nonnull Ref<EntityStore> ref, int visibleLayerCount) Changes how many bottom layers a spawned preview shows, updating both the persisted state and the live synced component. -
remove
-
getPrefabKey
-
getVisibleLayerCount
public int getVisibleLayerCount() -
hasTintOverride
public boolean hasTintOverride() -
getBiomeTint
public int getBiomeTint() -
getWaterTint
public int getWaterTint() -
setVisibleLayerCount
public void setVisibleLayerCount(int visibleLayerCount) -
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-