Package net.minecraft.block
Class AbstractRailBlock
java.lang.Object
net.minecraft.block.AbstractBlock
net.minecraft.block.Block
net.minecraft.block.AbstractRailBlock
- All Implemented Interfaces:
ItemConvertible
- Direct Known Subclasses:
DetectorRailBlock
,PoweredRailBlock
,RailBlock
public abstract class AbstractRailBlock extends Block
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.block.Block
Block.NeighborGroup
Nested classes/interfaces inherited from class net.minecraft.block.AbstractBlock
AbstractBlock.AbstractBlockState, AbstractBlock.ContextPredicate, AbstractBlock.OffsetType, AbstractBlock.Settings, AbstractBlock.TypedContextPredicate<A>
-
Field Summary
Fields Modifier and Type Field Description private boolean
allowCurves
protected static VoxelShape
ASCENDING_SHAPE
protected static VoxelShape
STRAIGHT_SHAPE
Fields inherited from class net.minecraft.block.Block
LOGGER, STATE_IDS, stateManager
Fields inherited from class net.minecraft.block.AbstractBlock
collidable, dynamicBounds, FACINGS, jumpVelocityMultiplier, lootTableId, material, randomTicks, resistance, settings, slipperiness, soundGroup, velocityMultiplier
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractRailBlock(boolean allowCurves, AbstractBlock.Settings settings)
-
Method Summary
Modifier and Type Method Description boolean
canMakeCurves()
boolean
canPlaceAt(BlockState state, WorldView world, BlockPos pos)
VoxelShape
getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context)
PistonBehavior
getPistonBehavior(BlockState state)
BlockState
getPlacementState(ItemPlacementContext ctx)
abstract Property<RailShape>
getShapeProperty()
static boolean
isRail(BlockState state)
static boolean
isRail(World world, BlockPos pos)
void
neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify)
void
onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify)
void
onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved)
Called inWorldChunk.setBlockState(BlockPos, BlockState, boolean)
ifnewState
is different fromstate
.private static boolean
shouldDropRail(BlockPos pos, World world, RailShape shape)
Checks if this rail should be dropped.protected void
updateBlockState(BlockState state, World world, BlockPos pos, Block neighbor)
protected BlockState
updateBlockState(World world, BlockPos pos, BlockState state, boolean forceUpdate)
protected BlockState
updateCurves(BlockState state, World world, BlockPos pos, boolean notify)
Methods inherited from class net.minecraft.block.Block
addStacksForDisplay, afterBreak, appendProperties, appendTooltip, asBlock, asItem, canMobSpawnInside, cannotConnect, createCuboidShape, dropExperience, dropStack, dropStacks, dropStacks, dropStacks, getBlastResistance, getBlockFromItem, getDefaultState, getDroppedStacks, getDroppedStacks, getJumpVelocityMultiplier, getName, getPickStack, getRawIdFromState, getSlipperiness, getSoundGroup, getStateFromRawId, getStateManager, getTranslationKey, getVelocityMultiplier, hasDynamicBounds, hasRandomTicks, hasTopRim, is, isFaceFullSquare, isIn, isShapeFullCube, isTranslucent, onBreak, onBroken, onDestroyedByExplosion, onEntityLand, onLandedUpon, onPlaced, onSteppedOn, postProcessState, pushEntitiesUpBeforeBlockChange, rainTick, randomDisplayTick, replace, replace, setDefaultState, shouldDrawSide, shouldDropItemsOnExplosion, sideCoversSmallSquare, toString
Methods inherited from class net.minecraft.block.AbstractBlock
calcBlockBreakingDelta, canBucketPlace, canPathfindThrough, canReplace, createScreenHandlerFactory, emitsRedstonePower, getAmbientOcclusionLightLevel, getCollisionShape, getComparatorOutput, getCullingShape, getDefaultMaterialColor, getDroppedStacks, getFluidState, getLootTableId, getOffsetType, getOpacity, getRaycastShape, getRenderingSeed, getRenderType, getSidesShape, getStateForNeighborUpdate, getStrongRedstonePower, getVisualShape, getWeakRedstonePower, hasBlockEntity, hasComparatorOutput, hasSidedTransparency, isSideInvisible, mirror, onBlockBreakStart, onEntityCollision, onProjectileHit, onStacksDropped, onSyncedBlockEvent, onUse, prepare, randomTick, rotate, scheduledTick
-
Field Details
-
STRAIGHT_SHAPE
-
ASCENDING_SHAPE
-
allowCurves
private final boolean allowCurves
-
-
Constructor Details
-
AbstractRailBlock
-
-
Method Details
-
isRail
-
isRail
-
canMakeCurves
public boolean canMakeCurves() -
getOutlineShape
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context)- Overrides:
getOutlineShape
in classAbstractBlock
-
canPlaceAt
- Overrides:
canPlaceAt
in classAbstractBlock
-
onBlockAdded
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify)- Overrides:
onBlockAdded
in classAbstractBlock
-
updateCurves
-
neighborUpdate
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify)- Overrides:
neighborUpdate
in classAbstractBlock
-
shouldDropRail
Checks if this rail should be dropped.This method will return true if:
- The rail block is ascending.
- The block in the direction of ascent does not have a top rim.
-
updateBlockState
-
updateBlockState
protected BlockState updateBlockState(World world, BlockPos pos, BlockState state, boolean forceUpdate) -
getPistonBehavior
- Overrides:
getPistonBehavior
in classAbstractBlock
-
onStateReplaced
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved)Called inWorldChunk.setBlockState(BlockPos, BlockState, boolean)
ifnewState
is different fromstate
. Vanilla blocks perform removal cleanups here.- Overrides:
onStateReplaced
in classAbstractBlock
-
getPlacementState
- Overrides:
getPlacementState
in classBlock
-
getShapeProperty
-