net.minecraft.block

## Class BlockRail

- java.lang.Object
- - net.minecraft.block.Block
  - - net.minecraft.block.BlockRail

- Direct Known Subclasses:
    BlockDetectorRail

      public class BlockRail
      extends Block

- - ### Field Summary

    - ### Fields inherited from class net.minecraft.block.Block

      `anvil, beacon, bed, bedrock, blockClay, blockDiamond, blockEmerald, blockGold, blockID, blockIndexInTexture, blockLapis, blockMaterial, blockParticleGravity, blocksList, blockSnow, blockSteel, bookShelf, brewingStand, brick, cactus, cake, canBlockGrass, carrot, cauldron, chest, cloth, cobblestone, cobblestoneMossy, cobblestoneWall, cocoaPlant, commandBlock, crops, deadBush, dirt, dispenser, doorSteel, doorWood, dragonEgg, enchantmentTable, enderChest, endPortal, endPortalFrame, fence, fenceGate, fenceIron, fire, flowerPot, glass, glowStone, grass, gravel, ice, isDefaultTexture, jukebox, ladder, lavaMoving, lavaStill, leaves, lever, lightOpacity, lightValue, lockedChest, melon, melonStem, mobSpawner, mushroomBrown, mushroomCapBrown, mushroomCapRed, mushroomRed, music, mycelium, netherBrick, netherFence, netherrack, netherStalk, obsidian, opaqueCubeLookup, oreCoal, oreDiamond, oreEmerald, oreGold, oreIron, oreLapis, oreRedstone, oreRedstoneGlowing, pistonBase, pistonExtension, pistonMoving, pistonStickyBase, planks, plantRed, plantYellow, portal, potato, pressurePlatePlanks, pressurePlateStone, pumpkin, pumpkinLantern, pumpkinStem, rail, railDetector, railPowered, redstoneLampActive, redstoneLampIdle, redstoneRepeaterActive, redstoneRepeaterIdle, redstoneWire, reed, requiresSelfNotify, sand, sandStone, sapling, signPost, signWall, silverfish, skull, slipperiness, slowSand, snow, soundAnvilFootstep, soundClothFootstep, soundGlassFootstep, soundGrassFootstep, soundGravelFootstep, soundLadderFootstep, soundMetalFootstep, soundPowderFootstep, soundSandFootstep, soundSnowFootstep, soundStoneFootstep, soundWoodFootstep, sponge, stairCompactCobblestone, stairCompactPlanks, stairsBrick, stairsNetherBrick, stairsSandStone, stairsStoneBrickSmooth, stairsWoodBirch, stairsWoodJungle, stairsWoodSpruce, stepSound, stone, stoneBrick, stoneButton, stoneDoubleSlab, stoneOvenActive, stoneOvenIdle, stoneSingleSlab, tallGrass, thinGlass, tilledField, tnt, torchRedstoneActive, torchRedstoneIdle, torchWood, trapdoor, tripWire, tripWireSource, useNeighborBrightness, vine, waterlily, waterMoving, waterStill, web, whiteStone, wood, woodDoubleSlab, woodenButton, woodSingleSlab, workbench`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canMakeSlopes(World world, int x, int y, int z)` Returns true if the rail can make up and down slopes.
    `boolean` | `canPlaceBlockAt(World par1World, int par2, int par3, int par4)` Checks to see if its valid to put this block at the specified coordinates.
    `MovingObjectPosition` | `collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)` Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
    `int` | `getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z)` Return the rails metadata (without the power bit if the rail uses one).
    `int` | `getBlockTextureFromSideAndMetadata(int par1, int par2)` From the specified side and block metadata retrieves the blocks texture.
    `AxisAlignedBB` | `getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)` Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been cleared to be reused)
    `int` | `getMobilityFlag()` Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility and stop pistons
    `float` | `getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z)` Returns the max speed of the rail at the specified position.
    `int` | `getRenderType()` The type of render function that is called for this block
    `boolean` | `hasPowerBit(World world, int x, int y, int z)` Return true if this rail uses the 4th bit as a power bit.
    `boolean` | `isFlexibleRail(World world, int y, int x, int z)` Return true if the rail can make corners.
    `boolean` | `isOpaqueCube()` Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
    `boolean` | `isPowered()` Returns true if the block is power related rail.
    `static boolean` | `isRailBlock(int par0)` Return true if the parameter is a blockID for a valid rail block (current is rail, powered or detector).
    `static boolean` | `isRailBlockAt(World par0World, int par1, int par2, int par3)` Returns true if the block at the coordinates of world passed is a valid rail block (current is rail, powered or detector).
    `void` | `onBlockAdded(World par1World, int par2, int par3, int par4)` Called whenever the block is added into the world.
    `void` | `onMinecartPass(World world, EntityMinecart cart, int y, int x, int z)` This function is called by any minecart that passes over this rail.
    `void` | `onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)` Lets the block know when one of its neighbor changes.
    `int` | `quantityDropped(Random par1Random)` Returns the quantity of items to drop on block destruction.
    `boolean` | `renderAsNormalBlock()` If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
    `void` | `setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)` Updates the blocks bounds based on its current state.
    `void` | `setRenderType(int value)`

    - ### Methods inherited from class net.minecraft.block.Block

      `addBlockDestroyEffects, addBlockHitEffects, addCollidingBlockToList, addCreativeItems, beginLeavesDecay, breakBlock, canBeReplacedByLeaves, canBlockStay, canCollideCheck, canConnectRedstone, canCreatureSpawn, canDragonDestroy, canDropFromExplosion, canHarvestBlock, canPlaceBlockOnSide, canPlaceTorchOnTop, canProvidePower, canRenderInPass, canSilkHarvest, canSustainLeaves, canSustainPlant, colorMultiplier, createTileEntity, damageDropped, dropBlockAsItem, dropBlockAsItemWithChance, fillWithRain, func_82505_u_, func_82506_l, getAmbientOcclusionLightValue, getBedDirection, getBedSpawnPosition, getBlockBoundsMaxX, getBlockBoundsMaxY, getBlockBoundsMaxZ, getBlockBoundsMinX, getBlockBoundsMinY, getBlockBoundsMinZ, getBlockBrightness, getBlockColor, getBlockDropped, getBlockHardness, getBlockName, getBlocksMovement, getBlockTexture, getBlockTextureFromSide, getCreativeTabToDisplayOn, getDamageValue, getEnableStats, getExplosionResistance, getExplosionResistance, getFireSpreadSpeed, getFlammability, getLightOpacity, getLightValue, getMixedBrightnessForBlock, getPickBlock, getPlayerRelativeBlockHardness, getRenderBlockPass, getRenderColor, getSelectedBoundingBoxFromPool, getSubBlocks, getTextureFile, getTickRandomly, harvestBlock, hasTileEntity, hasTileEntity, idDropped, idPicked, isAirBlock, isBeaconBase, isBed, isBedFoot, isBlockBurning, isBlockFoliage, isBlockNormalCube, isBlockReplaceable, isBlockSolid, isBlockSolidOnSide, isCollidable, isFertile, isFireSource, isFlammable, isGenMineableReplaceable, isLadder, isLeaves, isNormalCube, isProvidingStrongPower, isProvidingWeakPower, isWood, onBlockActivated, onBlockClicked, onBlockDestroyedByExplosion, onBlockDestroyedByPlayer, onBlockEventReceived, onBlockHarvested, onBlockPlaced, onBlockPlacedBy, onEntityCollidedWithBlock, onEntityWalking, onFallenUpon, onPlantGrow, onPostBlockPlaced, onSetBlockIDWithMetaData, quantityDropped, quantityDroppedWithBonus, randomDisplayTick, removeBlockByPlayer, setBedOccupied, setBlockBounds, setBlockBoundsForItemRender, setBlockName, setBlockUnbreakable, setBurnProperties, setCreativeTab, setHardness, setLightOpacity, setLightValue, setRequiresSelfNotify, setResistance, setStepSound, setTextureFile, setTickRandomly, shouldSideBeRendered, tickRate, translateBlockName, updateTick, velocityToAddToEntity`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### isRailBlockAt

          public static final boolean isRailBlockAt(World par0World,
                              int par1,
                              int par2,
                              int par3)

      Returns true if the block at the coordinates of world passed is a valid rail block (current is rail, powered or detector).

    - #### isRailBlock

          public static final boolean isRailBlock(int par0)

      Return true if the parameter is a blockID for a valid rail block (current is rail, powered or detector).

    - #### isPowered

          public boolean isPowered()

      Returns true if the block is power related rail.

    - #### getCollisionBoundingBoxFromPool

          public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World,
                                                      int par2,
                                                      int par3,
                                                      int par4)

      Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been cleared to be reused)
      Overrides:
        `getCollisionBoundingBoxFromPool` in class `Block`

    - #### isOpaqueCube

          public boolean isOpaqueCube()

      Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
      Overrides:
        `isOpaqueCube` in class `Block`

    - #### collisionRayTrace

          public MovingObjectPosition collisionRayTrace(World par1World,
                                               int par2,
                                               int par3,
                                               int par4,
                                               Vec3 par5Vec3,
                                               Vec3 par6Vec3)

      Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, x, y, z, startVec, endVec
      Overrides:
        `collisionRayTrace` in class `Block`

    - #### setBlockBoundsBasedOnState

          public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess,
                                        int par2,
                                        int par3,
                                        int par4)

      Updates the blocks bounds based on its current state. Args: world, x, y, z
      Overrides:
        `setBlockBoundsBasedOnState` in class `Block`

    - #### getBlockTextureFromSideAndMetadata

          public int getBlockTextureFromSideAndMetadata(int par1,
                                               int par2)

      From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
      Overrides:
        `getBlockTextureFromSideAndMetadata` in class `Block`

    - #### renderAsNormalBlock

          public boolean renderAsNormalBlock()

      If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
      Overrides:
        `renderAsNormalBlock` in class `Block`

    - #### getRenderType

          public int getRenderType()

      The type of render function that is called for this block
      Overrides:
        `getRenderType` in class `Block`

    - #### quantityDropped

          public int quantityDropped(Random par1Random)

      Returns the quantity of items to drop on block destruction.
      Overrides:
        `quantityDropped` in class `Block`

    - #### canPlaceBlockAt

          public boolean canPlaceBlockAt(World par1World,
                                int par2,
                                int par3,
                                int par4)

      Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
      Overrides:
        `canPlaceBlockAt` in class `Block`

    - #### onBlockAdded

          public void onBlockAdded(World par1World,
                          int par2,
                          int par3,
                          int par4)

      Called whenever the block is added into the world. Args: world, x, y, z
      Overrides:
        `onBlockAdded` in class `Block`

    - #### onNeighborBlockChange

          public void onNeighborBlockChange(World par1World,
                                   int par2,
                                   int par3,
                                   int par4,
                                   int par5)

      Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor blockID
      Overrides:
        `onNeighborBlockChange` in class `Block`

    - #### getMobilityFlag

          public int getMobilityFlag()

      Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility and stop pistons
      Overrides:
        `getMobilityFlag` in class `Block`

    - #### isFlexibleRail

          public boolean isFlexibleRail(World world,
                               int y,
                               int x,
                               int z)

      Return true if the rail can make corners. Used by placement logic.
      Parameters:
        `world` - The world.
        `x` - The rail X coordinate.
        `y` - The rail Y coordinate.
        `z` - The rail Z coordinate.
      Returns:
        True if the rail can make corners.

    - #### canMakeSlopes

          public boolean canMakeSlopes(World world,
                              int x,
                              int y,
                              int z)

      Returns true if the rail can make up and down slopes. Used by placement logic.
      Parameters:
        `world` - The world.
        `x` - The rail X coordinate.
        `y` - The rail Y coordinate.
        `z` - The rail Z coordinate.
      Returns:
        True if the rail can make slopes.

    - #### getBasicRailMetadata

          public int getBasicRailMetadata(IBlockAccess world,
                                 EntityMinecart cart,
                                 int x,
                                 int y,
                                 int z)

      Return the rails metadata (without the power bit if the rail uses one). Can be used to make the cart think the rail something other than it is, for example when making diamond junctions or switches. The cart parameter will often be null unless it it called from EntityMinecart. Valid rail metadata is defined as follows: 0x0: flat track going North-South 0x1: flat track going West-East 0x2: track ascending to the East 0x3: track ascending to the West 0x4: track ascending to the North 0x5: track ascending to the South 0x6: WestNorth corner (connecting East and South) 0x7: EastNorth corner (connecting West and South) 0x8: EastSouth corner (connecting West and North) 0x9: WestSouth corner (connecting East and North) All directions are Notch defined. In MC Beta 1.8.3 the Sun rises in the North. In MC 1.0.0 the Sun rises in the East.
      Parameters:
        `world` - The world.
        `cart` - The cart asking for the metadata, null if it is not called by EntityMinecart.
        `y` - The rail X coordinate.
        `x` - The rail Y coordinate.
        `z` - The rail Z coordinate.
      Returns:
        The metadata.

    - #### getRailMaxSpeed

          public float getRailMaxSpeed(World world,
                              EntityMinecart cart,
                              int y,
                              int x,
                              int z)

      Returns the max speed of the rail at the specified position.
      Parameters:
        `world` - The world.
        `cart` - The cart on the rail, may be null.
        `x` - The rail X coordinate.
        `y` - The rail Y coordinate.
        `z` - The rail Z coordinate.
      Returns:
        The max speed of the current rail.

    - #### onMinecartPass

          public void onMinecartPass(World world,
                            EntityMinecart cart,
                            int y,
                            int x,
                            int z)

      This function is called by any minecart that passes over this rail. It is called once per update tick that the minecart is on the rail.
      Parameters:
        `world` - The world.
        `cart` - The cart on the rail.
        `y` - The rail X coordinate.
        `x` - The rail Y coordinate.
        `z` - The rail Z coordinate.

    - #### hasPowerBit

          public boolean hasPowerBit(World world,
                            int x,
                            int y,
                            int z)

      Return true if this rail uses the 4th bit as a power bit. Avoid using this function when getBasicRailMetadata() can be used instead. The only reason to use this function is if you wish to change the rails metadata.
      Parameters:
        `world` - The world.
        `x` - The rail X coordinate.
        `y` - The rail Y coordinate.
        `z` - The rail Z coordinate.
      Returns:
        True if the 4th bit is a power bit.

    - #### setRenderType

          public void setRenderType(int value)