EntityMinecartEmpty .java

net.minecraft.entity.item.EntityMinecartEmpty (class, 70 lines): members: onActivatorRailPass, getMinecartType, interactFirst. imports: Entity.

net.minecraft.entity.itemclass70 linescommonextends EntityMinecart1.8 KB

API Surface (3)

boolean interactFirst(EntityPlayer playerIn)
void onActivatorRailPass(int x, int y, int z, boolean receivingPower)
EntityMinecart.EnumMinecartType getMinecartType()

Code Graph: Dependencies (4)

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

Full Source

EntityMinecartEmpty.java70 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity.item;
2
3
import net.minecraft.entity.Entity;
4
import net.minecraft.entity.player.EntityPlayer;
5
import net.minecraft.world.World;
6
7
public class EntityMinecartEmpty extends EntityMinecart
8
{
9
    public EntityMinecartEmpty(World worldIn)
10
    {
11
        super(worldIn);
12
    }
13
14
    public EntityMinecartEmpty(World worldIn, double x, double y, double z)
15
    {
16
        super(worldIn, x, y, z);
17
    }
18
19
    /**
20
     * First layer of player interaction
21
     */
22
    public boolean interactFirst(EntityPlayer playerIn)
23
    {
24
        if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
25
        {
26
            return true;
27
        }
28
        else if (this.riddenByEntity != null && this.riddenByEntity != playerIn)
29
        {
30
            return false;
31
        }
32
        else
33
        {
34
            if (!this.worldObj.isRemote)
35
            {
36
                playerIn.mountEntity(this);
37
            }
38
39
            return true;
40
        }
41
    }
42
43
    /**
44
     * Called every tick the minecart is on an activator rail. Args: x, y, z, is the rail receiving power
45
     */
46
    public void onActivatorRailPass(int x, int y, int z, boolean receivingPower)
47
    {
48
        if (receivingPower)
49
        {
50
            if (this.riddenByEntity != null)
51
            {
52
                this.riddenByEntity.mountEntity((Entity)null);
53
            }
54
55
            if (this.getRollingAmplitude() == 0)
56
            {
57
                this.setRollingDirection(-this.getRollingDirection());
58
                this.setRollingAmplitude(10);
59
                this.setDamage(50.0F);
60
                this.setBeenAttacked();
61
            }
62
        }
63
    }
64
65
    public EntityMinecart.EnumMinecartType getMinecartType()
66
    {
67
        return EntityMinecart.EnumMinecartType.RIDEABLE;
68
    }
69
}
70

Deobfuscated MCP 1.8.9 source of EntityMinecartEmpty from Marcelektro/MavenMCP-1.8.9 (net/minecraft/entity/item/EntityMinecartEmpty.java), stored verbatim.