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
The blueprint class which contains the file format for the schematics.
WARNING: hashcode/equals does NOT take rotation/mirror into account
-
Constructor Summary
ConstructorsConstructorDescriptionBlueprint(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 TypeMethodDescriptionvoidaddBlockState(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Add a blockstate to the structure.voiddescribeSelfInCrashReport(net.minecraft.CrashReportCategory category) booleanString[]net.minecraft.world.level.block.entity.BlockEntitygetBlockEntity(net.minecraft.core.BlockPos pos) Get a list of all blockInfo objects in the blueprint.Get a map of all blockpos->blockInfo objects in the blueprint.net.minecraft.world.level.block.state.BlockStategetBlockState(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.ItemgetItem(net.minecraft.core.BlockPos pos) Deprecated, for removal: This API element is subject to removal in a future version.String[]getName()Get the pack name this belongs to.net.minecraft.world.level.block.state.BlockState[]shortfinal net.minecraft.core.BlockPosGet the primary block offset.net.minecraft.core.HolderLookup.ProviderintgetSizeX()shortgetSizeY()intgetSizeZ()short[][][]net.minecraft.nbt.CompoundTag[][][]@Nullable net.minecraft.nbt.CompoundTaggetTileEntityData(net.minecraft.core.BlockPos worldPos, net.minecraft.core.BlockPos structurePos) Getter of the EntityInfo at a certain position.inthashCode()voidsetArchitects(String[] architects) Sets an Array of all architects for this structurevoidsetCachePrimaryOffset(net.minecraft.core.BlockPos cachePrimaryOffset) Sets the primary offset for the blueprintvoidsetEntities(net.minecraft.nbt.CompoundTag[] entities) setFileName(String name) Sets the file name of the StructuresetFilePath(Path path) Sets the file path of the StructuresetMissingMods(String... missingMods) Sets the missing modsSets the name of the StructuresetPackName(String packName) Set the pack this blueprint is in.voidsetRotationMirror(RotationMirror rotationMirror, net.minecraft.world.level.Level level) Rotates and mirrors entire exactly to given paramvoidsetRotationMirrorRelative(RotationMirror transformBy, net.minecraft.world.level.Level level) Rotates and mirrors entire content additively, formula: current state + transformBy = target statetoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.level.BlockGetter
clip, clipWithInteractionOverride, getBlockEntity, getBlockFloorHeight, getBlockFloorHeight, getBlockStates, getLightEmission, getMaxLightLevel, isBlockInLineMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockGetterExtension
getAuxLightManager, getAuxLightManager, getModelDataMethods inherited from interface com.ldtteam.common.fakelevel.IFakeLevelBlockGetter
getAABB, getFluidState, getMaxX, getMaxZ, getMinBuildHeight, getMinX, getMinZ, getRawBlockState, getRawBlockStateFunction, isPosInside, isPosOutsideMethods 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:
getSizeXin interfacecom.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:
getSizeZin interfacecom.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
- Returns:
- a list of all required mods as modid's
-
getName
- Returns:
- the Name of the Structure
-
setName
Sets the name of the Structure- Parameters:
name- the name to set.- Returns:
- this object.
-
setFileName
Sets the file name of the Structure- Parameters:
name- the file name to set.- Returns:
- this object.
-
getFileName
Getter for the filename.- Returns:
- the unique file name of the structure.
-
setFilePath
Sets the file path of the Structure- Parameters:
path- the file path to set.- Returns:
- this object.
-
setPackName
Set the pack this blueprint is in.- Parameters:
packName- the id of the pack.- Returns:
- this object.
-
getFilePath
Getter for the file path (does not contain the file name).- Returns:
- the file path of the structure.
-
getPackName
Get the pack name this belongs to.- Returns:
- the name of the pack.
-
getArchitects
- Returns:
- an Array of all architects for this structure
-
setArchitects
Sets an Array of all architects for this structure- Parameters:
architects- an array of architects.
-
getMissingMods
- Returns:
- An Array of all missing mods that are required to generate this structure (only works if structure was loaded from file)
-
setMissingMods
Sets the missing mods- Parameters:
missingMods- the missing mods list.- Returns:
- this object.
-
getRotationMirror
- Returns:
- current rot/mir as relative to freshly loaded file
-
getEntitiesAsList
Get a list of all entities in the blueprint as a list.- Returns:
- the list of CompoundNBTs.
-
getBlockInfoAsList
Get a list of all blockInfo objects in the blueprint.- Returns:
- a list of all blockinfo (position, blockState, tileEntityData).
-
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.useBlockToItemHelperCalculate 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
Rotates and mirrors entire exactly to given param- Parameters:
rotationMirror- exact rot/mirlevel- 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 addlevel- world for entity construction- See Also:
-
hashCode
public int hashCode() -
equals
-
getBluePrintPositionInfo
public BlueprintPositionInfo getBluePrintPositionInfo(net.minecraft.core.BlockPos pos, boolean includeEntities) Get blueprint info at position.- Parameters:
pos- the positionincludeEntities- 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:
getBlockStatein interfacenet.minecraft.world.level.BlockGetter- Parameters:
pos- the pos.- Returns:
- the blockstate.
-
toString
-
getBlockEntity
@Nullable public net.minecraft.world.level.block.entity.BlockEntity getBlockEntity(net.minecraft.core.BlockPos pos) - Specified by:
getBlockEntityin interfacenet.minecraft.world.level.BlockGetter- Returns:
- blockEntity without world
-
getHeight
public int getHeight()- Specified by:
getHeightin interfacenet.minecraft.world.level.LevelHeightAccessor
-
describeSelfInCrashReport
public void describeSelfInCrashReport(net.minecraft.CrashReportCategory category) - Specified by:
describeSelfInCrashReportin interfacecom.ldtteam.common.fakelevel.IFakeLevelBlockGetter
-
getRegistryAccess
public net.minecraft.core.HolderLookup.Provider getRegistryAccess()
-
BlockToItemHelper