Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- setPrefabPath(Path)
- setAnchorPoint(Vector3i, World)
- recreateAnchorEntity(World)
- sendAnchorHighlightingPacket(PacketHandler)
- isLocationWithinPrefabBoundingBox(Vector3i)
- getAnchorPoint()
- getPastePosition()
- getOriginalFileAnchor()
- getPrefabPath()
- getMinPoint()
- getMaxPoint()
- getAnchorEntityUuid()
- getAnchorEntityPosition()
- getUuid()
- isDirty()
- setDirty(boolean)
- isReadOnly()
Class PrefabEditingMetadata
java.lang.Object
com.hypixel.hytale.builtin.buildertools.prefabeditor.PrefabEditingMetadata
Data about a prefab that is currently being edited. Stored in a
PrefabEditSession instance.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<PrefabEditingMetadata> The codec for serializing/deserializingPrefabEditingMetadata -
Constructor Summary
ConstructorsConstructorDescriptionPrefabEditingMetadata(Path prefabPath, org.joml.Vector3i minPoint, org.joml.Vector3i maxPoint, org.joml.Vector3i anchorPoint, org.joml.Vector3i pastePosition, World world) Default Constructor for aPrefabEditingMetadatainstance. -
Method Summary
Modifier and TypeMethodDescriptionorg.joml.Vector3iorg.joml.Vector3iorg.joml.Vector3iorg.joml.Vector3iorg.joml.Vector3iorg.joml.Vector3igetUuid()booleanisDirty()booleanisLocationWithinPrefabBoundingBox(org.joml.Vector3i location) Check if a location is within the prefab bounding box.booleanvoidrecreateAnchorEntity(World world) Recreates the anchor entity after deserialization.voidsendAnchorHighlightingPacket(PacketHandler displayTo) Send the packet for displaying the anchor block highlight/outlinevoidsetAnchorPoint(org.joml.Vector3i newEntityPosition, World world) Set the anchor point of this prefab, updating the anchor in the metadata and updating the position of the anchor entity.voidsetDirty(boolean dirty) Sets the dirty state of this prefab.voidsetPrefabPath(Path prefabPath) Sets the prefab's path.
-
Field Details
-
CODEC
The codec for serializing/deserializingPrefabEditingMetadata
-
-
Constructor Details
-
PrefabEditingMetadata
public PrefabEditingMetadata(@Nonnull Path prefabPath, @Nonnull org.joml.Vector3i minPoint, @Nonnull org.joml.Vector3i maxPoint, @Nonnull org.joml.Vector3i anchorPoint, @Nonnull org.joml.Vector3i pastePosition, @Nonnull World world) Default Constructor for aPrefabEditingMetadatainstance.- Parameters:
prefabPath- The filesystem path to the .prefab.json file.minPoint- The minimum point of the prefab bounding box.maxPoint- The maximum point of the prefab bounding box.anchorPoint- The world-space coordinate used for calculating anchor offset when saving. This should be pastePosition + originalFileAnchor.pastePosition- The paste position (origin of prefab coordinate system in world space). This is where the prefab's anchor block is placed in the world.world- The world that the edit session is in.
-
-
Method Details
-
setPrefabPath
Sets the prefab's path. NOTE: You'll also want to make sure to update it usingPrefabEditSessionManager.updatePathOfLoadedPrefab(Path, Path)- Parameters:
prefabPath- The filesystem path to the .prefab.json file
-
setAnchorPoint
Set the anchor point of this prefab, updating the anchor in the metadata and updating the position of the anchor entity. Used when the user manually moves the anchor with the Set Anchor tool.- Parameters:
newEntityPosition- The world-space coordinate where the user placed the anchor entityworld- The world that the edit session is in
-
recreateAnchorEntity
Recreates the anchor entity after deserialization. This should be called when restoring a prefab edit session after server restart.- Parameters:
world- The world to create the entity in.
-
sendAnchorHighlightingPacket
Send the packet for displaying the anchor block highlight/outline- Parameters:
displayTo- ThePacketHandlerto receive the data
-
isLocationWithinPrefabBoundingBox
public boolean isLocationWithinPrefabBoundingBox(@Nonnull org.joml.Vector3i location) Check if a location is within the prefab bounding box.- Parameters:
location- The location to check.- Returns:
trueif the location is within the prefab bounding box,falseotherwise.
-
getAnchorPoint
public org.joml.Vector3i getAnchorPoint() -
getPastePosition
public org.joml.Vector3i getPastePosition()- Returns:
- The paste position (origin of prefab coordinate system in world space).
-
getOriginalFileAnchor
public org.joml.Vector3i getOriginalFileAnchor()- Returns:
- The original anchor offset from the prefab file when it was loaded. Used when saving to preserve original block coordinates.
-
getPrefabPath
-
getMinPoint
public org.joml.Vector3i getMinPoint() -
getMaxPoint
public org.joml.Vector3i getMaxPoint() -
getAnchorEntityUuid
-
getAnchorEntityPosition
public org.joml.Vector3i getAnchorEntityPosition() -
getUuid
-
isDirty
public boolean isDirty()- Returns:
trueif this prefab has been modified since it was loaded or last saved.
-
setDirty
public void setDirty(boolean dirty) Sets the dirty state of this prefab.- Parameters:
dirty-trueto mark this prefab as modified,falseto mark it as clean.
-
isReadOnly
public boolean isReadOnly()- Returns:
trueif this prefab is read-only (e.g., from a zip asset pack).
-