Class BlockEntityTagSubstitution.ReplacementBlock
java.lang.Object
com.ldtteam.structurize.blockentities.BlockEntityTagSubstitution.ReplacementBlock
- Enclosing class:
- BlockEntityTagSubstitution
Storage for information about the replacement block, if any.
-
Constructor Summary
ConstructorsConstructorDescriptionReplacementBlock(@NotNull net.minecraft.nbt.CompoundTag tag) Construct from tagReplacementBlock(@NotNull net.minecraft.world.level.block.state.BlockState blockstate, @Nullable net.minecraft.nbt.CompoundTag blockentity, @NotNull net.minecraft.world.item.ItemStack itemstack) ConstructReplacementBlock(@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 TypeMethodDescription@Nullable net.minecraft.world.level.block.entity.BlockEntitycreateBlockEntity(net.minecraft.core.BlockPos pos) Always creates and loads a new replacement block entity, if needed.@NotNull BlueprintCreates a new single-blockBlueprintfor the replacement block.@Nullable net.minecraft.world.level.block.entity.BlockEntitygetBlockEntity(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.ItemStackbooleanisEmpty()rotateWithMirror(@NotNull net.minecraft.core.BlockPos pos, @NotNull net.minecraft.world.level.block.Rotation localRotation, @NotNull net.minecraft.world.level.block.Mirror localMirror, @NotNull net.minecraft.world.level.Level world) Deprecated, for removal: This API element is subject to removal in a future version.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.CompoundTagwrite(@NotNull net.minecraft.nbt.CompoundTag tag) Serialisation
-
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 stateblockentity- the block entity, if anyitemstack- 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 stateblockentity- the block entity tag, if anyitemstack- 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
Creates a new single-blockBlueprintfor the replacement block.- Returns:
- the blueprint
-
rotateWithMirror
@NotNull @Deprecated(since="1.20", forRemoval=true) public BlockEntityTagSubstitution.ReplacementBlock rotateWithMirror(@NotNull @NotNull net.minecraft.core.BlockPos pos, @NotNull @NotNull net.minecraft.world.level.block.Rotation localRotation, @NotNull @NotNull net.minecraft.world.level.block.Mirror localMirror, @NotNull @NotNull net.minecraft.world.level.Level world) Deprecated, for removal: This API element is subject to removal in a future version. -
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 blockrotationMirror- the relative rotation/mirrorlevel- the (actual) world- Returns:
- the new replacement data
-