BlockContainer .java

net.minecraft.block.BlockContainer (class, 58 lines): members: hasInvalidNeighbor, isInvalidNeighbor, onBlockEventReceived, getRenderType, breakBlock.

net.minecraft.blockclass58 linescommonextends Block2.1 KB

Implements

API Surface (5)

boolean isInvalidNeighbor(World p_181086_1_, BlockPos p_181086_2_, EnumFacing p_181086_3_)
boolean hasInvalidNeighbor(World p_181087_1_, BlockPos p_181087_2_)
int getRenderType()
void breakBlock(World worldIn, BlockPos pos, IBlockState state)
boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)

Full Source

BlockContainer.java58 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import net.minecraft.block.material.MapColor;
4
import net.minecraft.block.material.Material;
5
import net.minecraft.block.state.IBlockState;
6
import net.minecraft.tileentity.TileEntity;
7
import net.minecraft.util.BlockPos;
8
import net.minecraft.util.EnumFacing;
9
import net.minecraft.world.World;
10
11
public abstract class BlockContainer extends Block implements ITileEntityProvider
12
{
13
    protected BlockContainer(Material materialIn)
14
    {
15
        this(materialIn, materialIn.getMaterialMapColor());
16
    }
17
18
    protected BlockContainer(Material p_i46402_1_, MapColor p_i46402_2_)
19
    {
20
        super(p_i46402_1_, p_i46402_2_);
21
        this.isBlockContainer = true;
22
    }
23
24
    protected boolean isInvalidNeighbor(World p_181086_1_, BlockPos p_181086_2_, EnumFacing p_181086_3_)
25
    {
26
        return p_181086_1_.getBlockState(p_181086_2_.offset(p_181086_3_)).getBlock().getMaterial() == Material.cactus;
27
    }
28
29
    protected boolean hasInvalidNeighbor(World p_181087_1_, BlockPos p_181087_2_)
30
    {
31
        return this.isInvalidNeighbor(p_181087_1_, p_181087_2_, EnumFacing.NORTH) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, EnumFacing.SOUTH) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, EnumFacing.WEST) || this.isInvalidNeighbor(p_181087_1_, p_181087_2_, EnumFacing.EAST);
32
    }
33
34
    /**
35
     * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render
36
     */
37
    public int getRenderType()
38
    {
39
        return -1;
40
    }
41
42
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
43
    {
44
        super.breakBlock(worldIn, pos, state);
45
        worldIn.removeTileEntity(pos);
46
    }
47
48
    /**
49
     * Called on both Client and Server when World#addBlockEvent is called
50
     */
51
    public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
52
    {
53
        super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam);
54
        TileEntity tileentity = worldIn.getTileEntity(pos);
55
        return tileentity == null ? false : tileentity.receiveClientEvent(eventID, eventParam);
56
    }
57
}
58

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