Jump to content

[Solved] Anybody workaround the confirmed bug where mobs don't go through doors?


Recommended Posts

Posted (edited)

My next thing to learn/do is to see if I can alter mobs ability to break doors.  immediately I find a horrible Mojang bug that I can't believe stayed out there for 3 releases:

https://bugs.mojang.com/browse/MC-102896

 

Sure enough between 1.9 and right now, 1.12.x, mobs will not go through doors to pursue the player.  And that also means they won't break them either.  In 1.13 it is fixed.  Not that that helps me now.

One thing I am struggling with is understanding why it's not working.  I have determined this:

 

1) EntityAIBreakDoors:shouldExecute always returns false (I was able to add this task to all zombies not just the 5%).  It returns false each time because of a check in its parent:

EntityAIDoorInteract.shouldExecute():

if (!this.entity.collidedHorizontally)
{
    return false;
}

This very important variable, collidedHorizontally, used all over the place is FALSE every time this executes.  And what I find even more interesting is how another child AI of EntityAIDoorInteract, EntityAIOpenDoor works!!  That is used by the villages to open and close doors.  That same super.shouldExecute() check comes back TRUE for them and the AI works.

Also, blowing my mind even more is if I spawn a villager in a building and spawn zombies outside, they have no trouble at all pathfinding through the door and killing the villager!  NOTE, they still won't break closed doors though (for that AI collideHorizontal is still false)

Lastly, when I am in creative mode and I let zombies walk around, they do seem to move through doors occasionally.

 

So I don't get it.  I started diving into move code, collisonBox code, path finding code.  My head hurts.  I know Forge has some event handlers that I'd like to use if I could.  Most encouraging is GetCollisonBoxesEvent.  But how can I use them if I don't understand what Mojang did wrong that broke this in the first place?

 

Edited by MrChoke
Posted

UPDATE:  If anybody cares, I found root cause and fixed this Mojang bug.  Yes, I know its fixed in 1.13 but I wanted to see if I can fix it anyway.  It turns out its not a bug in ray tracing (the logic for what a mob can see), or path find, or the AI.  It was a bug in the door blocks themselves.  The blockstate's "open" property for the upper blocks of the doors was never being updated.  It stayed "false" even when the lower block was "true".  Most of the code that uses doors only look at the lower block but the path finding logic does not.  When a mob is 2 blocks high both blocks have to be clear.  The upper block was coming back as "DOOR_CLOSED" and the AI never went through.  My fix is to set the block state of the upper block whenever the lower block was changed.  It seems to only be needed in two places.

 

 

  • Thanks 1

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.