Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getResourceType()
- addPrefab(Path, Vector3i, Vector3i, Vector3i, Vector3i)
- updatePrefabBounds(UUID, Vector3i, Vector3i)
- setSelectedPrefab(Ref, PrefabEditingMetadata, ComponentAccessor)
- hidePrefabAnchors(PacketHandler)
- getSelectedPrefab(UUID)
- clearSelectedPrefab(Ref, ComponentAccessor)
- getWorldName()
- getWorldArrivedFrom()
- setWorldArrivedFrom(UUID)
- getTransformArrivedFrom()
- setTransformArrivedFrom(Transform)
- getWorldCreator()
- getSpawnPoint()
- getLoadedPrefabMetadata()
- markPrefabsDirtyAtPosition(Vector3i)
- markPrefabsDirtyInBounds(Vector3i, Vector3i)
- createPrefabMarkers()
- createPrefabMarker(PrefabEditingMetadata)
- clone()
Class PrefabEditSession
java.lang.Object
com.hypixel.hytale.builtin.buildertools.prefabeditor.PrefabEditSession
- All Implemented Interfaces:
Resource<EntityStore>, Cloneable
Represents an ongoing edit session, with multiple
PrefabEditingMetadatas representing the prefabs inside this edit session.
It is a resource so that if a server restart happens in the middle of a session, it can resume no problem when the server starts back up-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<PrefabEditSession> The codec used to parsePrefabEditSessioninstances.Fields inherited from interface Resource
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionCopy Constructor for aPrefabEditSessioninstance.PrefabEditSession(String worldName, UUID worldCreator, UUID worldArrivedFrom, Transform transformArrivedFrom) Default Constructor for aPrefabEditSessioninstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPrefab(Path prefabPath, org.joml.Vector3i minPoint, org.joml.Vector3i maxPoint, org.joml.Vector3i anchorPoint, org.joml.Vector3i pastePosition) Create aPrefabEditingMetadatabased on the provided details about the prefabbooleanclearSelectedPrefab(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) Clear the selected prefab for a given player and hide the anchor display.clone()static MapMarkercreatePrefabMarker(PrefabEditingMetadata metadata) Creates a single world map marker for a prefab.Creates world map markers for all prefabs in this edit session.static ResourceType<EntityStore, PrefabEditSession> getSelectedPrefab(UUID playerUuid) Get the currently selected prefab for the given player UUID.org.joml.Vector3ivoidhidePrefabAnchors(PacketHandler packetHandler) Stop displaying the prefab anchors to the givenPacketHandlervoidmarkPrefabsDirtyAtPosition(org.joml.Vector3i position) Marks any prefabs as dirty if the given position is within their bounding box.voidmarkPrefabsDirtyInBounds(org.joml.Vector3i min, org.joml.Vector3i max) Marks any prefabs as dirty if the given bounding box intersects with their bounding box.voidsetSelectedPrefab(Ref<EntityStore> ref, PrefabEditingMetadata prefabEditingMetadata, ComponentAccessor<EntityStore> componentAccessor) Set the selected prefab for a given player and send them the anchor highlighting packet and update their builder tools selectionvoidsetTransformArrivedFrom(Transform transform) voidsetWorldArrivedFrom(UUID worldUuid) updatePrefabBounds(UUID prefab, org.joml.Vector3i newMin, org.joml.Vector3i newMax) Update the bounds of the specified prefab (prefab editing metadata)
-
Field Details
-
CODEC
The codec used to parsePrefabEditSessioninstances.
-
-
Constructor Details
-
PrefabEditSession
public PrefabEditSession(@Nonnull String worldName, @Nonnull UUID worldCreator, @Nonnull UUID worldArrivedFrom, @Nonnull Transform transformArrivedFrom) Default Constructor for aPrefabEditSessioninstance.- Parameters:
worldName- The name of the world this edit session is in.worldCreator- TheUUIDof the player that created this edit session.worldArrivedFrom- TheUUIDof the world that the user exited from to enter the prefab editing world.transformArrivedFrom- The transform inworldArrivedFromthat theworldCreatorarrived from.
-
PrefabEditSession
Copy Constructor for aPrefabEditSessioninstance.- Parameters:
other- The otherPrefabEditSessionto copy from.
-
-
Method Details
-
getResourceType
- Returns:
- the resource type for the
PrefabEditSessionresource.
-
addPrefab
public void addPrefab(@Nonnull Path prefabPath, @Nonnull org.joml.Vector3i minPoint, @Nonnull org.joml.Vector3i maxPoint, @Nonnull org.joml.Vector3i anchorPoint, @Nonnull org.joml.Vector3i pastePosition) Create aPrefabEditingMetadatabased on the provided details about the prefab- Parameters:
prefabPath- The path of the prefab save fileminPoint- The minimum point in world coordinates of the pasted prefab's bounding boxmaxPoint- The maximum point in world coordinates of the pasted prefab's bounding boxanchorPoint- The world coordinates of the pasted prefab's anchor pointpastePosition- The paste position (origin of prefab coordinate system in world space)
-
updatePrefabBounds
@Nullable public PrefabEditingMetadata updatePrefabBounds(@Nonnull UUID prefab, @Nonnull org.joml.Vector3i newMin, @Nonnull org.joml.Vector3i newMax) Update the bounds of the specified prefab (prefab editing metadata)- Parameters:
prefab- The UUID of thePrefabEditingMetadatato update the bounds ofnewMin- The minimum pointnewMax- The maximum point- Returns:
- this
-
setSelectedPrefab
public void setSelectedPrefab(@Nonnull Ref<EntityStore> ref, @Nonnull PrefabEditingMetadata prefabEditingMetadata, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Set the selected prefab for a given player and send them the anchor highlighting packet and update their builder tools selection- Parameters:
ref- The entity reference of the player entity to select this prefab.prefabEditingMetadata- ThePrefabEditingMetadataprefab to select.componentAccessor- TheComponentAccessor<EntityStore>for component access.
-
hidePrefabAnchors
Stop displaying the prefab anchors to the givenPacketHandler- Parameters:
packetHandler- ThePacketHandlerto send the packet to
-
getSelectedPrefab
Get the currently selected prefab for the given player UUID.- Parameters:
playerUuid- TheUUIDof the player to get the selected prefab for.- Returns:
- The selected
PrefabEditingMetadata, ornullif none is selected.
-
clearSelectedPrefab
public boolean clearSelectedPrefab(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Clear the selected prefab for a given player and hide the anchor display.- Parameters:
ref- The entity reference of the player entity.componentAccessor- TheComponentAccessor<EntityStore>for component access.- Returns:
trueif a prefab was unselected,falseif no prefab was selected.
-
getWorldName
- Returns:
- the name of the world that this edit session exists in.
-
getWorldArrivedFrom
-
setWorldArrivedFrom
-
getTransformArrivedFrom
- Returns:
- the transform that the player arrived from in the previous world.
-
setTransformArrivedFrom
-
getWorldCreator
-
getSpawnPoint
@Nonnull public org.joml.Vector3i getSpawnPoint()- Returns:
- the spawn point of the world this edit session is in.
-
getLoadedPrefabMetadata
- Returns:
- a map of all the
PrefabEditingMetadatainstances loaded in this edit session, keyed by their temporaryUUID.
-
markPrefabsDirtyAtPosition
public void markPrefabsDirtyAtPosition(@Nonnull org.joml.Vector3i position) Marks any prefabs as dirty if the given position is within their bounding box.- Parameters:
position- The position to check.
-
markPrefabsDirtyInBounds
public void markPrefabsDirtyInBounds(@Nonnull org.joml.Vector3i min, @Nonnull org.joml.Vector3i max) Marks any prefabs as dirty if the given bounding box intersects with their bounding box.- Parameters:
min- The minimum point of the bounding box.max- The maximum point of the bounding box.
-
createPrefabMarkers
Creates world map markers for all prefabs in this edit session. Each marker is placed at the prefab's anchor point with the prefab's filename as the name.- Returns:
- An array of markers for all loaded prefabs.
-
createPrefabMarker
Creates a single world map marker for a prefab.- Parameters:
metadata- The prefab metadata to create a marker for.- Returns:
- A marker for the prefab.
-
clone
- Specified by:
clonein interfaceResource<EntityStore>- Returns:
- a clone instance of the original resource instance.
-