Package net.minecraft.world.level.block
Class BaseRailBlock
java.lang.Object
net.minecraft.world.level.block.state.BlockBehaviour
net.minecraft.world.level.block.Block
net.minecraft.world.level.block.BaseRailBlock
- All Implemented Interfaces:
FeatureElement,BucketPickup,LiquidBlockContainer,SimpleWaterloggedBlock,ItemLike,IBaseRailBlockExtension,IBlockExtension,IBucketPickupExtension
- Direct Known Subclasses:
DetectorRailBlock,PoweredRailBlock,RailBlock
public abstract class BaseRailBlock
extends Block
implements SimpleWaterloggedBlock, IBaseRailBlockExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.Block
Block.BlockStatePairKeyNested classes/interfaces inherited from class net.minecraft.world.level.block.state.BlockBehaviour
BlockBehaviour.BlockStateBase, BlockBehaviour.OffsetFunction, BlockBehaviour.OffsetType, BlockBehaviour.Properties, BlockBehaviour.StateArgumentPredicate<A>, BlockBehaviour.StatePredicate -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final VoxelShapeprotected static final VoxelShapeprivate final booleanstatic final BooleanPropertyFields inherited from class net.minecraft.world.level.block.Block
BLOCK_STATE_REGISTRY, CODEC, INDESTRUCTIBLE, INSTANT, stateDefinition, UPDATE_ALL, UPDATE_ALL_IMMEDIATE, UPDATE_CLIENTS, UPDATE_IMMEDIATE, UPDATE_INVISIBLE, UPDATE_KNOWN_SHAPE, UPDATE_LIMIT, UPDATE_MOVE_BY_PISTON, UPDATE_NEIGHBORS, UPDATE_NONE, UPDATE_SUPPRESS_DROPSFields inherited from class net.minecraft.world.level.block.state.BlockBehaviour
drops, dynamicShape, explosionResistance, friction, hasCollision, isRandomlyTicking, jumpFactor, properties, requiredFeatures, soundType, speedFactor, UPDATE_SHAPE_ORDERFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseRailBlock(boolean pIsStraight, BlockBehaviour.Properties pProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) protected abstract com.mojang.serialization.MapCodec<? extends BaseRailBlock> codec()protected FluidStategetFluidState(BlockState pState) getRailDirection(BlockState state, BlockGetter world, BlockPos pos, AbstractMinecart cart) Return the rail's direction.protected VoxelShapegetShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) Deprecated.getStateForPlacement(BlockPlaceContext pContext) booleanisFlexibleRail(BlockState state, BlockGetter world, BlockPos pos) Return true if the rail can make corners.static booleanisRail(BlockState pState) static booleanbooleanprotected voidneighborChanged(BlockState pState, Level pLevel, BlockPos pPos, Block pBlock, BlockPos pFromPos, boolean pIsMoving) protected voidonPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) protected voidonRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) private static booleanshouldBeRemoved(BlockPos pPos, Level pLevel, RailShape pShape) protected BlockStateupdateDir(Level pLevel, BlockPos pPos, BlockState pState, boolean pAlwaysPlace) protected BlockStateupdateShape(BlockState pState, Direction pDirection, BlockState pNeighborState, LevelAccessor pLevel, BlockPos pPos, BlockPos pNeighborPos) Update the provided state given the provided neighbor direction and neighbor state, returning a new state.protected BlockStateupdateState(BlockState pState, Level pLevel, BlockPos pPos, boolean pMovedByPiston) protected voidupdateState(BlockState pState, Level pLevel, BlockPos pPos, Block pNeighborBlock) Methods inherited from class net.minecraft.world.level.block.Block
animateTick, appendHoverText, asBlock, asItem, box, builtInRegistryHolder, byItem, canSupportCenter, canSupportRigidBlock, createBlockStateDefinition, defaultBlockState, destroy, dropFromExplosion, dropResources, dropResources, dropResources, fallOn, getCloneItemStack, getDescriptionId, getDrops, getDrops, getExplosionResistance, getFriction, getId, getJumpFactor, getName, getShapeForEachState, getSpeedFactor, getStateDefinition, handlePrecipitation, hasDynamicShape, initializeClient, isExceptionForConnection, isFaceFull, isPossibleToRespawnInThis, isShapeFullBlock, playerDestroy, playerWillDestroy, popExperience, popResource, popResourceFromFace, pushEntitiesUp, registerDefaultState, setPlacedBy, shouldRenderFace, spawnDestroyParticles, stateById, stepOn, toString, tryDropExperience, updateEntityAfterFallOn, updateFromNeighbourShapes, updateOrDestroy, updateOrDestroy, wasExploded, withPropertiesOfMethods inherited from class net.minecraft.world.level.block.state.BlockBehaviour
attack, canBeReplaced, canBeReplaced, defaultDestroyTime, defaultMapColor, entityInside, getAnalogOutputSignal, getBlockSupportShape, getCollisionShape, getDestroyProgress, getDirectSignal, getDrops, getInteractionShape, getLightBlock, getLootTable, getMaxHorizontalOffset, getMaxVerticalOffset, getMenuProvider, getOcclusionShape, getRenderShape, getSeed, getShadeBrightness, getSignal, getSoundType, getVisualShape, hasAnalogOutputSignal, isAir, isCollisionShapeFullBlock, isOcclusionShapeFullBlock, isPathfindable, isRandomlyTicking, isSignalSource, mirror, onExplosionHit, onProjectileHit, propagatesSkylightDown, properties, propertiesCodec, randomTick, requiredFeatures, rotate, simpleCodec, skipRendering, spawnAfterBreak, tick, triggerEvent, updateIndirectNeighbourShapes, useItemOn, useShapeForLightOcclusion, useWithoutItemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IBaseRailBlockExtension
canMakeSlopes, getRailMaxSpeed, isValidRailShape, onMinecartPassMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockExtension
addLandingEffects, addRunningEffects, canBeHydrated, canConnectRedstone, canDropFromExplosion, canEntityDestroy, canHarvestBlock, canStickTo, canSustainPlant, collisionExtendsVertically, getAdjacentBlockPathType, getAppearance, getBeaconColorMultiplier, getBedDirection, getBlockPathType, getBubbleColumnDirection, getCloneItemStack, getEnchantPowerBonus, getExpDrop, getExplosionResistance, getFireSpreadSpeed, getFlammability, getFriction, getLightEmission, getMapColor, getPistonPushReaction, getRespawnPosition, getSoundType, getStateAtViewpoint, getToolModifiedState, getWeakChanges, hasDynamicLightEmission, hidesNeighborFace, isBed, isBurning, isConduitFrame, isEmpty, isFertile, isFireSource, isFlammable, isLadder, isPortalFrame, isScaffolding, isSlimeBlock, isStickyBlock, makesOpenTrapdoorAboveClimbable, onBlockExploded, onBlockStateChange, onCaughtFire, onDestroyedByPlayer, onDestroyedByPushReaction, onNeighborChange, onTreeGrow, rotate, setBedOccupied, shouldCheckWeakPower, shouldDisplayFluidOverlay, shouldHideAdjacentFluidFace, supportsExternalFaceHidingMethods inherited from interface net.neoforged.neoforge.common.extensions.IBucketPickupExtension
getPickupSoundMethods inherited from interface net.minecraft.world.level.block.SimpleWaterloggedBlock
canPlaceLiquid, getPickupSound, pickupBlock, placeLiquid
-
Field Details
-
FLAT_AABB
-
HALF_BLOCK_AABB
-
WATERLOGGED
-
isStraight
private final boolean isStraight
-
-
Constructor Details
-
BaseRailBlock
-
-
Method Details
-
isRail
-
isRail
-
codec
-
isStraight
public boolean isStraight() -
getShape
protected VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) - Overrides:
getShapein classBlockBehaviour
-
canSurvive
- Overrides:
canSurvivein classBlockBehaviour
-
onPlace
protected void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) - Overrides:
onPlacein classBlockBehaviour
-
updateState
protected BlockState updateState(BlockState pState, Level pLevel, BlockPos pPos, boolean pMovedByPiston) -
neighborChanged
protected void neighborChanged(BlockState pState, Level pLevel, BlockPos pPos, Block pBlock, BlockPos pFromPos, boolean pIsMoving) - Overrides:
neighborChangedin classBlockBehaviour
-
shouldBeRemoved
-
updateState
-
updateDir
protected BlockState updateDir(Level pLevel, BlockPos pPos, BlockState pState, boolean pAlwaysPlace) -
onRemove
protected void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) - Overrides:
onRemovein classBlockBehaviour
-
getStateForPlacement
- Overrides:
getStateForPlacementin classBlock
-
getShapeProperty
Deprecated.Forge: UsegetRailDirection(BlockState, BlockGetter, BlockPos, net.minecraft.world.entity.vehicle.AbstractMinecart)for enhanced ability If you do change this property be aware that other functions in this/subclasses may break as they can make assumptions about this property -
updateShape
protected BlockState updateShape(BlockState pState, Direction pDirection, BlockState pNeighborState, LevelAccessor pLevel, BlockPos pPos, BlockPos pNeighborPos) Update the provided state given the provided neighbor direction and neighbor state, returning a new state. For example, fences make their connections to the passed in state if possible, and wet concrete powder immediately returns its solidified counterpart. Note that this method should ideally consider only the specific direction passed in.- Overrides:
updateShapein classBlockBehaviour
-
getFluidState
- Overrides:
getFluidStatein classBlockBehaviour
-
isFlexibleRail
Description copied from interface:IBaseRailBlockExtensionReturn true if the rail can make corners. Used by placement logic.- Specified by:
isFlexibleRailin interfaceIBaseRailBlockExtension- Parameters:
world- The level.pos- Block's position in level- Returns:
- True if the rail can make corners.
-
getRailDirection
public RailShape getRailDirection(BlockState state, BlockGetter world, BlockPos pos, @Nullable AbstractMinecart cart) Description copied from interface:IBaseRailBlockExtensionReturn the rail's direction. Can be used to make the cart think the rail is a different shape, for example when making diamond junctions or switches. The cart parameter will often be null unless it it called from EntityMinecart.- Specified by:
getRailDirectionin interfaceIBaseRailBlockExtension- Parameters:
state- The BlockStateworld- The level.pos- Block's position in levelcart- The cart asking for the metadata, null if it is not called by EntityMinecart.- Returns:
- The direction.
-
getRailDirection(BlockState, BlockGetter, BlockPos, net.minecraft.world.entity.vehicle.AbstractMinecart)for enhanced ability If you do change this property be aware that other functions in this/subclasses may break as they can make assumptions about this property