Class PrefabEditingMetadata

java.lang.Object
com.hypixel.hytale.builtin.buildertools.prefabeditor.PrefabEditingMetadata

public class PrefabEditingMetadata extends Object
Data about a prefab that is currently being edited. Stored in a PrefabEditSession instance.
  • Field Details

  • 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 a PrefabEditingMetadata instance.
      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

      public void setPrefabPath(@Nonnull Path prefabPath)
      Sets the prefab's path. NOTE: You'll also want to make sure to update it using PrefabEditSessionManager.updatePathOfLoadedPrefab(Path, Path)
      Parameters:
      prefabPath - The filesystem path to the .prefab.json file
    • setAnchorPoint

      public void setAnchorPoint(@Nonnull org.joml.Vector3i newEntityPosition, @Nonnull World world)
      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 entity
      world - The world that the edit session is in
    • recreateAnchorEntity

      public void recreateAnchorEntity(@Nonnull World world)
      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

      public void sendAnchorHighlightingPacket(@Nonnull PacketHandler displayTo)
      Send the packet for displaying the anchor block highlight/outline
      Parameters:
      displayTo - The PacketHandler to 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:
      true if the location is within the prefab bounding box, false otherwise.
    • 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

      public Path getPrefabPath()
    • getMinPoint

      public org.joml.Vector3i getMinPoint()
    • getMaxPoint

      public org.joml.Vector3i getMaxPoint()
    • getAnchorEntityUuid

      @Nullable public UUID getAnchorEntityUuid()
    • getAnchorEntityPosition

      public org.joml.Vector3i getAnchorEntityPosition()
    • getUuid

      public UUID getUuid()
    • isDirty

      public boolean isDirty()
      Returns:
      true if 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 - true to mark this prefab as modified, false to mark it as clean.
    • isReadOnly

      public boolean isReadOnly()
      Returns:
      true if this prefab is read-only (e.g., from a zip asset pack).