BlockStandingSign .java

net.minecraft.block.BlockStandingSign (class, 54 lines): members: ROTATION, onNeighborBlockChange, getStateFromMeta, createBlockState, getMetaFromState.

net.minecraft.blockclass54 linescommonextends BlockSign1.6 KB

API Surface (4)

void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
IBlockState getStateFromMeta(int meta)
int getMetaFromState(IBlockState state)
BlockState createBlockState()

Fields & Constants (1)

ROTATION

String literals (1)

"rotation"

Full Source

BlockStandingSign.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.PropertyInteger;
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 BlockStandingSign extends BlockSign
11
{
12
    public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15);
13
14
    public BlockStandingSign()
15
    {
16
        this.setDefaultState(this.blockState.getBaseState().withProperty(ROTATION, Integer.valueOf(0)));
17
    }
18
19
    /**
20
     * Called when a neighboring block changes.
21
     */
22
    public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
23
    {
24
        if (!worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid())
25
        {
26
            this.dropBlockAsItem(worldIn, pos, state, 0);
27
            worldIn.setBlockToAir(pos);
28
        }
29
30
        super.onNeighborBlockChange(worldIn, pos, state, neighborBlock);
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(ROTATION, Integer.valueOf(meta));
39
    }
40
41
    /**
42
     * Convert the BlockState into the correct metadata value
43
     */
44
    public int getMetaFromState(IBlockState state)
45
    {
46
        return ((Integer)state.getValue(ROTATION)).intValue();
47
    }
48
49
    protected BlockState createBlockState()
50
    {
51
        return new BlockState(this, new IProperty[] {ROTATION});
52
    }
53
}
54

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