Class StructurePlacer
java.lang.Object
com.ldtteam.structurize.placement.StructurePlacer
Structure placement class that will actually execute the placement of a structure.
It will iterate for different phases over the structure and maintain the iterator.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IStructureHandlerThe handler.protected final AbstractBlueprintIteratorThe structure iterator. -
Constructor Summary
ConstructorsConstructorDescriptionStructurePlacer(IStructureHandler handler) Create a new structure placer.StructurePlacer(IStructureHandler handler, AbstractBlueprintIterator iterator) Create a new structure placerStructurePlacer(IStructureHandler handler, String id) Create a new structure placer. -
Method Summary
Modifier and TypeMethodDescriptionclearWaterStep(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos inputPos) Clear water of a y layer.executeStructureStep(net.minecraft.world.level.Level world, ChangeStorage storage, net.minecraft.core.BlockPos inputPos, StructurePlacer.Operation operation, Supplier<AbstractBlueprintIterator.Result> iterateFunction, boolean includeEntities) Execute structure placement.Get the handler instance.Get the iterator instance.getResourceRequirements(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos worldPos, net.minecraft.core.BlockPos localPos, net.minecraft.world.level.block.state.BlockState localState, net.minecraft.nbt.CompoundTag tileEntityData) This method handles the block placement.handleBlockPlacement(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos worldPos, ChangeStorage storage, BlockInfo blockInfo) This method handles the block placement.handleEntitySpawn(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos worldPos, net.minecraft.core.BlockPos localPos, ChangeStorage storage) This method handles entity spawning.booleanisReady()Check if the structure placer is ready.
-
Field Details
-
iterator
The structure iterator. -
handler
The handler.
-
-
Constructor Details
-
StructurePlacer
Create a new structure placer.- Parameters:
handler- the structure handler.
-
StructurePlacer
Create a new structure placer.- Parameters:
handler- the structure handler.id- the unique id of the handler.
-
StructurePlacer
Create a new structure placer- Parameters:
handler- the structure handleriterator- The iterator to use. It will be reset before it is used
-
-
Method Details
-
executeStructureStep
public StructurePhasePlacementResult executeStructureStep(net.minecraft.world.level.Level world, ChangeStorage storage, net.minecraft.core.BlockPos inputPos, StructurePlacer.Operation operation, Supplier<AbstractBlueprintIterator.Result> iterateFunction, boolean includeEntities) Execute structure placement.- Parameters:
world- the world.storage- the change storage.inputPos- the pos to start from.operation- the operation to execute.iterateFunction- the function to iterate.includeEntities- if entities should be included.- Returns:
- the result.
-
handleBlockPlacement
public BlockPlacementResult handleBlockPlacement(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos worldPos, ChangeStorage storage, BlockInfo blockInfo) This method handles the block placement. When we extract this into another mod, we have to override the method.- Parameters:
world- the world.worldPos- the world position.storage- the change storage.blockInfo- the tileEntity.
-
handleEntitySpawn
public BlockPlacementResult handleEntitySpawn(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos worldPos, net.minecraft.core.BlockPos localPos, ChangeStorage storage) This method handles entity spawning. When we extract this into another mod, we have to override the method.- Parameters:
world- the world.worldPos- the world position.localPos- the local posstorage- the change storage.
-
clearWaterStep
public StructurePhasePlacementResult clearWaterStep(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos inputPos) Clear water of a y layer.- Parameters:
world- world to clear it from.inputPos- current progress pos.- Returns:
- progress report.
-
getResourceRequirements
public BlockPlacementResult getResourceRequirements(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos worldPos, net.minecraft.core.BlockPos localPos, net.minecraft.world.level.block.state.BlockState localState, net.minecraft.nbt.CompoundTag tileEntityData) This method handles the block placement. When we extract this into another mod, we have to override the method.- Parameters:
world- the world.worldPos- the world position.localPos- the local pos.localState- the local state.tileEntityData- the tileEntity.
-
getIterator
Get the iterator instance.- Returns:
- the BlueprintIterator.
-
getHandler
Get the handler instance.- Returns:
- the IStructureHandler.
-
isReady
public boolean isReady()Check if the structure placer is ready.- Returns:
- true if so.
-