Class BlockEntityTagSubstitution.ReplacementBlock

java.lang.Object
com.ldtteam.structurize.blockentities.BlockEntityTagSubstitution.ReplacementBlock
Enclosing class:
BlockEntityTagSubstitution

public static class BlockEntityTagSubstitution.ReplacementBlock extends Object
Storage for information about the replacement block, if any.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReplacementBlock(@NotNull net.minecraft.nbt.CompoundTag tag)
    Construct from tag
    ReplacementBlock(@NotNull net.minecraft.world.level.block.state.BlockState blockstate, @Nullable net.minecraft.nbt.CompoundTag blockentity, @NotNull net.minecraft.world.item.ItemStack itemstack)
    Construct
    ReplacementBlock(@NotNull net.minecraft.world.level.block.state.BlockState blockstate, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockentity, @NotNull net.minecraft.world.item.ItemStack itemstack)
    Construct
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable net.minecraft.world.level.block.entity.BlockEntity
    createBlockEntity(net.minecraft.core.BlockPos pos)
    Always creates and loads a new replacement block entity, if needed.
    @NotNull Blueprint
    Creates a new single-block Blueprint for the replacement block.
    @Nullable net.minecraft.world.level.block.entity.BlockEntity
    getBlockEntity(net.minecraft.core.BlockPos pos)
    Creates and loads (once) the replacement block entity, or returns the preloaded one.
    @NotNull net.minecraft.nbt.CompoundTag
     
    @NotNull net.minecraft.world.level.block.state.BlockState
     
    @NotNull net.minecraft.world.item.ItemStack
     
    boolean
     
    rotateWithMirror(net.minecraft.core.BlockPos pos, RotationMirror rotationMirror, net.minecraft.world.level.Level level)
    Rotates and mirrors the replacement data, in response to a blueprint containing this replacement block being rotated or mirrored.
    @NotNull net.minecraft.nbt.CompoundTag
    write(@NotNull net.minecraft.nbt.CompoundTag tag)
    Serialisation

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ReplacementBlock

      public ReplacementBlock(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState blockstate, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity blockentity, @NotNull @NotNull net.minecraft.world.item.ItemStack itemstack)
      Construct
      Parameters:
      blockstate - the block state
      blockentity - the block entity, if any
      itemstack - the item stack
    • ReplacementBlock

      public ReplacementBlock(@NotNull @NotNull net.minecraft.world.level.block.state.BlockState blockstate, @Nullable @Nullable net.minecraft.nbt.CompoundTag blockentity, @NotNull @NotNull net.minecraft.world.item.ItemStack itemstack)
      Construct
      Parameters:
      blockstate - the block state
      blockentity - the block entity tag, if any
      itemstack - the item stack
    • ReplacementBlock

      public ReplacementBlock(@NotNull @NotNull net.minecraft.nbt.CompoundTag tag)
      Construct from tag
      Parameters:
      tag - the tag to load
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns:
      true if there is no replacement block set (assume air)
    • getBlockState

      @NotNull public @NotNull net.minecraft.world.level.block.state.BlockState getBlockState()
      Returns:
      the block state
    • getBlockEntityTag

      @NotNull public @NotNull net.minecraft.nbt.CompoundTag getBlockEntityTag()
      Returns:
      the block entity tag
    • getItemStack

      @NotNull public @NotNull net.minecraft.world.item.ItemStack getItemStack()
      Returns:
      the item stack
    • getBlockEntity

      @Nullable public @Nullable net.minecraft.world.level.block.entity.BlockEntity getBlockEntity(net.minecraft.core.BlockPos pos)
      Creates and loads (once) the replacement block entity, or returns the preloaded one.
      Parameters:
      pos - the blockpos to use (ignored if already loaded)
      Returns:
      the new or cached entity, or null if there isn't one
    • createBlockEntity

      @Nullable public @Nullable net.minecraft.world.level.block.entity.BlockEntity createBlockEntity(net.minecraft.core.BlockPos pos)
      Always creates and loads a new replacement block entity, if needed.
      Parameters:
      pos - the blockpos to use
      Returns:
      the new entity, or null if there isn't one
    • write

      @NotNull public @NotNull net.minecraft.nbt.CompoundTag write(@NotNull @NotNull net.minecraft.nbt.CompoundTag tag)
      Serialisation
      Parameters:
      tag - the target tag
      Returns:
      the target tag, for convenience
    • createBlueprint

      @NotNull public @NotNull Blueprint createBlueprint()
      Creates a new single-block Blueprint for the replacement block.
      Returns:
      the blueprint
    • rotateWithMirror

      public BlockEntityTagSubstitution.ReplacementBlock rotateWithMirror(net.minecraft.core.BlockPos pos, RotationMirror rotationMirror, net.minecraft.world.level.Level level)
      Rotates and mirrors the replacement data, in response to a blueprint containing this replacement block being rotated or mirrored.
      Parameters:
      pos - the world location for the replacement block
      rotationMirror - the relative rotation/mirror
      level - the (actual) world
      Returns:
      the new replacement data