EntityCaveSpider .java

net.minecraft.entity.monster.EntityCaveSpider (class): members: attackEntityAsMob, onInitialSpawn, getEyeHeight, applyEntityAttributes. imports: Potion.

net.minecraft.entity.monsterclass72 linescommonextends EntitySpider2.0 KB

API Surface (4)

void applyEntityAttributes()
boolean attackEntityAsMob(Entity entityIn)
IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
float getEyeHeight()

Full Source

EntityCaveSpider.java72 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.entity.monster;
2
3
import net.minecraft.entity.Entity;
4
import net.minecraft.entity.EntityLivingBase;
5
import net.minecraft.entity.IEntityLivingData;
6
import net.minecraft.entity.SharedMonsterAttributes;
7
import net.minecraft.potion.Potion;
8
import net.minecraft.potion.PotionEffect;
9
import net.minecraft.world.DifficultyInstance;
10
import net.minecraft.world.EnumDifficulty;
11
import net.minecraft.world.World;
12
13
public class EntityCaveSpider extends EntitySpider
14
{
15
    public EntityCaveSpider(World worldIn)
16
    {
17
        super(worldIn);
18
        this.setSize(0.7F, 0.5F);
19
    }
20
21
    protected void applyEntityAttributes()
22
    {
23
        super.applyEntityAttributes();
24
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(12.0D);
25
    }
26
27
    public boolean attackEntityAsMob(Entity entityIn)
28
    {
29
        if (super.attackEntityAsMob(entityIn))
30
        {
31
            if (entityIn instanceof EntityLivingBase)
32
            {
33
                int i = 0;
34
35
                if (this.worldObj.getDifficulty() == EnumDifficulty.NORMAL)
36
                {
37
                    i = 7;
38
                }
39
                else if (this.worldObj.getDifficulty() == EnumDifficulty.HARD)
40
                {
41
                    i = 15;
42
                }
43
44
                if (i > 0)
45
                {
46
                    ((EntityLivingBase)entityIn).addPotionEffect(new PotionEffect(Potion.poison.id, i * 20, 0));
47
                }
48
            }
49
50
            return true;
51
        }
52
        else
53
        {
54
            return false;
55
        }
56
    }
57
58
    /**
59
     * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
60
     * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
61
     */
62
    public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
63
    {
64
        return livingdata;
65
    }
66
67
    public float getEyeHeight()
68
    {
69
        return 0.45F;
70
    }
71
}
72

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