EntitySnowball .java

net.minecraft.entity.projectile.EntitySnowball (class, 55 lines): members: onImpact. imports: EntityBlaze, MovingObjectPosition, DamageSource, World.

net.minecraft.entity.projectileclass55 linescommonextends EntityThrowable1.4 KB

API Surface (1)

void onImpact(MovingObjectPosition p_70184_1_)

Full Source

EntitySnowball.java55 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity.projectile;
2
3
import net.minecraft.entity.EntityLivingBase;
4
import net.minecraft.entity.monster.EntityBlaze;
5
import net.minecraft.util.DamageSource;
6
import net.minecraft.util.EnumParticleTypes;
7
import net.minecraft.util.MovingObjectPosition;
8
import net.minecraft.world.World;
9
10
public class EntitySnowball extends EntityThrowable
11
{
12
    public EntitySnowball(World worldIn)
13
    {
14
        super(worldIn);
15
    }
16
17
    public EntitySnowball(World worldIn, EntityLivingBase throwerIn)
18
    {
19
        super(worldIn, throwerIn);
20
    }
21
22
    public EntitySnowball(World worldIn, double x, double y, double z)
23
    {
24
        super(worldIn, x, y, z);
25
    }
26
27
    /**
28
     * Called when this EntityThrowable hits a block or entity.
29
     */
30
    protected void onImpact(MovingObjectPosition p_70184_1_)
31
    {
32
        if (p_70184_1_.entityHit != null)
33
        {
34
            int i = 0;
35
36
            if (p_70184_1_.entityHit instanceof EntityBlaze)
37
            {
38
                i = 3;
39
            }
40
41
            p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i);
42
        }
43
44
        for (int j = 0; j < 8; ++j)
45
        {
46
            this.worldObj.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
47
        }
48
49
        if (!this.worldObj.isRemote)
50
        {
51
            this.setDead();
52
        }
53
    }
54
}
55

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