/// <summary>
        /// Called when a player right clicks a entity with a item.
        /// </summary>
        public override void UseItemOnEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving)
        {
            if (par2EntityLiving is EntitySheep)
            {
                EntitySheep entitysheep = (EntitySheep)par2EntityLiving;
                int         i           = BlockCloth.GetBlockFromDye(par1ItemStack.GetItemDamage());

                if (!entitysheep.GetSheared() && entitysheep.GetFleeceColor() != i)
                {
                    entitysheep.SetFleeceColor(i);
                    par1ItemStack.StackSize--;
                }
            }
        }
 protected virtual int SetWoolColorAndRender(EntitySheep par1EntitySheep, int par2, float par3)
 {
     if (par2 == 0 && !par1EntitySheep.GetSheared())
     {
         LoadTexture("/mob/sheep_fur.png");
         float f = 1.0F;
         int   i = par1EntitySheep.GetFleeceColor();
         //GL.Color3(f * EntitySheep.FleeceColorTable[i][0], f * EntitySheep.FleeceColorTable[i][1], f * EntitySheep.FleeceColorTable[i][2]);
         return(1);
     }
     else
     {
         return(-1);
     }
 }
        /// <summary>
        /// This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.
        /// </summary>
        public override EntityAnimal SpawnBabyAnimal(EntityAnimal par1EntityAnimal)
        {
            EntitySheep entitysheep  = (EntitySheep)par1EntityAnimal;
            EntitySheep entitysheep1 = new EntitySheep(WorldObj);

            if (Rand.NextBool())
            {
                entitysheep1.SetFleeceColor(GetFleeceColor());
            }
            else
            {
                entitysheep1.SetFleeceColor(entitysheep.GetFleeceColor());
            }

            return(entitysheep1);
        }
Esempio n. 4
0
 /// <summary>
 /// determines if a skeleton spawns on a spider, and if a sheep is a different color
 /// </summary>
 private static void CreatureSpecificInit(EntityLiving par0EntityLiving, World par1World, float par2, float par3, float par4)
 {
     if ((par0EntityLiving is EntitySpider) && par1World.Rand.Next(100) == 0)
     {
         EntitySkeleton entityskeleton = new EntitySkeleton(par1World);
         entityskeleton.SetLocationAndAngles(par2, par3, par4, par0EntityLiving.RotationYaw, 0.0F);
         par1World.SpawnEntityInWorld(entityskeleton);
         entityskeleton.MountEntity(par0EntityLiving);
     }
     else if (par0EntityLiving is EntitySheep)
     {
         ((EntitySheep)par0EntityLiving).SetFleeceColor(EntitySheep.GetRandomFleeceColor(par1World.Rand));
     }
     else if ((par0EntityLiving is EntityOcelot) && par1World.Rand.Next(7) == 0)
     {
         for (int i = 0; i < 2; i++)
         {
             EntityOcelot entityocelot = new EntityOcelot(par1World);
             entityocelot.SetLocationAndAngles(par2, par3, par4, par0EntityLiving.RotationYaw, 0.0F);
             entityocelot.SetGrowingAge(-24000);
             par1World.SpawnEntityInWorld(entityocelot);
         }
     }
 }
 public virtual void DoRenderSheep(EntitySheep par1EntitySheep, double par2, double par4, double par6, float par8, float par9)
 {
     base.DoRenderLiving(par1EntitySheep, par2, par4, par6, par8, par9);
 }