Jump to content

[1.8] [1.7.10] Implementing Guardians | onLivingUpdate() failure


naitdog15

Recommended Posts

I'm still heavy into to the 1.7.10 code, with my modpack design and majority of the mods still staying there.

 

I decided to incorporate some 1.8 elements into 1.7.10. Guardians included and the ones that became the most difficult.

 

I've so far been copying and pasting pieces of 1.8 code across to 1.7.10. Downgrading where necessary and using 'extenders' for additional code.

I'd successfully made the model and render, however, the AI system just simply doesn't work and the mob just says in one spot.

 

Just looking for assistance with trying to work the ai system of the guardian, since its so unique and different to other modded mobs. If you can spot the problem please let me know. I managed to narrow down the problem to the onLivingUpdate() algorithm.

 

(the EntityGuardian.class onLivingUpdate() code below)

 

 public void onLivingUpdate()
    {
   
        if (this.worldObj.isRemote)
        {
            this.field_175484_c = this.field_175482_b;

           if (!this.isInWater())
            {
                this.field_175483_bk = 2.0F;

                if (this.motionY > 0.0D && this.field_175480_bp)

                {
                    this.worldObj.playSound(this.posX, this.posY, this.posZ, "TemogAesthetics:flop", 1.0F, 1.0F, false);
                }
                
              
                this.field_175480_bp = this.motionY < 0.0D;

            }
            else if (this.func_175472_n())
            {
                if (this.field_175483_bk < 0.5F)
                {
                    this.field_175483_bk = 4.0F;
                }
                else
                {
                    this.field_175483_bk += (0.5F - this.field_175483_bk) * 0.1F;
                }
            }
            else
            {
                this.field_175483_bk += (0.125F - this.field_175483_bk) * 0.2F;
            }

           this.field_175482_b += this.field_175483_bk;
           this.field_175486_bm = this.field_175485_bl;

            if (!this.isInWater())
            {
                this.field_175485_bl = this.rand.nextFloat();
            }
            else if (this.func_175472_n())
            {
                this.field_175485_bl += (0.0F - this.field_175485_bl) * 0.25F;
            }
            else
            {
                this.field_175485_bl += (1.0F - this.field_175485_bl) * 0.06F;
            }

            if (this.func_175472_n() && this.isInWater())
            {
                Vec3 vec3 = this.getLook(0.0F);

                for (int i = 0; i < 2; ++i)
                {
                	this.worldObj.spawnParticle("bubble", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width - vec3.xCoord * 1.5D, this.posY + this.rand.nextDouble() * (double)this.height - vec3.yCoord * 1.5D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width - vec3.zCoord * 1.5D, 0.0D, 0.0D, 0.0D);
                }
            }

           if (this.hasTargetedEntity())
            {
                if (this.field_175479_bo < this.func_175464_ck())
                {
                    ++this.field_175479_bo;
                }

                EntityLivingBase entitylivingbase = this.getTargetedEntity();

                if (entitylivingbase != null)
                {
                    this.getLookHelper().setLookPositionWithEntity(entitylivingbase, 90.0F, 90.0F);
                    this.getLookHelper().onUpdateLook();
                    double d5 = (double)this.func_175477_p(0.0F);
                    double d0 = entitylivingbase.posX - this.posX;
                    double d1 = entitylivingbase.posY + (double)(entitylivingbase.height * 0.5F) - (this.posY + (double)this.getEyeHeight());
                    double d2 = entitylivingbase.posZ - this.posZ;
                    double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
                    d0 = d0 / d3;
                    d1 = d1 / d3;
                    d2 = d2 / d3;
                    double d4 = this.rand.nextDouble();

                    while (d4 < d3)
                    {
                        d4 += 1.8D - d5 + this.rand.nextDouble() * (1.7D - d5);
                        this.worldObj.spawnParticle("bubble", this.posX + d0 * d4, this.posY + d1 * d4 + (double)this.getEyeHeight(), this.posZ + d2 * d4, 0.0D, 0.0D, 0.0D);
                    }
                }
    		}
	}

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Discovering that a trusted colleague had accessed my Bitcoin account and transferred $30,000 worth of bitcoins was a devastating blow. It shattered the trust I had placed in them and left me feeling vulnerable and betrayed. However, in the face of adversity, I turned to MUYERN TRUST HACKER for assistance in reclaiming control over my finances and holding the perpetrators accountable for their actions. One of the standout features of MUYERN TRUST HACKER was its ability to provide real-time alerts and notifications, keeping me informed every step of the way. With the support of MUYERN TRUST HACKER, I was able to gather irrefutable evidence of the perpetrator's actions and hold them accountable for their crimes. Armed with the information provided by the platform, I pursued legal recourse and ensured that justice was served. The perpetrator faced severe consequences for their actions, including legal penalties and financial restitution. Beyond its role in facilitating the recovery process, MUYERN TRUST HACKER provided me with a sense of empowerment and resilience in the face of adversity. While the experience was undoubtedly challenging, it ultimately served as a testament to the importance of vigilance and the power of technology in safeguarding our digital assets. Thanks to MUYERN TRUST HACKER, I emerged stronger and more resilient, ready to face whatever challenges the future may hold. Mail; muyerntrusted[At] mail-me .c o m
    • Discovering that a trusted colleague had accessed my Bitcoin account and transferred $30,000 worth of bitcoins was a devastating blow. It shattered the trust I had placed in them and left me feeling vulnerable and betrayed. However, in the face of adversity, I turned to MUYERN TRUST HACKER web [ ht tps:// muyerntrusthack.solutions/ ] for assistance in reclaiming control over my finances and holding the perpetrators accountable for their actions. One of the standout features of MUYERN TRUST HACKER was its ability to provide real-time alerts and notifications, keeping me informed every step of the way. With the support of MUYERN TRUST HACKER, I was able to gather irrefutable evidence of the perpetrator's actions and hold them accountable for their crimes. Armed with the information provided by the platform, I pursued legal recourse and ensured that justice was served. The perpetrator faced severe consequences for their actions, including legal penalties and financial restitution. Beyond its role in facilitating the recovery process, MUYERN TRUST HACKER provided me with a sense of empowerment and resilience in the face of adversity. While the experience was undoubtedly challenging, it ultimately served as a testament to the importance of vigilance and the power of technology in safeguarding our digital assets. Thanks to MUYERN TRUST HACKER, I emerged stronger and more resilient, ready to face whatever challenges the future may hold. Mail; muyerntrusted[At] mail-me .c o m  
    • Do you have still this problem? (I have it too so I want to know if you did something with it)  
    • Thank you very much, the mod worked. I almost destroyed my computer out of anger because I couldn't find the error.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.