Java 类net.minecraft.entity.monster.ZombieType 实例源码

项目:CustomWorldGen    文件:VillagerRegistry.java   
@SuppressWarnings("deprecation")
public static void onSetProfession(EntityZombie entity, VillagerProfession prof)
{
    if (prof == null)
    {
        if (entity.getZombieType() != ZombieType.NORMAL && entity.getZombieType() != ZombieType.HUSK)
            entity.setZombieType(ZombieType.NORMAL);
        return;
    }

    int network = INSTANCE.professions.getId(prof);
    if (network == -1 || prof != INSTANCE.professions.getObjectById(network))
    {
        throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + network + " " + prof);
    }

    if (network >= 0 && network < 5) // Vanilla
    {
        if (entity.getZombieType() == null || entity.getZombieType().getId() != network + 1)
        {
            entity.setZombieType(ZombieType.getVillagerByOrdinal(network));
        }
    }
    else if (entity.getZombieType() != null)
        entity.setZombieType(ZombieType.NORMAL);
}
项目:CustomWorldGen    文件:VillagerRegistry.java   
public static void onSetProfession(EntityZombie entity, ZombieType type, int network)
{
    if (type == ZombieType.NORMAL || type == ZombieType.HUSK)
    {
        if (entity.getVillagerTypeForge() != null)
            entity.setVillagerType(null);
        return;
    }
    int realID = network - 1;
    if (type == null) //Forge type?
        realID = network * -1; // Forge encoded as -ID
    VillagerProfession prof = INSTANCE.professions.getObjectById(realID);
    if (prof == null && network != 0 || INSTANCE.professions.getId(prof) != realID)
    {
        throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + realID + " " + prof);
    }

    if (prof != entity.getVillagerTypeForge())
        entity.setVillagerType(prof);
}
项目:CustomWorldGen    文件:RenderZombie.java   
/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
protected void preRenderCallback(EntityZombie entitylivingbaseIn, float partialTickTime)
{
    if (entitylivingbaseIn.getZombieType() == ZombieType.HUSK)
    {
        float f = 1.0625F;
        GlStateManager.scale(1.0625F, 1.0625F, 1.0625F);
    }

    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
项目:CustomWorldGen    文件:RenderZombie.java   
/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(EntityZombie entity)
{
    if (entity.isVillager())
    {
        return entity.getVillagerTypeForge().getZombieSkin();
    }
    else
    {
        return entity.getZombieType() == ZombieType.HUSK ? HUSK_ZOMBIE_TEXTURES : ZOMBIE_TEXTURES;
    }
}
项目:CustomWorldGen    文件:ZombieProfToType.java   
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("Zombie".equals(compound.getString("id")) && compound.getBoolean("IsVillager"))
    {
        if (!compound.hasKey("ZombieType", 99))
        {
            ZombieType zombietype = null;

            if (compound.hasKey("VillagerProfession", 99))
            {
                try
                {
                    zombietype = ZombieType.getByOrdinal(compound.getInteger("VillagerProfession") + 1);
                }
                catch (RuntimeException var4)
                {
                    ;
                }
            }

            if (zombietype == null)
            {
                zombietype = ZombieType.getByOrdinal(RANDOM.nextInt(5) + 1);
            }

            compound.setInteger("ZombieType", zombietype.getId());
        }

        compound.removeTag("IsVillager");
    }

    return compound;
}
项目:Possessed    文件:ZombieHandler.java   
@SubscribeEvent
public void onAttackEntity(AttackEntityEvent event) {
    if (event.getTarget() instanceof EntityLivingBase) {
        EntityLivingBase target = (EntityLivingBase) event.getTarget();
        EntityPlayer player = event.getEntityPlayer();
        if (this.isActive(player)) {
            PossessivePlayer possessivePlayer = PossessHandler.get(player);
            EntityZombie possessing = (EntityZombie) possessivePlayer.getPossessing();
            if (possessing.getZombieType() == ZombieType.HUSK) {
                target.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 140));
            }
        }
    }
}
项目:ExpandedRailsMod    文件:RenderZombie.java   
/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
protected void preRenderCallback(EntityZombie entitylivingbaseIn, float partialTickTime)
{
    if (entitylivingbaseIn.func_189777_di() == ZombieType.HUSK)
    {
        float f = 1.0625F;
        GlStateManager.scale(1.0625F, 1.0625F, 1.0625F);
    }

    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
项目:ExpandedRailsMod    文件:RenderZombie.java   
/**
 * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
 */
protected ResourceLocation getEntityTexture(EntityZombie entity)
{
    if (entity.isVillager())
    {
        return entity.getVillagerTypeForge().getZombieSkin();
    }
    else
    {
        return entity.func_189777_di() == ZombieType.HUSK ? field_190086_r : ZOMBIE_TEXTURES;
    }
}