BlockSign .java

net.minecraft.block.BlockSign (class): members: canSpawnInBlock, getSelectedBoundingBox, isPassable, createNewTileEntity, canPlaceBlockAt, getItem.

net.minecraft.blockclass103 linescommonextends BlockContainer2.7 KB

API Surface (11)

AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos)
boolean isFullCube()
boolean isPassable(IBlockAccess worldIn, BlockPos pos)
boolean isOpaqueCube()
boolean canSpawnInBlock()
TileEntity createNewTileEntity(World worldIn, int meta)
Item getItemDropped(IBlockState state, Random rand, int fortune)
Item getItem(World worldIn, BlockPos pos)
boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
boolean canPlaceBlockAt(World worldIn, BlockPos pos)

Full Source

BlockSign.java103 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.Random;
4
import net.minecraft.block.material.Material;
5
import net.minecraft.block.state.IBlockState;
6
import net.minecraft.entity.player.EntityPlayer;
7
import net.minecraft.init.Items;
8
import net.minecraft.item.Item;
9
import net.minecraft.tileentity.TileEntity;
10
import net.minecraft.tileentity.TileEntitySign;
11
import net.minecraft.util.AxisAlignedBB;
12
import net.minecraft.util.BlockPos;
13
import net.minecraft.util.EnumFacing;
14
import net.minecraft.world.IBlockAccess;
15
import net.minecraft.world.World;
16
17
public class BlockSign extends BlockContainer
18
{
19
    protected BlockSign()
20
    {
21
        super(Material.wood);
22
        float f = 0.25F;
23
        float f1 = 1.0F;
24
        this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
25
    }
26
27
    public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
28
    {
29
        return null;
30
    }
31
32
    public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos)
33
    {
34
        this.setBlockBoundsBasedOnState(worldIn, pos);
35
        return super.getSelectedBoundingBox(worldIn, pos);
36
    }
37
38
    public boolean isFullCube()
39
    {
40
        return false;
41
    }
42
43
    public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
44
    {
45
        return true;
46
    }
47
48
    /**
49
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
50
     */
51
    public boolean isOpaqueCube()
52
    {
53
        return false;
54
    }
55
56
    /**
57
     * Return true if an entity can be spawned inside the block (used to get the player's bed spawn location)
58
     */
59
    public boolean canSpawnInBlock()
60
    {
61
        return true;
62
    }
63
64
    /**
65
     * Returns a new instance of a block's tile entity class. Called on placing the block.
66
     */
67
    public TileEntity createNewTileEntity(World worldIn, int meta)
68
    {
69
        return new TileEntitySign();
70
    }
71
72
    /**
73
     * Get the Item that this Block should drop when harvested.
74
     */
75
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
76
    {
77
        return Items.sign;
78
    }
79
80
    public Item getItem(World worldIn, BlockPos pos)
81
    {
82
        return Items.sign;
83
    }
84
85
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
86
    {
87
        if (worldIn.isRemote)
88
        {
89
            return true;
90
        }
91
        else
92
        {
93
            TileEntity tileentity = worldIn.getTileEntity(pos);
94
            return tileentity instanceof TileEntitySign ? ((TileEntitySign)tileentity).executeCommand(playerIn) : false;
95
        }
96
    }
97
98
    public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
99
    {
100
        return !this.hasInvalidNeighbor(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos);
101
    }
102
}
103

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