Class CreativeStructureHandler
java.lang.Object
com.ldtteam.structurize.placement.structure.AbstractStructureHandler
com.ldtteam.structurize.placement.structure.CreativeStructureHandler
- All Implemented Interfaces:
IStructureHandler
Creative placement handler that doesn't require resources or tools.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanIf placement is supposed to be fancy or not. -
Constructor Summary
ConstructorsConstructorDescriptionCreativeStructureHandler(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, Blueprint blueprint, RotationMirror rotMir, boolean fancyPlacement) Creative constructor of structure handler.CreativeStructureHandler(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, Future<Blueprint> blueprint, RotationMirror rotMir, boolean fancyPlacement) Creative constructor of structure handler. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIf the handler allows to replace or requires to mine the block first.booleanIf this is supposed to be fancy placement (player facing) or builder facing (complete).net.minecraft.world.item.ItemStackThe item being held by the handler@Nullable net.neoforged.neoforge.items.IItemHandlerGet the inventory of the handler.intHow many blocks are checked max per call.net.minecraft.world.level.block.state.BlockStategetSolidBlockForPos(net.minecraft.core.BlockPos worldPos, Function<net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState> virtualBlocks) Get the solid worldgen block for given pos while using data from handler.intHow many steps are executed on per call.booleanhasRequiredItems(List<net.minecraft.world.item.ItemStack> requiredItems) Check if the handler has the required items for an action.booleanIf creative placement (Free placement without inventory).booleanisStackFree(@Nullable net.minecraft.world.item.ItemStack stack) Check if the stack is free for this handler.voidprePlacementLogic(net.minecraft.core.BlockPos worldPos, net.minecraft.world.level.block.state.BlockState blockState, List<net.minecraft.world.item.ItemStack> requiredItems) Execute pre placement logic if necessary.booleanreplaceWithSolidBlock(net.minecraft.world.level.block.state.BlockState blockState) Check if this block is considered solid for the solid placerholder blocks.booleanshouldBlocksBeConsideredEqual(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.state.BlockState state1) Special equal condition check.voidtriggerEntitySuccess(net.minecraft.core.BlockPos pos, List<net.minecraft.world.item.ItemStack> requiredRes, boolean placement) Trigger entity success.Methods inherited from class com.ldtteam.structurize.placement.structure.AbstractStructureHandler
getBluePrint, getMd5, getRotationMirror, getWorld, getWorldPos, hasBluePrint, isReady, setBlueprint, setMd5, triggerSuccessMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ldtteam.structurize.placement.structure.IStructureHandler
consume, getProgressPosInWorld, getStructurePosFromWorld, isCorrectMD5, onCompletion
-
Field Details
-
fancyPlacement
public boolean fancyPlacementIf placement is supposed to be fancy or not.
-
-
Constructor Details
-
CreativeStructureHandler
public CreativeStructureHandler(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, Blueprint blueprint, RotationMirror rotMir, boolean fancyPlacement) Creative constructor of structure handler.- Parameters:
world- the world it gets.pos- the position the anchor of the structure got placed.blueprint- the blueprint.rotMir- the placement settings.fancyPlacement- if placement is fancy or complete.
-
CreativeStructureHandler
public CreativeStructureHandler(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, Future<Blueprint> blueprint, RotationMirror rotMir, boolean fancyPlacement) Creative constructor of structure handler.- Parameters:
world- the world it gets.pos- the position the anchor of the structure got placed.blueprint- the blueprint.rotMir- the placement settings.fancyPlacement- if placement is fancy or complete.
-
-
Method Details
-
getInventory
@Nullable public @Nullable net.neoforged.neoforge.items.IItemHandler getInventory()Description copied from interface:IStructureHandlerGet the inventory of the handler.- Returns:
- the IItemhandler (may be null!).
-
triggerEntitySuccess
public void triggerEntitySuccess(net.minecraft.core.BlockPos pos, List<net.minecraft.world.item.ItemStack> requiredRes, boolean placement) Description copied from interface:IStructureHandlerTrigger entity success.- Parameters:
pos- the position the entity was placed at.requiredRes- the list of required res.placement- if through placement (true) or through equality (false).
-
getMaxBlocksCheckedPerCall
public int getMaxBlocksCheckedPerCall()Description copied from interface:IStructureHandlerHow many blocks are checked max per call.- Returns:
- the max number.
-
isStackFree
public boolean isStackFree(@Nullable @Nullable net.minecraft.world.item.ItemStack stack) Description copied from interface:IStructureHandlerCheck if the stack is free for this handler.- Parameters:
stack- the stack to check.- Returns:
- true if so.
-
allowReplace
public boolean allowReplace()Description copied from interface:IStructureHandlerIf the handler allows to replace or requires to mine the block first.- Returns:
- true if so.
-
getHeldItem
public net.minecraft.world.item.ItemStack getHeldItem()Description copied from interface:IStructureHandlerThe item being held by the handler- Returns:
- the Item (could be empty).
-
replaceWithSolidBlock
public boolean replaceWithSolidBlock(net.minecraft.world.level.block.state.BlockState blockState) Description copied from interface:IStructureHandlerCheck if this block is considered solid for the solid placerholder blocks.- Parameters:
blockState- the blockState to check.- Returns:
- true if it should be replaced.
-
fancyPlacement
public boolean fancyPlacement()Description copied from interface:IStructureHandlerIf this is supposed to be fancy placement (player facing) or builder facing (complete).- Returns:
- true if fancy placement.
-
isCreative
public boolean isCreative()Description copied from interface:IStructureHandlerIf creative placement (Free placement without inventory).- Returns:
- true if so.
-
getStepsPerCall
public int getStepsPerCall()Description copied from interface:IStructureHandlerHow many steps are executed on per call.- Returns:
- the number of steps.
-
shouldBlocksBeConsideredEqual
public boolean shouldBlocksBeConsideredEqual(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.state.BlockState state1) Description copied from interface:IStructureHandlerSpecial equal condition check.- Parameters:
state- the first state.state1- the second state.- Returns:
- true if considered equal and block should be skipped.
-
hasRequiredItems
Description copied from interface:IStructureHandlerCheck if the handler has the required items for an action.- Parameters:
requiredItems- the list of items.- Returns:
- true if so.
-
prePlacementLogic
public void prePlacementLogic(net.minecraft.core.BlockPos worldPos, net.minecraft.world.level.block.state.BlockState blockState, List<net.minecraft.world.item.ItemStack> requiredItems) Description copied from interface:IStructureHandlerExecute pre placement logic if necessary.- Parameters:
worldPos- the position the block si going to be placed.blockState- the blockstate to be placed.requiredItems- the list of required items.
-
getSolidBlockForPos
public net.minecraft.world.level.block.state.BlockState getSolidBlockForPos(net.minecraft.core.BlockPos worldPos, Function<net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState> virtualBlocks) Description copied from interface:IStructureHandlerGet the solid worldgen block for given pos while using data from handler.- Parameters:
worldPos- the world pos.virtualBlocks- blueprint blocks, fnc may return null if virtual block is not available (then use level instead for getting surrounding block states), pos argument is using world coords- Returns:
- the solid worldgen block (classically biome dependent).
-