BlockLilyPad .java

net.minecraft.block.BlockLilyPad (class): members: getBlockColor, canPlaceBlockOn, getRenderColor, canBlockStay, addCollisionBoxesToList, colorMultiplier.

net.minecraft.blockclass85 linescommonextends BlockBush2.5 KB

API Surface (8)

void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
int getBlockColor()
int getRenderColor(IBlockState state)
int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
boolean canPlaceBlockOn(Block ground)
boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
int getMetaFromState(IBlockState state)

Full Source

BlockLilyPad.java85 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.block;
2
3
import java.util.List;
4
import net.minecraft.block.material.Material;
5
import net.minecraft.block.state.IBlockState;
6
import net.minecraft.creativetab.CreativeTabs;
7
import net.minecraft.entity.Entity;
8
import net.minecraft.entity.item.EntityBoat;
9
import net.minecraft.init.Blocks;
10
import net.minecraft.util.AxisAlignedBB;
11
import net.minecraft.util.BlockPos;
12
import net.minecraft.world.IBlockAccess;
13
import net.minecraft.world.World;
14
15
public class BlockLilyPad extends BlockBush
16
{
17
    protected BlockLilyPad()
18
    {
19
        float f = 0.5F;
20
        float f1 = 0.015625F;
21
        this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
22
        this.setCreativeTab(CreativeTabs.tabDecorations);
23
    }
24
25
    /**
26
     * Add all collision boxes of this Block to the list that intersect with the given mask.
27
     */
28
    public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
29
    {
30
        if (collidingEntity == null || !(collidingEntity instanceof EntityBoat))
31
        {
32
            super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
33
        }
34
    }
35
36
    public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
37
    {
38
        return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
39
    }
40
41
    public int getBlockColor()
42
    {
43
        return 7455580;
44
    }
45
46
    public int getRenderColor(IBlockState state)
47
    {
48
        return 7455580;
49
    }
50
51
    public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
52
    {
53
        return 2129968;
54
    }
55
56
    /**
57
     * is the block grass, dirt or farmland
58
     */
59
    protected boolean canPlaceBlockOn(Block ground)
60
    {
61
        return ground == Blocks.water;
62
    }
63
64
    public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
65
    {
66
        if (pos.getY() >= 0 && pos.getY() < 256)
67
        {
68
            IBlockState iblockstate = worldIn.getBlockState(pos.down());
69
            return iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0;
70
        }
71
        else
72
        {
73
            return false;
74
        }
75
    }
76
77
    /**
78
     * Convert the BlockState into the correct metadata value
79
     */
80
    public int getMetaFromState(IBlockState state)
81
    {
82
        return 0;
83
    }
84
}
85

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