Class TestBlock
- All Implemented Interfaces:
BlockEntityProvider
,OperatorBlock
,ItemConvertible
,ToggleableFeature
- Mappings:
Namespace Name named net/minecraft/block/TestBlock
intermediary net/minecraft/class_10631
official dwi
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.block.AbstractBlock
AbstractBlock.AbstractBlockState, AbstractBlock.ContextPredicate, AbstractBlock.Offsetter, AbstractBlock.OffsetType, AbstractBlock.Settings, AbstractBlock.TypedContextPredicate<A>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<TestBlock> static final EnumProperty
<TestBlockMode> Fields inherited from class net.minecraft.block.Block
field_31023, field_31024, field_31025, FORCE_STATE, FORCE_STATE_AND_SKIP_CALLBACKS_AND_DROPS, MOVED, NO_REDRAW, NOTIFY_ALL, NOTIFY_ALL_AND_REDRAW, NOTIFY_LISTENERS, NOTIFY_NEIGHBORS, REDRAW_ON_MAIN_THREAD, SKIP_BLOCK_ADDED_CALLBACK, SKIP_BLOCK_ENTITY_REPLACED_CALLBACK, SKIP_DROPS, SKIP_REDRAW_AND_BLOCK_ENTITY_REPLACED_CALLBACK, SKIP_REDSTONE_WIRE_STATE_REPLACEMENT, STATE_IDS, stateManager
Fields inherited from class net.minecraft.block.AbstractBlock
collidable, DIRECTIONS, dynamicBounds, jumpVelocityMultiplier, lootTableKey, randomTicks, requiredFeatures, resistance, settings, slipperiness, soundGroup, translationKey, velocityMultiplier
Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendProperties
(StateManager.Builder<Block, BlockState> builder) Appends block state properties to this block.static ItemStack
applyBlockStateToStack
(ItemStack stack, TestBlockMode mode) createBlockEntity
(BlockPos pos, BlockState state) Returns a new block entity instance.private static @Nullable TestBlockEntity
getBlockEntityOnServer
(World world, BlockPos pos) protected com.mojang.serialization.MapCodec
<TestBlock> getCodec()
protected ItemStack
getPickStack
(WorldView world, BlockPos pos, BlockState state, boolean includeData) int
getWeakRedstonePower
(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the weak redstone power emitted from the block.protected void
neighborUpdate
(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) Called when a neighboring block is updated.protected ActionResult
onUse
(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) protected void
scheduledTick
(BlockState state, ServerWorld world, BlockPos pos, Random random) Called server-side when a block receives a scheduled tick.Methods inherited from class net.minecraft.block.BlockWithEntity
createScreenHandlerFactory, onSyncedBlockEvent, validateTicker
Methods inherited from class net.minecraft.block.Block
afterBreak, asBlock, asItem, canMobSpawnInside, cannotConnect, createColumnShape, createColumnShape, createCubeShape, createCuboidShape, createCuboidShape, createCuboidZShape, createCuboidZShape, createCuboidZShape, createShapeArray, createShapeFunction, createShapeFunction, dropExperience, dropExperienceWhenMined, dropStack, dropStack, dropStacks, dropStacks, dropStacks, getBlastResistance, getBlockFromItem, getDefaultState, getDroppedStacks, getDroppedStacks, getJumpVelocityMultiplier, getName, getRawIdFromState, getRegistryEntry, getSlipperiness, getStateFromRawId, getStateManager, getStateWithProperties, getVelocityMultiplier, hasDynamicBounds, hasTopRim, isFaceFullSquare, isShapeFullCube, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, onPlaced, onSteppedOn, postProcessState, precipitationTick, pushEntitiesUpBeforeBlockChange, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, shouldDropItemsOnExplosion, sideCoversSmallSquare, spawnBreakParticles, toString
Methods inherited from class net.minecraft.block.AbstractBlock
calcBlockBreakingDelta, canBucketPlace, canPathfindThrough, canPlaceAt, canReplace, createCodec, createSettingsCodec, emitsRedstonePower, getAmbientOcclusionLightLevel, getCameraCollisionShape, getCollisionShape, getComparatorOutput, getCullingShape, getDefaultMapColor, getDroppedStacks, getFluidState, getHardness, getInsideCollisionShape, getLootTableKey, getMaxHorizontalModelOffset, getOpacity, getOutlineShape, getRaycastShape, getRenderingSeed, getRenderType, getRequiredFeatures, getSettings, getSidesShape, getSoundGroup, getStateForNeighborUpdate, getStrongRedstonePower, getTranslationKey, getVerticalModelOffsetMultiplier, hasComparatorOutput, hasRandomTicks, hasSidedTransparency, isShapeFullCube, isSideInvisible, isTransparent, mirror, onBlockAdded, onBlockBreakStart, onEntityCollision, onExploded, onProjectileHit, onStacksDropped, onStateReplaced, onUseWithItem, prepare, randomTick, rotate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.block.BlockEntityProvider
getGameEventListener, getTicker
Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODEC
Lnet/minecraft/block/TestBlock;CODEC:Lcom/mojang/serialization/MapCodec;
intermediary field_55989
Lnet/minecraft/class_10631;field_55989:Lcom/mojang/serialization/MapCodec;
official a
Ldwi;a:Lcom/mojang/serialization/MapCodec;
-
MODE
- Mappings:
Namespace Name Mixin selector named MODE
Lnet/minecraft/block/TestBlock;MODE:Lnet/minecraft/state/property/EnumProperty;
intermediary field_55990
Lnet/minecraft/class_10631;field_55990:Lnet/minecraft/class_2754;
official b
Ldwi;b:Leco;
-
-
Constructor Details
-
Method Details
-
createBlockEntity
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 interfaceBlockEntityProvider
- Returns:
- a new block entity instance
- Implementation Note:
- While this is marked as nullable, in practice this should never return
null
.PistonExtensionBlock
is the only block in vanilla that returnsnull
inside the implementation. - Mappings:
Namespace Name Mixin selector named createBlockEntity
Lnet/minecraft/block/BlockEntityProvider;createBlockEntity(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Lnet/minecraft/block/entity/BlockEntity;
intermediary method_10123
Lnet/minecraft/class_2343;method_10123(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)Lnet/minecraft/class_2586;
official a
Ldqi;a(Liw;Lebq;)Ldyo;
-
getPlacementState
- Overrides:
getPlacementState
in classBlock
- Mappings:
Namespace Name Mixin selector named getPlacementState
Lnet/minecraft/block/Block;getPlacementState(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/block/BlockState;
intermediary method_9605
Lnet/minecraft/class_2248;method_9605(Lnet/minecraft/class_1750;)Lnet/minecraft/class_2680;
official a
Ldno;a(Lded;)Lebq;
-
appendProperties
Appends block state properties to this block. To use this, override and callStateManager.Builder.add(net.minecraft.state.property.Property<?>[])
inside the method. SeeProperties
for the list of pre-defined properties.- Overrides:
appendProperties
in classBlock
- Mappings:
Namespace Name Mixin selector named appendProperties
Lnet/minecraft/block/Block;appendProperties(Lnet/minecraft/state/StateManager$Builder;)V
intermediary method_9515
Lnet/minecraft/class_2248;method_9515(Lnet/minecraft/class_2689$class_2690;)V
official a
Ldno;a(Lebr$a;)V
-
onUse
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) - Overrides:
onUse
in classAbstractBlock
- Mappings:
Namespace Name Mixin selector 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/hit/BlockHitResult;)Lnet/minecraft/util/ActionResult;
intermediary method_55766
Lnet/minecraft/class_4970;method_55766(Lnet/minecraft/class_2680;Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_1657;Lnet/minecraft/class_3965;)Lnet/minecraft/class_1269;
official a
Lebp;a(Lebq;Ldkj;Liw;Lcsi;Lffy;)Lbvc;
-
scheduledTick
Called server-side when a block receives a scheduled tick. This can be used like a timer. Scheduled ticks are added usingScheduledTickView.scheduleBlockTick(BlockPos, Block, int)
.Scheduled ticks are often used inside
AbstractBlock.getStateForNeighborUpdate(net.minecraft.block.BlockState, net.minecraft.world.WorldView, net.minecraft.world.tick.ScheduledTickView, net.minecraft.util.math.BlockPos, net.minecraft.util.math.Direction, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, net.minecraft.util.math.random.Random)
.Here are some examples:
SugarCaneBlock
checks the placement requirement.DispenserBlock
dispenses its content.CommandBlock
executes its command.FrogspawnBlock
spawns a tadpole.SoulSandBlock
updates a bubble column.FallingBlock
tries to fall.
- Overrides:
scheduledTick
in classAbstractBlock
- See Also:
- Mappings:
Namespace Name Mixin selector 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
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
official a
Lebp;a(Lebq;Lasb;Liw;Lbai;)V
-
neighborUpdate
protected void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable @Nullable WireOrientation wireOrientation, 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 asSpongeBlock
which absorbs water.To replace the state of the block itself, override
AbstractBlock.getStateForNeighborUpdate(net.minecraft.block.BlockState, net.minecraft.world.WorldView, net.minecraft.world.tick.ScheduledTickView, net.minecraft.util.math.BlockPos, net.minecraft.util.math.Direction, net.minecraft.util.math.BlockPos, net.minecraft.block.BlockState, net.minecraft.util.math.random.Random)
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 classAbstractBlock
- See Also:
- Mappings:
Namespace Name Mixin selector 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/world/block/WireOrientation;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_9904;Z)V
official a
Lebp;a(Lebq;Ldkj;Liw;Ldno;Lezi;Z)V
-
getBlockEntityOnServer
@Nullable private static @Nullable TestBlockEntity getBlockEntityOnServer(World world, BlockPos pos) - Mappings:
Namespace Name Mixin selector named getBlockEntityOnServer
Lnet/minecraft/block/TestBlock;getBlockEntityOnServer(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/entity/TestBlockEntity;
intermediary method_66712
Lnet/minecraft/class_10631;method_66712(Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)Lnet/minecraft/class_10637;
official a
Ldwi;a(Ldkj;Liw;)Leai;
-
getWeakRedstonePower
public int getWeakRedstonePower(BlockState state, BlockView world, BlockPos pos, Direction direction) Returns the weak redstone power emitted from the block.When overriding this, make sure to also override
AbstractBlock.emitsRedstonePower(net.minecraft.block.BlockState)
to returntrue
.Weak redstone power is a power that cannot power a redstone wire when a solid block is in between. For example,
RedstoneBlock
andTargetBlock
emits weak redstone power only.LeverBlock
andButtonBlock
emits both weak and strong redstone power depending on the direction.- Overrides:
getWeakRedstonePower
in classAbstractBlock
- Returns:
- the weak redstone power emitted from the block
- See Also:
- Mappings:
Namespace Name Mixin selector named getWeakRedstonePower
Lnet/minecraft/block/AbstractBlock;getWeakRedstonePower(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;)I
intermediary method_9524
Lnet/minecraft/class_4970;method_9524(Lnet/minecraft/class_2680;Lnet/minecraft/class_1922;Lnet/minecraft/class_2338;Lnet/minecraft/class_2350;)I
official a
Lebp;a(Lebq;Ldjn;Liw;Ljc;)I
-
getPickStack
protected ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) - Overrides:
getPickStack
in classAbstractBlock
- Mappings:
Namespace Name Mixin selector named getPickStack
Lnet/minecraft/block/AbstractBlock;getPickStack(Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)Lnet/minecraft/item/ItemStack;
intermediary method_9574
Lnet/minecraft/class_4970;method_9574(Lnet/minecraft/class_4538;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Z)Lnet/minecraft/class_1799;
official a
Lebp;a(Ldkm;Liw;Lebq;Z)Ldak;
-
applyBlockStateToStack
- Mappings:
Namespace Name Mixin selector named applyBlockStateToStack
Lnet/minecraft/block/TestBlock;applyBlockStateToStack(Lnet/minecraft/item/ItemStack;Lnet/minecraft/block/enums/TestBlockMode;)Lnet/minecraft/item/ItemStack;
intermediary method_66711
Lnet/minecraft/class_10631;method_66711(Lnet/minecraft/class_1799;Lnet/minecraft/class_10641;)Lnet/minecraft/class_1799;
official a
Ldwi;a(Ldak;Ledb;)Ldak;
-
getCodec
- Specified by:
getCodec
in classBlockWithEntity
- Mappings:
Namespace Name Mixin selector named getCodec
Lnet/minecraft/block/AbstractBlock;getCodec()Lcom/mojang/serialization/MapCodec;
intermediary method_53969
Lnet/minecraft/class_4970;method_53969()Lcom/mojang/serialization/MapCodec;
official a
Lebp;a()Lcom/mojang/serialization/MapCodec;
-