Jump to content

[1.7.2] LivingAttackEvent Zombies


delpi

Recommended Posts

I have been messing with this all evening and finally figured out what is up.  Hoping someone has seen this and knows a way around it.

 

I have Dodge Functionality added to one of my mods.  Noticed it wasn't working with zombies attacking the player.  After troubleshooting it, I figured out something. 

 

Zombies are ignoring the variable attacktime and basically attacking almost once a tick.  No other mob seems to be doing this that I can find.  I've looked at the zombie code and I do not see how this is happening.  Its pretty clear the limitation.

 

 

 

        if (this.attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > this.boundingBox.minY && par1Entity.boundingBox.minY < this.boundingBox.maxY)

        {

            this.attackTime = 20;

            this.attackEntityAsMob(par1Entity);

        }

 

 

 

Attack has to be called from somewhere else too, but i've looked through all the parents and i'm stumped. 

 

Anyone got an idea?

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

How can you tell they are ignoring it? Did you isolate a single zombie and print out its attack times, or were there a bunch of zombies attacking you at once? If you dodge the attack (i.e. cancel), do you set the zombie's attack time manually? I haven't looked, but I suspect their attack time might not get set if the attack event is cancelled.

Link to comment
Share on other sites

I was going to ask the same thing -- how do you really know what the attack time is doing in the zombies?  You may need to trace it either with debugger tracing or by even going through work to create an entity with copy of the code and add your own console statements or other modifications to figure it out.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I set debugg messages to print out who was being attacked by what with ID's so I could be sure.  I included the attacktime as well as several other peices of information.

 

I went to an isolated platform and only had a single zombie to test. 

 

Once a tick it would attack me and each time the attacktime would be 99.

 

The reason it is 99 is that I went ahead and when the dodge occured set the attacktime up to 100 as part of testing. Whatever I set it to, its 1 less.

 

I've searched and there is no other references to entityzombie in the mod and its the only one in the test environment.

 

I got tired last night, but I'm going to look again to see where in the minecraft cycle it is telling zombies to attack bypassing the attack check

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

I set debugg messages to print out who was being attacked by what with ID's so I could be sure.  I included the attacktime as well as several other peices of information.

 

I went to an isolated platform and only had a single zombie to test. 

 

Once a tick it would attack me and each time the attacktime would be 99.

 

The reason it is 99 is that I went ahead and when the dodge occured set the attacktime up to 100 as part of testing. Whatever I set it to, its 1 less.

 

I've searched and there is no other references to entityzombie in the mod and its the only one in the test environment.

 

I got tired last night, but I'm going to look again to see where in the minecraft cycle it is telling zombies to attack bypassing the attack check

That sounds pretty thorough; did you make sure you printed out the information on the server side?

Link to comment
Share on other sites

Yeh, server side only.  I did print on client side at one point as troubleshooting just to see if there was anything interesting, but turned it off.

 

I typically have different event handlers for the server and client so I have less suprises.

 

This one has me stuck.  I traced through minecraft code for hours and can't figure out why a zombie would be ignoring the normal rules.

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Figured it out - Sort of.

 

Zombies spam a 3.0 dmg attack that never lands no matter what.  If it has success with the 3.0 dmg attack at the 20 tick interval, it throws a 4.5 dmg attack that can land.

 

What the hell?

 

Taking this into consideration, I was able to adjust my events to handle.

 

I haven't traced back through the Zombie code to figure this one out yet.  Perhaps it has something to do with the convert villager stuff??  So tired of messing with this I don't have it in me to look for now.

 

If someone has a some insight or a better solution, please throw it out there.

Long time Bukkit & Forge Programmer

Happy to try and help

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



×
×
  • Create New...

Important Information

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