Class ComparatorBlock

All Implemented Interfaces:
BlockEntityProvider, class_7695, ItemConvertible

public class ComparatorBlock extends AbstractRedstoneGateBlock implements BlockEntityProvider
Mappings:
Namespace Name
official cnb
intermediary net/minecraft/class_2286
named net/minecraft/block/ComparatorBlock
  • Field Details

    • MODE

      public static final EnumProperty<ComparatorMode> MODE
      Mappings:
      Namespace Name Mixin selector
      official a Lcnb;a:Lcys;
      intermediary field_10789 Lnet/minecraft/class_2286;field_10789:Lnet/minecraft/class_2754;
      named MODE Lnet/minecraft/block/ComparatorBlock;MODE:Lnet/minecraft/state/property/EnumProperty;
  • Constructor Details

    • ComparatorBlock

      public ComparatorBlock(AbstractBlock.Settings settings)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcxt;<init>(Lcxt$c;)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

    • getUpdateDelayInternal

      protected int getUpdateDelayInternal(BlockState state)
      Specified by:
      getUpdateDelayInternal in class AbstractRedstoneGateBlock
      Mappings:
      Namespace Name Mixin selector
      official g Lcnq;g(Lcxu;)I
      intermediary method_9992 Lnet/minecraft/class_2312;method_9992(Lnet/minecraft/class_2680;)I
      named getUpdateDelayInternal Lnet/minecraft/block/AbstractRedstoneGateBlock;getUpdateDelayInternal(Lnet/minecraft/block/BlockState;)I
    • getOutputLevel

      protected int getOutputLevel(BlockView world, BlockPos pos, BlockState state)
      Overrides:
      getOutputLevel in class AbstractRedstoneGateBlock
      Mappings:
      Namespace Name Mixin selector
      official b Lcnq;b(Lcif;Lgr;Lcxu;)I
      intermediary method_9993 Lnet/minecraft/class_2312;method_9993(Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)I
      named getOutputLevel Lnet/minecraft/block/AbstractRedstoneGateBlock;getOutputLevel(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)I
    • calculateOutputSignal

      private int calculateOutputSignal(World world, BlockPos pos, BlockState state)
      Mappings:
      Namespace Name Mixin selector
      official e Lcnb;e(Lciz;Lgr;Lcxu;)I
      intermediary method_9773 Lnet/minecraft/class_2286;method_9773(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)I
      named calculateOutputSignal Lnet/minecraft/block/ComparatorBlock;calculateOutputSignal(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)I
    • hasPower

      protected boolean hasPower(World world, BlockPos pos, BlockState state)
      Overrides:
      hasPower in class AbstractRedstoneGateBlock
      Mappings:
      Namespace Name Mixin selector
      official a Lcnq;a(Lciz;Lgr;Lcxu;)Z
      intermediary method_9990 Lnet/minecraft/class_2312;method_9990(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)Z
      named hasPower Lnet/minecraft/block/AbstractRedstoneGateBlock;hasPower(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z
    • getPower

      protected int getPower(World world, BlockPos pos, BlockState state)
      Overrides:
      getPower in class AbstractRedstoneGateBlock
      Mappings:
      Namespace Name Mixin selector
      official b Lcnq;b(Lciz;Lgr;Lcxu;)I
      intermediary method_9991 Lnet/minecraft/class_2312;method_9991(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)I
      named getPower Lnet/minecraft/block/AbstractRedstoneGateBlock;getPower(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)I
    • getAttachedItemFrame

      @Nullable private @Nullable ItemFrameEntity getAttachedItemFrame(World world, Direction facing, BlockPos pos)
      Mappings:
      Namespace Name Mixin selector
      official a Lcnb;a(Lciz;Lgw;Lgr;)Lbse;
      intermediary method_9774 Lnet/minecraft/class_2286;method_9774(Lnet/minecraft/class_1937;Lnet/minecraft/class_2350;Lnet/minecraft/class_2338;)Lnet/minecraft/class_1533;
      named getAttachedItemFrame Lnet/minecraft/block/ComparatorBlock;getAttachedItemFrame(Lnet/minecraft/world/World;Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/entity/decoration/ItemFrameEntity;
    • 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 Lcxt;a(Lcxu;Lciz;Lgr;Lbvs;Lbbt;Ldza;)Lbbu;
      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;
    • updatePowered

      protected void updatePowered(World world, BlockPos pos, BlockState state)
      Overrides:
      updatePowered in class AbstractRedstoneGateBlock
      Mappings:
      Namespace Name Mixin selector
      official c Lcnq;c(Lciz;Lgr;Lcxu;)V
      intermediary method_9998 Lnet/minecraft/class_2312;method_9998(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)V
      named updatePowered Lnet/minecraft/block/AbstractRedstoneGateBlock;updatePowered(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V
    • update

      private void update(World world, BlockPos pos, BlockState state)
      Mappings:
      Namespace Name Mixin selector
      official f Lcnb;f(Lciz;Lgr;Lcxu;)V
      intermediary method_9775 Lnet/minecraft/class_2286;method_9775(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)V
      named update Lnet/minecraft/block/ComparatorBlock;update(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V
    • scheduledTick

      public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random)
      Called server-side when a block receives a scheduled tick. This can be used like a timer. Scheduled ticks are added using
      invalid @link
      WorldAccess#createAndScheduleBlockTick(BlockPos, Block, int)
      . Additionally, AbstractBlock.randomTick(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.util.math.random.Random) by default calls this method; override AbstractBlock.randomTick(net.minecraft.block.BlockState, net.minecraft.server.world.ServerWorld, net.minecraft.util.math.BlockPos, net.minecraft.util.math.random.Random) to disable this behavior.

      Scheduled ticks are often used inside 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).

      Here are some examples:

      Overrides:
      scheduledTick in class AbstractRedstoneGateBlock
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lcxt;a(Lcxu;Lahb;Lgr;Lanu;)V
      intermediary method_9588 Lnet/minecraft/class_4970;method_9588(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Lnet/minecraft/class_5819;)V
      named scheduledTick Lnet/minecraft/block/AbstractBlock;scheduledTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/Random;)V
    • onSyncedBlockEvent

      public boolean onSyncedBlockEvent(BlockState state, World world, BlockPos pos, int type, int data)
      Handles the block event, which is an event specific to a block with an integer ID and data.
      Overrides:
      onSyncedBlockEvent in class AbstractBlock
      Returns:
      whether the event was handled successfully
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lcxt;a(Lcxu;Lciz;Lgr;II)Z
      intermediary method_9592 Lnet/minecraft/class_4970;method_9592(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;II)Z
      named onSyncedBlockEvent Lnet/minecraft/block/AbstractBlock;onSyncedBlockEvent(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;II)Z
    • 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 Lcog;a(Lgr;Lcxu;)Lcvm;
      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;
    • 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 Lclw;a(Lcxv$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