Class CreativeStructureHandler

java.lang.Object
com.ldtteam.structurize.placement.structure.AbstractStructureHandler
com.ldtteam.structurize.placement.structure.CreativeStructureHandler
All Implemented Interfaces:
IStructureHandler

public class CreativeStructureHandler extends AbstractStructureHandler
Creative placement handler that doesn't require resources or tools.
  • Field Details

    • fancyPlacement

      public boolean fancyPlacement
      If 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: IStructureHandler
      Get 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: IStructureHandler
      Trigger 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: IStructureHandler
      How 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: IStructureHandler
      Check 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: IStructureHandler
      If 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: IStructureHandler
      The 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: IStructureHandler
      Check 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: IStructureHandler
      If 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: IStructureHandler
      If creative placement (Free placement without inventory).
      Returns:
      true if so.
    • getStepsPerCall

      public int getStepsPerCall()
      Description copied from interface: IStructureHandler
      How 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: IStructureHandler
      Special equal condition check.
      Parameters:
      state - the first state.
      state1 - the second state.
      Returns:
      true if considered equal and block should be skipped.
    • hasRequiredItems

      public boolean hasRequiredItems(List<net.minecraft.world.item.ItemStack> requiredItems)
      Description copied from interface: IStructureHandler
      Check 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: IStructureHandler
      Execute 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: IStructureHandler
      Get 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).