Ejemplo n.º 1
0
        /**
         * Used for easily adding entity-dependent animations. The second and third float params here are the same second
         * and third as in the setRotationAngles method.
         */
        public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
        {
            EntityIronGolem entityirongolem = (EntityIronGolem)entitylivingbaseIn;
            int             i = entityirongolem.getAttackTimer();

            if (i > 0)
            {
                this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - partialTickTime, 10.0F);
                this.ironGolemLeftArm.rotateAngleX  = -2.0F + 1.5F * this.func_78172_a((float)i - partialTickTime, 10.0F);
            }
            else
            {
                int j = entityirongolem.getHoldRoseTick();

                if (j > 0)
                {
                    this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a((float)j, 70.0F);
                    this.ironGolemLeftArm.rotateAngleX  = 0.0F;
                }
                else
                {
                    this.ironGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_;
                    this.ironGolemLeftArm.rotateAngleX  = (-0.2F - 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called whenever the block is added into the world. Args: world, x, y, z
        /// </summary>
        public override void OnBlockAdded(World par1World, int par2, int par3, int par4)
        {
            base.OnBlockAdded(par1World, par2, par3, par4);

            if (par1World.GetBlockId(par2, par3 - 1, par4) == Block.BlockSnow.BlockID && par1World.GetBlockId(par2, par3 - 2, par4) == Block.BlockSnow.BlockID)
            {
                if (!par1World.IsRemote)
                {
                    par1World.SetBlock(par2, par3, par4, 0);
                    par1World.SetBlock(par2, par3 - 1, par4, 0);
                    par1World.SetBlock(par2, par3 - 2, par4, 0);
                    EntitySnowman entitysnowman = new EntitySnowman(par1World);
                    entitysnowman.SetLocationAndAngles(par2 + 0.5F, par3 - 1.95F, par4 + 0.5F, 0.0F, 0.0F);
                    par1World.SpawnEntityInWorld(entitysnowman);
                    par1World.NotifyBlockChange(par2, par3, par4, 0);
                    par1World.NotifyBlockChange(par2, par3 - 1, par4, 0);
                    par1World.NotifyBlockChange(par2, par3 - 2, par4, 0);
                }

                for (int i = 0; i < 120; i++)
                {
                    par1World.SpawnParticle("snowshovel", (double)par2 + par1World.Rand.NextDouble(), (double)(par3 - 2) + par1World.Rand.NextDouble() * 2.5D, (double)par4 + par1World.Rand.NextDouble(), 0.0F, 0.0F, 0.0F);
                }
            }
            else if (par1World.GetBlockId(par2, par3 - 1, par4) == Block.BlockSteel.BlockID && par1World.GetBlockId(par2, par3 - 2, par4) == Block.BlockSteel.BlockID)
            {
                bool flag  = par1World.GetBlockId(par2 - 1, par3 - 1, par4) == Block.BlockSteel.BlockID && par1World.GetBlockId(par2 + 1, par3 - 1, par4) == Block.BlockSteel.BlockID;
                bool flag1 = par1World.GetBlockId(par2, par3 - 1, par4 - 1) == Block.BlockSteel.BlockID && par1World.GetBlockId(par2, par3 - 1, par4 + 1) == Block.BlockSteel.BlockID;

                if (flag || flag1)
                {
                    par1World.SetBlock(par2, par3, par4, 0);
                    par1World.SetBlock(par2, par3 - 1, par4, 0);
                    par1World.SetBlock(par2, par3 - 2, par4, 0);

                    if (flag)
                    {
                        par1World.SetBlock(par2 - 1, par3 - 1, par4, 0);
                        par1World.SetBlock(par2 + 1, par3 - 1, par4, 0);
                    }
                    else
                    {
                        par1World.SetBlock(par2, par3 - 1, par4 - 1, 0);
                        par1World.SetBlock(par2, par3 - 1, par4 + 1, 0);
                    }

                    EntityIronGolem entityirongolem = new EntityIronGolem(par1World);
                    entityirongolem.Func_48115_b(true);
                    entityirongolem.SetLocationAndAngles(par2 + 0.5F, par3 - 1.95F, par4 + 0.5F, 0.0F, 0.0F);
                    par1World.SpawnEntityInWorld(entityirongolem);

                    for (int j = 0; j < 120; j++)
                    {
                        par1World.SpawnParticle("snowballpoof", (double)par2 + par1World.Rand.NextDouble(), (double)(par3 - 2) + par1World.Rand.NextDouble() * 3.8999999999999999D, (double)par4 + par1World.Rand.NextDouble(), 0.0F, 0.0F, 0.0F);
                    }

                    par1World.NotifyBlockChange(par2, par3, par4, 0);
                    par1World.NotifyBlockChange(par2, par3 - 1, par4, 0);
                    par1World.NotifyBlockChange(par2, par3 - 2, par4, 0);

                    if (flag)
                    {
                        par1World.NotifyBlockChange(par2 - 1, par3 - 1, par4, 0);
                        par1World.NotifyBlockChange(par2 + 1, par3 - 1, par4, 0);
                    }
                    else
                    {
                        par1World.NotifyBlockChange(par2, par3 - 1, par4 - 1, 0);
                        par1World.NotifyBlockChange(par2, par3 - 1, par4 + 1, 0);
                    }
                }
            }
        }
 public EntityAIDefendVillage(EntityIronGolem par1EntityIronGolem) : base(par1EntityIronGolem, 16F, false, true)
 {
     Irongolem = par1EntityIronGolem;
     SetMutexBits(1);
 }
 public EntityAILookAtVillager(EntityIronGolem par1EntityIronGolem)
 {
     TheGolem = par1EntityIronGolem;
     SetMutexBits(3);
 }