BlockSlime .java

net.minecraft.block.BlockSlime (class): members: onLanded, onFallenUpon, onEntityCollidedWithBlock, getBlockLayer. imports: EnumWorldBlockLayer, MapColor.

net.minecraft.blockclass71 linescommonextends BlockBreakable2.0 KB

API Surface (4)

EnumWorldBlockLayer getBlockLayer()
void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
void onLanded(World worldIn, Entity entityIn)
void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)

Code Graph: Dependencies (8)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

BlockSlime.java71 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.creativetab.CreativeTabs;
6
import net.minecraft.entity.Entity;
7
import net.minecraft.util.BlockPos;
8
import net.minecraft.util.EnumWorldBlockLayer;
9
import net.minecraft.world.World;
10
11
public class BlockSlime extends BlockBreakable
12
{
13
    public BlockSlime()
14
    {
15
        super(Material.clay, false, MapColor.grassColor);
16
        this.setCreativeTab(CreativeTabs.tabDecorations);
17
        this.slipperiness = 0.8F;
18
    }
19
20
    public EnumWorldBlockLayer getBlockLayer()
21
    {
22
        return EnumWorldBlockLayer.TRANSLUCENT;
23
    }
24
25
    /**
26
     * Block's chance to react to a living entity falling on it.
27
     */
28
    public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
29
    {
30
        if (entityIn.isSneaking())
31
        {
32
            super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
33
        }
34
        else
35
        {
36
            entityIn.fall(fallDistance, 0.0F);
37
        }
38
    }
39
40
    /**
41
     * Called when an Entity lands on this Block. This method *must* update motionY because the entity will not do that
42
     * on its own
43
     */
44
    public void onLanded(World worldIn, Entity entityIn)
45
    {
46
        if (entityIn.isSneaking())
47
        {
48
            super.onLanded(worldIn, entityIn);
49
        }
50
        else if (entityIn.motionY < 0.0D)
51
        {
52
            entityIn.motionY = -entityIn.motionY;
53
        }
54
    }
55
56
    /**
57
     * Triggered whenever an entity collides with this block (enters into the block)
58
     */
59
    public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
60
    {
61
        if (Math.abs(entityIn.motionY) < 0.1D && !entityIn.isSneaking())
62
        {
63
            double d0 = 0.4D + Math.abs(entityIn.motionY) * 0.2D;
64
            entityIn.motionX *= d0;
65
            entityIn.motionZ *= d0;
66
        }
67
68
        super.onEntityCollidedWithBlock(worldIn, pos, entityIn);
69
    }
70
}
71

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