Java 类net.minecraft.entity.passive.HorseType 实例源码

项目:CustomWorldGen    文件:EntityAISkeletonRiders.java   
/**
 * Updates the task
 */
public void updateTask()
{
    DifficultyInstance difficultyinstance = this.horse.worldObj.getDifficultyForLocation(new BlockPos(this.horse));
    this.horse.setSkeletonTrap(false);
    this.horse.setType(HorseType.SKELETON);
    this.horse.setHorseTamed(true);
    this.horse.setGrowingAge(0);
    this.horse.worldObj.addWeatherEffect(new EntityLightningBolt(this.horse.worldObj, this.horse.posX, this.horse.posY, this.horse.posZ, true));
    EntitySkeleton entityskeleton = this.createSkeleton(difficultyinstance, this.horse);
    entityskeleton.startRiding(this.horse);

    for (int i = 0; i < 3; ++i)
    {
        EntityHorse entityhorse = this.createHorse(difficultyinstance);
        EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, entityhorse);
        entityskeleton1.startRiding(entityhorse);
        entityhorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
    }
}
项目:CustomWorldGen    文件:RenderHorse.java   
/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
    float f = 1.0F;
    HorseType horsetype = entitylivingbaseIn.getType();

    if (horsetype == HorseType.DONKEY)
    {
        f *= 0.87F;
    }
    else if (horsetype == HorseType.MULE)
    {
        f *= 0.92F;
    }

    GlStateManager.scale(f, f, f);
    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
项目:equidcraft    文件:EntityHorseCustom.java   
public boolean canMateWith(EntityAnimal otherAnimal)
{
    if (otherAnimal == this)
    {
        return false;
    }
    else if (otherAnimal.getClass() != this.getClass())
    {
        return false;
    }
    else
    {
        EntityHorseCustom entityhorse = (EntityHorseCustom) otherAnimal;

        if (this.canMate() && entityhorse.canMate())
        {
            HorseType horsetype = this.getType();
            HorseType horsetype1 = entityhorse.getType();
            return this.isMale() != entityhorse.isMale() && !this.isSterile() && !entityhorse.isSterile() && (horsetype == horsetype1 || horsetype == HorseType.HORSE && horsetype1 == HorseType.DONKEY || horsetype == HorseType.DONKEY && horsetype1 == HorseType.HORSE);
        }
        else
        {
            return false;
        }
    }
}
项目:ExpandedRailsMod    文件:EntityAISkeletonRiders.java   
/**
 * Updates the task
 */
public void updateTask()
{
    DifficultyInstance difficultyinstance = this.horse.worldObj.getDifficultyForLocation(new BlockPos(this.horse));
    this.horse.setSkeletonTrap(false);
    this.horse.setType(HorseType.SKELETON);
    this.horse.setHorseTamed(true);
    this.horse.setGrowingAge(0);
    this.horse.worldObj.addWeatherEffect(new EntityLightningBolt(this.horse.worldObj, this.horse.posX, this.horse.posY, this.horse.posZ, true));
    EntitySkeleton entityskeleton = this.createSkeleton(difficultyinstance, this.horse);
    entityskeleton.startRiding(this.horse);

    for (int i = 0; i < 3; ++i)
    {
        EntityHorse entityhorse = this.createHorse(difficultyinstance);
        EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, entityhorse);
        entityskeleton1.startRiding(entityhorse);
        entityhorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
    }
}
项目:ExpandedRailsMod    文件:RenderHorse.java   
/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
    float f = 1.0F;
    HorseType horsetype = entitylivingbaseIn.getType();

    if (horsetype == HorseType.DONKEY)
    {
        f *= 0.87F;
    }
    else if (horsetype == HorseType.MULE)
    {
        f *= 0.92F;
    }

    GlStateManager.scale(f, f, f);
    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
项目:CustomWorldGen    文件:EntityAISkeletonRiders.java   
private EntityHorse createHorse(DifficultyInstance p_188515_1_)
{
    EntityHorse entityhorse = new EntityHorse(this.horse.worldObj);
    entityhorse.onInitialSpawn(p_188515_1_, (IEntityLivingData)null);
    entityhorse.setPosition(this.horse.posX, this.horse.posY, this.horse.posZ);
    entityhorse.hurtResistantTime = 60;
    entityhorse.enablePersistence();
    entityhorse.setType(HorseType.SKELETON);
    entityhorse.setHorseTamed(true);
    entityhorse.setGrowingAge(0);
    entityhorse.worldObj.spawnEntityInWorld(entityhorse);
    return entityhorse;
}
项目:ExpandedRailsMod    文件:EntityAISkeletonRiders.java   
private EntityHorse createHorse(DifficultyInstance p_188515_1_)
{
    EntityHorse entityhorse = new EntityHorse(this.horse.worldObj);
    entityhorse.onInitialSpawn(p_188515_1_, (IEntityLivingData)null);
    entityhorse.setPosition(this.horse.posX, this.horse.posY, this.horse.posZ);
    entityhorse.hurtResistantTime = 60;
    entityhorse.enablePersistence();
    entityhorse.setType(HorseType.SKELETON);
    entityhorse.setHorseTamed(true);
    entityhorse.setGrowingAge(0);
    entityhorse.worldObj.spawnEntityInWorld(entityhorse);
    return entityhorse;
}
项目:equidcraft    文件:EntityHorseCustom.java   
@Override
public EntityAgeable createChild(EntityAgeable ageable)
{
    EntityHorseCustom entityhorse = (EntityHorseCustom)ageable;
    EntityHorseCustom entityhorse1 = new EntityHorseCustom(this.worldObj);
    HorseType horsetype = this.getType();
    HorseType horsetype1 = entityhorse.getType();
    HorseType horsetype2 = HorseType.HORSE;

    if (horsetype == horsetype1)
    {
        horsetype2 = horsetype;
    }
    else if (horsetype == HorseType.HORSE && horsetype1 == HorseType.DONKEY || horsetype == HorseType.DONKEY && horsetype1 == HorseType.HORSE)
    {
        horsetype2 = HorseType.MULE;
    }

    if (horsetype2 == HorseType.HORSE)
    {
        int j = this.rand.nextInt(9);
        int i;

        if (j < 4)
        {
            i = this.getHorseVariant() & 255;
        }
        else if (j < 8)
        {
            i = entityhorse.getHorseVariant() & 255;
        }
        else
        {
            i = this.rand.nextInt(7);
        }

        int k = this.rand.nextInt(5);

        if (k < 2)
        {
            i = i | this.getHorseVariant() & 65280;
        }
        else if (k < 4)
        {
            i = i | entityhorse.getHorseVariant() & 65280;
        }
        else
        {
            i = i | this.rand.nextInt(5) << 8 & 65280;
        }

        entityhorse1.setHorseVariant(i);
    }

    entityhorse1.setType(horsetype2);
    if(horsetype2.equals(HorseType.MULE))
        entityhorse1.dataManager.set(IS_STERILE, true);
    double d1 = this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getBaseValue() + ageable.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getBaseValue() + (double)this.getModifiedMaxHealth();
    entityhorse1.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(d1 / 3.0D);
    double d2 = this.getEntityAttribute(JUMP_STRENGTH).getBaseValue() + ageable.getEntityAttribute(JUMP_STRENGTH).getBaseValue() + this.getModifiedJumpStrength();
    entityhorse1.getEntityAttribute(JUMP_STRENGTH).setBaseValue(d2 / 3.0D);
    double d0 = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getBaseValue() + ageable.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getBaseValue() + this.getModifiedMovementSpeed();
    entityhorse1.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(d0 / 3.0D);
    return entityhorse1;
}