summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java
blob: 6431d041a1733114fc119dee26bf28c8dcb857b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package org.bukkit.craftbukkit.entity;

import net.minecraft.server.EntityZombie;

import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie;

public class CraftZombie extends CraftMonster implements Zombie {

    public CraftZombie(CraftServer server, EntityZombie entity) {
        super(server, entity);
    }

    @Override
    public EntityZombie getHandle() {
        return (EntityZombie) entity;
    }

    @Override
    public String toString() {
        return "CraftZombie";
    }

    public EntityType getType() {
        return EntityType.ZOMBIE;
    }

    public boolean isBaby() {
        return getHandle().isBaby();
    }

    public void setBaby(boolean flag) {
        getHandle().setBaby(flag);
    }

    public boolean isVillager() {
        return getHandle().isVillager();
    }

    public void setVillager(boolean flag) {
        if (flag) {
            getHandle().setVillagerType(0);
        } else {
            getHandle().clearVillagerType();
        }
    }

    @Override
    public void setVillagerProfession(Villager.Profession profession) {
        if (profession == null) {
            getHandle().clearVillagerType();
        } else {
            getHandle().setVillagerType(profession.getId());
        }
    }

    @Override
    public Villager.Profession getVillagerProfession() {
        if (!isVillager()) return null;
        return Villager.Profession.getProfession(getHandle().getVillagerType());
    }
}