Class Blueprint

java.lang.Object
com.ldtteam.structurize.blueprints.v1.Blueprint
All Implemented Interfaces:
com.ldtteam.common.fakelevel.IFakeLevelBlockGetter, net.minecraft.world.level.BlockGetter, net.minecraft.world.level.LevelHeightAccessor, net.neoforged.neoforge.common.extensions.IBlockGetterExtension

public class Blueprint extends Object implements com.ldtteam.common.fakelevel.IFakeLevelBlockGetter
The blueprint class which contains the file format for the schematics. WARNING: hashcode/equals does NOT take rotation/mirror into account
  • Constructor Summary

    Constructors
    Constructor
    Description
    Blueprint(short sizeX, short sizeY, short sizeZ, short palleteSize, List<net.minecraft.world.level.block.state.BlockState> pallete, short[][][] structure, net.minecraft.nbt.CompoundTag[] tileEntities, List<String> requiredMods, net.minecraft.core.HolderLookup.Provider registryAccess)
    Constructor of a new Blueprint.
    Blueprint(short sizeX, short sizeY, short sizeZ, net.minecraft.core.HolderLookup.Provider registryAccess)
    Constructor of a new Blueprint.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addBlockState(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Add a blockstate to the structure.
    void
    describeSelfInCrashReport(net.minecraft.CrashReportCategory category)
     
    boolean
     
     
    net.minecraft.world.level.block.entity.BlockEntity
    getBlockEntity(net.minecraft.core.BlockPos pos)
     
    Get a list of all blockInfo objects in the blueprint.
    final Map<net.minecraft.core.BlockPos,BlockInfo>
    Get a map of all blockpos->blockInfo objects in the blueprint.
    net.minecraft.world.level.block.state.BlockState
    getBlockState(net.minecraft.core.BlockPos pos)
    Get the blockstate at a pos.
    getBluePrintPositionInfo(net.minecraft.core.BlockPos pos, boolean includeEntities)
    Get blueprint info at position.
    final Map<net.minecraft.core.BlockPos,net.minecraft.nbt.CompoundTag[]>
    Get a map of all entities by approx position.
    net.minecraft.nbt.CompoundTag[]
     
    final List<net.minecraft.nbt.CompoundTag>
    Get a list of all entities in the blueprint as a list.
    Getter for the filename.
    Getter for the file path (does not contain the file name).
    int
     
    @Nullable net.minecraft.world.item.Item
    getItem(net.minecraft.core.BlockPos pos)
    Deprecated, for removal: This API element is subject to removal in a future version.
    use BlockToItemHelper
     
     
    Get the pack name this belongs to.
    net.minecraft.world.level.block.state.BlockState[]
     
    short
     
    final net.minecraft.core.BlockPos
    Get the primary block offset.
    net.minecraft.core.HolderLookup.Provider
     
     
     
    int
     
    short
     
    int
     
    short[][][]
     
    net.minecraft.nbt.CompoundTag[][][]
     
    @Nullable net.minecraft.nbt.CompoundTag
    getTileEntityData(net.minecraft.core.BlockPos worldPos, net.minecraft.core.BlockPos structurePos)
    Getter of the EntityInfo at a certain position.
    int
     
    void
    setArchitects(String[] architects)
    Sets an Array of all architects for this structure
    void
    setCachePrimaryOffset(net.minecraft.core.BlockPos cachePrimaryOffset)
    Sets the primary offset for the blueprint
    void
    setEntities(net.minecraft.nbt.CompoundTag[] entities)
     
    Sets the file name of the Structure
    Sets the file path of the Structure
    setMissingMods(String... missingMods)
    Sets the missing mods
    Sets the name of the Structure
    setPackName(String packName)
    Set the pack this blueprint is in.
    void
    setRotationMirror(RotationMirror rotationMirror, net.minecraft.world.level.Level level)
    Rotates and mirrors entire exactly to given param
    void
    setRotationMirrorRelative(RotationMirror transformBy, net.minecraft.world.level.Level level)
    Rotates and mirrors entire content additively, formula: current state + transformBy = target state
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.level.BlockGetter

    clip, clipWithInteractionOverride, getBlockEntity, getBlockFloorHeight, getBlockFloorHeight, getBlockStates, getLightEmission, getMaxLightLevel, isBlockInLine

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockGetterExtension

    getAuxLightManager, getAuxLightManager, getModelData

    Methods inherited from interface com.ldtteam.common.fakelevel.IFakeLevelBlockGetter

    getAABB, getFluidState, getMaxX, getMaxZ, getMinBuildHeight, getMinX, getMinZ, getRawBlockState, getRawBlockStateFunction, isPosInside, isPosOutside

    Methods inherited from interface net.minecraft.world.level.LevelHeightAccessor

    getMaxBuildHeight, getMaxSection, getMinSection, getSectionIndex, getSectionIndexFromSectionY, getSectionsCount, getSectionYFromSectionIndex, isOutsideBuildHeight, isOutsideBuildHeight
  • Constructor Details

    • Blueprint

      public Blueprint(short sizeX, short sizeY, short sizeZ, short palleteSize, List<net.minecraft.world.level.block.state.BlockState> pallete, short[][][] structure, net.minecraft.nbt.CompoundTag[] tileEntities, List<String> requiredMods, net.minecraft.core.HolderLookup.Provider registryAccess)
      Constructor of a new Blueprint.
      Parameters:
      sizeX - the x size.
      sizeY - the y size.
      sizeZ - the z size.
      palleteSize - the size of the pallete.
      pallete - the palette.
      structure - the structure data.
      tileEntities - the tileEntities.
      requiredMods - the required mods.
    • Blueprint

      public Blueprint(short sizeX, short sizeY, short sizeZ, net.minecraft.core.HolderLookup.Provider registryAccess)
      Constructor of a new Blueprint.
      Parameters:
      sizeX - the x size.
      sizeY - the y size.
      sizeZ - the z size.
  • Method Details

    • getSizeX

      public int getSizeX()
      Specified by:
      getSizeX in interface com.ldtteam.common.fakelevel.IFakeLevelBlockGetter
      Returns:
      the Size of the Structure on the X-Axis (without rotation and/or mirroring)
    • getSizeY

      public short getSizeY()
      Returns:
      the Size of the Structure on the Y-Axis (without rotation and/or mirroring)
    • getSizeZ

      public int getSizeZ()
      Specified by:
      getSizeZ in interface com.ldtteam.common.fakelevel.IFakeLevelBlockGetter
      Returns:
      the Size of the Structure on the Z-Axis (without rotation and/or mirroring)
    • getPalleteSize

      public short getPalleteSize()
      Returns:
      the amount of Blockstates within the pallete
    • getPalette

      public net.minecraft.world.level.block.state.BlockState[] getPalette()
      Returns:
      the pallete (without rotation and/or mirroring)
    • addBlockState

      public void addBlockState(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Add a blockstate to the structure.
      Parameters:
      pos - the position to add it to.
      state - the state to add.
    • getStructure

      public short[][][] getStructure()
      Returns:
      the structure (without rotation and/or mirroring) The Coordinate order is: y, z, x
    • getTileEntities

      public net.minecraft.nbt.CompoundTag[][][] getTileEntities()
      Returns:
      an array of serialized TileEntities (posX, posY and posZ tags have been localized to coordinates within the structure)
    • getEntities

      public net.minecraft.nbt.CompoundTag[] getEntities()
      Returns:
      an array of serialized TileEntities (the Pos tag has been localized to coordinates within the structure)
    • setEntities

      public void setEntities(net.minecraft.nbt.CompoundTag[] entities)
      Parameters:
      entities - an array of serialized TileEntities (the Pos tag need to be localized to coordinates within the structure)
    • getRequiredMods

      public List<String> getRequiredMods()
      Returns:
      a list of all required mods as modid's
    • getName

      public String getName()
      Returns:
      the Name of the Structure
    • setName

      public Blueprint setName(String name)
      Sets the name of the Structure
      Parameters:
      name - the name to set.
      Returns:
      this object.
    • setFileName

      public Blueprint setFileName(String name)
      Sets the file name of the Structure
      Parameters:
      name - the file name to set.
      Returns:
      this object.
    • getFileName

      public String getFileName()
      Getter for the filename.
      Returns:
      the unique file name of the structure.
    • setFilePath

      public Blueprint setFilePath(Path path)
      Sets the file path of the Structure
      Parameters:
      path - the file path to set.
      Returns:
      this object.
    • setPackName

      public Blueprint setPackName(String packName)
      Set the pack this blueprint is in.
      Parameters:
      packName - the id of the pack.
      Returns:
      this object.
    • getFilePath

      public Path getFilePath()
      Getter for the file path (does not contain the file name).
      Returns:
      the file path of the structure.
    • getPackName

      public String getPackName()
      Get the pack name this belongs to.
      Returns:
      the name of the pack.
    • getArchitects

      public String[] getArchitects()
      Returns:
      an Array of all architects for this structure
    • setArchitects

      public void setArchitects(String[] architects)
      Sets an Array of all architects for this structure
      Parameters:
      architects - an array of architects.
    • getMissingMods

      public String[] getMissingMods()
      Returns:
      An Array of all missing mods that are required to generate this structure (only works if structure was loaded from file)
    • setMissingMods

      public Blueprint setMissingMods(String... missingMods)
      Sets the missing mods
      Parameters:
      missingMods - the missing mods list.
      Returns:
      this object.
    • getRotationMirror

      public RotationMirror getRotationMirror()
      Returns:
      current rot/mir as relative to freshly loaded file
    • getEntitiesAsList

      public final List<net.minecraft.nbt.CompoundTag> getEntitiesAsList()
      Get a list of all entities in the blueprint as a list.
      Returns:
      the list of CompoundNBTs.
    • getBlockInfoAsList

      public final List<BlockInfo> getBlockInfoAsList()
      Get a list of all blockInfo objects in the blueprint.
      Returns:
      a list of all blockinfo (position, blockState, tileEntityData).
    • getBlockInfoAsMap

      public final Map<net.minecraft.core.BlockPos,BlockInfo> getBlockInfoAsMap()
      Get a map of all blockpos->blockInfo objects in the blueprint.
      Returns:
      a map of all blockpos->blockInfo (position, blockState, tileEntityData).
    • getCachedEntitiesAsMap

      public final Map<net.minecraft.core.BlockPos,net.minecraft.nbt.CompoundTag[]> getCachedEntitiesAsMap()
      Get a map of all entities by approx position.
      Returns:
      the cached map of these.
    • getTileEntityData

      @Nullable public @Nullable net.minecraft.nbt.CompoundTag getTileEntityData(net.minecraft.core.BlockPos worldPos, net.minecraft.core.BlockPos structurePos)
      Getter of the EntityInfo at a certain position.
      Parameters:
      worldPos - the world position.
      structurePos - the position it will have in the structure.
      Returns:
      the TE compound with real world coords.
    • getItem

      @Nullable @Deprecated(forRemoval=true, since="1.21.1") public @Nullable net.minecraft.world.item.Item getItem(net.minecraft.core.BlockPos pos)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use BlockToItemHelper
      Calculate the item needed to place the current block in the structure.
      Parameters:
      pos - the pos its at.
      Returns:
      an item or null if not initialized.
    • setCachePrimaryOffset

      public void setCachePrimaryOffset(net.minecraft.core.BlockPos cachePrimaryOffset)
      Sets the primary offset for the blueprint
      Parameters:
      cachePrimaryOffset - the primary offset
    • getPrimaryBlockOffset

      public final net.minecraft.core.BlockPos getPrimaryBlockOffset()
      Get the primary block offset.
      Returns:
      the cached offset or a freshly calculated one.
    • setRotationMirror

      public void setRotationMirror(RotationMirror rotationMirror, net.minecraft.world.level.Level level)
      Rotates and mirrors entire exactly to given param
      Parameters:
      rotationMirror - exact rot/mir
      level - world for entity construction
      See Also:
    • setRotationMirrorRelative

      public void setRotationMirrorRelative(RotationMirror transformBy, net.minecraft.world.level.Level level)
      Rotates and mirrors entire content additively, formula: current state + transformBy = target state
      Parameters:
      transformBy - rot/mir to add
      level - world for entity construction
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getBluePrintPositionInfo

      public BlueprintPositionInfo getBluePrintPositionInfo(net.minecraft.core.BlockPos pos, boolean includeEntities)
      Get blueprint info at position.
      Parameters:
      pos - the position
      includeEntities - if entities should be included.
      Returns:
      the info object.
    • getBlockState

      public net.minecraft.world.level.block.state.BlockState getBlockState(net.minecraft.core.BlockPos pos)
      Get the blockstate at a pos.
      Specified by:
      getBlockState in interface net.minecraft.world.level.BlockGetter
      Parameters:
      pos - the pos.
      Returns:
      the blockstate.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getBlockEntity

      @Nullable public net.minecraft.world.level.block.entity.BlockEntity getBlockEntity(net.minecraft.core.BlockPos pos)
      Specified by:
      getBlockEntity in interface net.minecraft.world.level.BlockGetter
      Returns:
      blockEntity without world
    • getHeight

      public int getHeight()
      Specified by:
      getHeight in interface net.minecraft.world.level.LevelHeightAccessor
    • describeSelfInCrashReport

      public void describeSelfInCrashReport(net.minecraft.CrashReportCategory category)
      Specified by:
      describeSelfInCrashReport in interface com.ldtteam.common.fakelevel.IFakeLevelBlockGetter
    • getRegistryAccess

      public net.minecraft.core.HolderLookup.Provider getRegistryAccess()