Class StructureBlock

All Implemented Interfaces:
BlockEntityProvider, OperatorBlock, ItemConvertible, ToggleableFeature

public class StructureBlock extends BlockWithEntity implements OperatorBlock
Mappings:
Namespace Name
official cxe
intermediary net/minecraft/class_2515
named net/minecraft/block/StructureBlock
  • Field Details

    • MODE

      public static final EnumProperty<StructureBlockMode> MODE
      Mappings:
      Namespace Name Mixin selector
      official a Lcxe;a:Ldcr;
      intermediary field_11586 Lnet/minecraft/class_2515;field_11586:Lnet/minecraft/class_2754;
      named MODE Lnet/minecraft/block/StructureBlock;MODE:Lnet/minecraft/state/property/EnumProperty;
  • Constructor Details

    • StructureBlock

      protected StructureBlock(AbstractBlock.Settings settings)
      Mappings:
      Namespace Name Mixin selector
      official <init> Ldbs;<init>(Ldbs$d;)V
      intermediary <init> Lnet/minecraft/class_4970;<init>(Lnet/minecraft/class_4970$class_2251;)V
      named <init> Lnet/minecraft/block/AbstractBlock;<init>(Lnet/minecraft/block/AbstractBlock$Settings;)V
  • Method Details

    • createBlockEntity

      public BlockEntity createBlockEntity(BlockPos pos, BlockState state)
      Returns a new block entity instance.

      For example:

      
       @Override
       public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
         return new MyBlockEntity(pos, state);
       }
       
      Specified by:
      createBlockEntity in interface BlockEntityProvider
      Returns:
      a new block entity instance
      Mappings:
      Namespace Name Mixin selector
      official a Lcru;a(Lgu;Ldbt;)Lczf;
      intermediary method_10123 Lnet/minecraft/class_2343;method_10123(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)Lnet/minecraft/class_2586;
      named createBlockEntity Lnet/minecraft/block/BlockEntityProvider;createBlockEntity(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/entity/BlockEntity;
    • onUse

      public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit)
      Called when this block is used by a player. This, by default, is bound to using the right mouse button.

      This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using world.isClient().

      If the action result is successful on a logical client, then the action will be sent to the logical server for processing.

      Overrides:
      onUse in class AbstractBlock
      Returns:
      an action result that specifies if using the block was successful.
      Mappings:
      Namespace Name Mixin selector
      official a Ldbs;a(Ldbt;Lcmf;Lgu;Lbyi;Lbdt;Ledq;)Lbdu;
      intermediary method_9534 Lnet/minecraft/class_4970;method_9534(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;Lnet/minecraft/class_3965;)Lnet/minecraft/class_1269;
      named onUse Lnet/minecraft/block/AbstractBlock;onUse(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;
    • onPlaced

      public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable @Nullable LivingEntity placer, ItemStack itemStack)
      Called when the player placed the block.

      Tall or wide blocks (such as doors or beds) should override this to place the other half of the block. Blocks with block entities can use this to copy the data from the item stack, such as the custom name.

      This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using World.isClient.

      Overrides:
      onPlaced in class Block
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lcpg;a(Lcmf;Lgu;Ldbt;Lbft;Lcfs;)V
      intermediary method_9567 Lnet/minecraft/class_2248;method_9567(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;)V
      named onPlaced Lnet/minecraft/block/Block;onPlaced(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;)V
    • getRenderType

      public BlockRenderType getRenderType(BlockState state)
      Returns the block's render type (invisible, animated, model).
      Overrides:
      getRenderType in class BlockWithEntity
      Returns:
      the block's render type (invisible, animated, model)
      Mappings:
      Namespace Name Mixin selector
      official b_ Ldbs;b_(Ldbt;)Lcvk;
      intermediary method_9604 Lnet/minecraft/class_4970;method_9604(Lnet/minecraft/class_2680;)Lnet/minecraft/class_2464;
      named getRenderType Lnet/minecraft/block/AbstractBlock;getRenderType(Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/BlockRenderType;
    • appendProperties

      protected void appendProperties(StateManager.Builder<Block,BlockState> builder)
      Appends block state properties to this block. To use this, override and call StateManager.Builder.add(net.minecraft.state.property.Property<?>[]) inside the method. See Properties for the list of pre-defined properties.
      Overrides:
      appendProperties in class Block
      Mappings:
      Namespace Name Mixin selector
      official a Lcpg;a(Ldbu$a;)V
      intermediary method_9515 Lnet/minecraft/class_2248;method_9515(Lnet/minecraft/class_2689$class_2690;)V
      named appendProperties Lnet/minecraft/block/Block;appendProperties(Lnet/minecraft/state/StateManager$Builder;)V
    • neighborUpdate

      public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify)
      Called when a neighboring block is updated. This method should be overridden to perform an action with a side effect, most notably an activation of a redstone component. This can also be used to perform an action changing block states of other blocks, such as SpongeBlock which absorbs water.

      To replace the state of the block itself, override AbstractBlock.getStateForNeighborUpdate(net.minecraft.block.BlockState, net.minecraft.util.math.Direction, net.minecraft.block.BlockState, net.minecraft.world.WorldAccess, net.minecraft.util.math.BlockPos, net.minecraft.util.math.BlockPos) instead.

      This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using World.isClient.

      Overrides:
      neighborUpdate in class AbstractBlock
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Ldbs;a(Ldbt;Lcmf;Lgu;Lcpg;Lgu;Z)V
      intermediary method_9612 Lnet/minecraft/class_4970;method_9612(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2248;Lnet/minecraft/class_2338;Z)V
      named neighborUpdate Lnet/minecraft/block/AbstractBlock;neighborUpdate(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;Lnet/minecraft/util/math/BlockPos;Z)V
    • doAction

      private void doAction(ServerWorld world, StructureBlockBlockEntity blockEntity)
      Mappings:
      Namespace Name Mixin selector
      official a Lcxe;a(Laid;Ldas;)V
      intermediary method_10703 Lnet/minecraft/class_2515;method_10703(Lnet/minecraft/class_3218;Lnet/minecraft/class_2633;)V
      named doAction Lnet/minecraft/block/StructureBlock;doAction(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/block/entity/StructureBlockBlockEntity;)V