BlockRail .java

net.minecraft.block.BlockRail (class): members: onNeighborChangedInternal, getShapeProperty, SHAPE, getStateFromMeta, createBlockState, getMetaFromState.

net.minecraft.blockclass54 linescommonextends BlockRailBase1.7 KB

API Surface (5)

void onNeighborChangedInternal(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
IProperty<BlockRailBase.EnumRailDirection> getShapeProperty()
IBlockState getStateFromMeta(int meta)
int getMetaFromState(IBlockState state)
BlockState createBlockState()

Fields & Constants (1)

SHAPE

String literals (1)

"shape"

Full Source

BlockRail.java54 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import net.minecraft.block.properties.IProperty;
4
import net.minecraft.block.properties.PropertyEnum;
5
import net.minecraft.block.state.BlockState;
6
import net.minecraft.block.state.IBlockState;
7
import net.minecraft.util.BlockPos;
8
import net.minecraft.world.World;
9
10
public class BlockRail extends BlockRailBase
11
{
12
    public static final PropertyEnum<BlockRailBase.EnumRailDirection> SHAPE = PropertyEnum.<BlockRailBase.EnumRailDirection>create("shape", BlockRailBase.EnumRailDirection.class);
13
14
    protected BlockRail()
15
    {
16
        super(false);
17
        this.setDefaultState(this.blockState.getBaseState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH));
18
    }
19
20
    protected void onNeighborChangedInternal(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
21
    {
22
        if (neighborBlock.canProvidePower() && (new BlockRailBase.Rail(worldIn, pos, state)).countAdjacentRails() == 3)
23
        {
24
            this.func_176564_a(worldIn, pos, state, false);
25
        }
26
    }
27
28
    public IProperty<BlockRailBase.EnumRailDirection> getShapeProperty()
29
    {
30
        return SHAPE;
31
    }
32
33
    /**
34
     * Convert the given metadata into a BlockState for this Block
35
     */
36
    public IBlockState getStateFromMeta(int meta)
37
    {
38
        return this.getDefaultState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.byMetadata(meta));
39
    }
40
41
    /**
42
     * Convert the BlockState into the correct metadata value
43
     */
44
    public int getMetaFromState(IBlockState state)
45
    {
46
        return ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata();
47
    }
48
49
    protected BlockState createBlockState()
50
    {
51
        return new BlockState(this, new IProperty[] {SHAPE});
52
    }
53
}
54

Deobfuscated MCP 1.8.9 source of BlockRail from Marcelektro/MavenMCP-1.8.9 (net/minecraft/block/BlockRail.java), stored verbatim.