EntitySmallFireball .java

net.minecraft.entity.projectile.EntitySmallFireball (class, 92 lines): members: onImpact, canBeCollidedWith, attackEntityFrom. strings: "mobGriefing".

net.minecraft.entity.projectileclass92 linescommonextends EntityFireball2.7 KB

API Surface (3)

void onImpact(MovingObjectPosition movingObject)
boolean canBeCollidedWith()
boolean attackEntityFrom(DamageSource source, float amount)

String literals (1)

"mobGriefing"

Full Source

EntitySmallFireball.java92 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity.projectile;
2
3
import net.minecraft.entity.EntityLiving;
4
import net.minecraft.entity.EntityLivingBase;
5
import net.minecraft.init.Blocks;
6
import net.minecraft.util.BlockPos;
7
import net.minecraft.util.DamageSource;
8
import net.minecraft.util.MovingObjectPosition;
9
import net.minecraft.world.World;
10
11
public class EntitySmallFireball extends EntityFireball
12
{
13
    public EntitySmallFireball(World worldIn)
14
    {
15
        super(worldIn);
16
        this.setSize(0.3125F, 0.3125F);
17
    }
18
19
    public EntitySmallFireball(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ)
20
    {
21
        super(worldIn, shooter, accelX, accelY, accelZ);
22
        this.setSize(0.3125F, 0.3125F);
23
    }
24
25
    public EntitySmallFireball(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ)
26
    {
27
        super(worldIn, x, y, z, accelX, accelY, accelZ);
28
        this.setSize(0.3125F, 0.3125F);
29
    }
30
31
    /**
32
     * Called when this EntityFireball hits a block or entity.
33
     */
34
    protected void onImpact(MovingObjectPosition movingObject)
35
    {
36
        if (!this.worldObj.isRemote)
37
        {
38
            if (movingObject.entityHit != null)
39
            {
40
                boolean flag = movingObject.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5.0F);
41
42
                if (flag)
43
                {
44
                    this.applyEnchantments(this.shootingEntity, movingObject.entityHit);
45
46
                    if (!movingObject.entityHit.isImmuneToFire())
47
                    {
48
                        movingObject.entityHit.setFire(5);
49
                    }
50
                }
51
            }
52
            else
53
            {
54
                boolean flag1 = true;
55
56
                if (this.shootingEntity != null && this.shootingEntity instanceof EntityLiving)
57
                {
58
                    flag1 = this.worldObj.getGameRules().getBoolean("mobGriefing");
59
                }
60
61
                if (flag1)
62
                {
63
                    BlockPos blockpos = movingObject.getBlockPos().offset(movingObject.sideHit);
64
65
                    if (this.worldObj.isAirBlock(blockpos))
66
                    {
67
                        this.worldObj.setBlockState(blockpos, Blocks.fire.getDefaultState());
68
                    }
69
                }
70
            }
71
72
            this.setDead();
73
        }
74
    }
75
76
    /**
77
     * Returns true if other Entities should be prevented from moving through this Entity.
78
     */
79
    public boolean canBeCollidedWith()
80
    {
81
        return false;
82
    }
83
84
    /**
85
     * Called when the entity is attacked.
86
     */
87
    public boolean attackEntityFrom(DamageSource source, float amount)
88
    {
89
        return false;
90
    }
91
}
92

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