Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.11.2] Let mobs walk through leaves - weird pathing issue
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Daeruin

[1.11.2] Let mobs walk through leaves - weird pathing issue

By Daeruin, January 14, 2018 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Daeruin    24

Daeruin

Daeruin    24

  • Diamond Finder
  • Daeruin
  • Members
  • 24
  • 401 posts
Posted January 14, 2018 (edited)

I've made it so the player, and any living entity, can move through leaf blocks. (I used the GetCollisionBoxesEvent.) However, there's an unexpected result of this. Other living entities seem to have trouble with their pathing when the get next to, or inside of, leaf blocks. They often try to jump on top of leaf blocks. When they fall through, they try to jump again, and they get stuck in a silly jumping pattern. If they manage to get entirely inside some leaf blocks, they just sit there unmoving.

 

Is there some way to fix this? How would I make it so entities don't see leaf blocks as solid obstacles? 

Edited January 19, 2018 by Daeruin
Correct Minecraft version
  • Quote

Share this post


Link to post
Share on other sites

KittenKoder    6

KittenKoder

KittenKoder    6

  • Stone Miner
  • KittenKoder
  • Members
  • 6
  • 77 posts
Posted January 15, 2018

I think you need to override the AI for it to work. 

  • Quote

Share this post


Link to post
Share on other sites

xorinzor    1

xorinzor

xorinzor    1

  • Tree Puncher
  • xorinzor
  • Members
  • 1
  • 15 posts
Posted January 15, 2018

Like Kitten said, you will need to modify their AI Pathfinding since that code still assumes leaves are a solid block and as such won't stop to reach their PathPoint until achieved (resulting in the jumping behaviour).

  • Quote

Share this post


Link to post
Share on other sites

Daeruin    24

Daeruin

Daeruin    24

  • Diamond Finder
  • Daeruin
  • Members
  • 24
  • 401 posts
Posted January 15, 2018 (edited)

I have written my own AI tasks before, but the AI tasks themselves don't do the pathfinding calculations. That stuff comes from the RandomPositionGenerator class, I think. Are you saying I need to replace the vanilla pathfinding algorithms? Wouldn't that also entail replacing every AI task that calls for an entity to move anywhere? Sounds like a pain in the butt. It makes me want to consider replacing all vanilla leaf blocks with custom ones.

Edited January 15, 2018 by Daeruin
  • Quote

Share this post


Link to post
Share on other sites

Daeruin    24

Daeruin

Daeruin    24

  • Diamond Finder
  • Daeruin
  • Members
  • 24
  • 401 posts
Posted January 17, 2018

Anyone else have an idea?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7696

diesieben07

diesieben07    7696

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7696
  • 56376 posts
Posted January 17, 2018

You will need to change the PathNodeType for leaves, which requires either a custom WalkNodeProcessor (and other NodeProcessor implementations probably) or you overwriting the leaves block overriding getAiPathNodeType.

  • Quote

Share this post


Link to post
Share on other sites

Daeruin    24

Daeruin

Daeruin    24

  • Diamond Finder
  • Daeruin
  • Members
  • 24
  • 401 posts
Posted January 18, 2018
22 hours ago, diesieben07 said:

You will need to change the PathNodeType for leaves, which requires either a custom WalkNodeProcessor (and other NodeProcessor implementations probably) or you overwriting the leaves block overriding getAiPathNodeType.

 

Thanks, I'll start looking into that. How does one provide a custom WalkNodeProcessor? I presume I would extend the class and override some methods (getPathNodeType?). Then what? Do I need to register it with Forge or something?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7696

diesieben07

diesieben07    7696

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7696
  • 56376 posts
Posted January 18, 2018
23 minutes ago, Daeruin said:

How does one provide a custom WalkNodeProcessor? I presume I would extend the class and override some methods (getPathNodeType?). Then what? Do I need to register it with Forge or something?

Yo ultimately need to change the reference to the WalkNodeProcessor instance inside the PathNavigateGround instance present on most living entities at EntityLiving::navigator. You probably need to use EntityJoinWorldEvent for that.

  • Quote

Share this post


Link to post
Share on other sites

Daeruin    24

Daeruin

Daeruin    24

  • Diamond Finder
  • Daeruin
  • Members
  • 24
  • 401 posts
Posted January 19, 2018 (edited)

Hmm, looks like EntityLiving::navigator is protected, as is the createNavigator method that sets it. That puts a damper on things. I guess that would mean using reflection to access the PathNavigateGround instance. Actually, the reference to the WalkNodeProcessor inside the PathNavigateGround instance is protected, too, so I would have to use reflection again or make my own extension of PathNavigateGround to provide my custom WalkNodeProcessor.

 

The other option you mentioned, overwriting the leaf block, would require ASM, wouldn't it?

 

It seems like another option would be to replace all leaves with a custom leaf class during world generation. 

Edited January 19, 2018 by Daeruin
  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15996 posts
Posted January 19, 2018
16 minutes ago, Daeruin said:

The other option you mentioned, overwriting the leaf block, would require ASM, wouldn't it?

No, just create your own leaf block and register it with the vanilla ID

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Daeruin    24

Daeruin

Daeruin    24

  • Diamond Finder
  • Daeruin
  • Members
  • 24
  • 401 posts
Posted January 19, 2018
1 hour ago, Draco18s said:

No, just create your own leaf block and register it with the vanilla ID

 

I played around with it for like two hours, and it wasn't working. Then I finally realized all these posts I was looking up on Google were related to 1.12. (And, coincidentally, I realized my OP title said 1.10.2 instead of 1.11.2, which is what I'm actually using. Now fixed.)

 

Other than that, I like this solution because I think I can get around the entire issue by simply overriding the getCollisionBoundingBox method in the new block I create. That would allow me to avoid using the GetCollisionBoxesEvent, and all this other rigamarole.

 

So maybe I'll wait on this feature until I finally update to 1.12. Or play around with replacing it in world gen instead.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • brok4d
      OBJ MODELS

      By brok4d · Posted 46 minutes ago

      Hello, this mod is the source, you have to get boredhttps://gitlab.com/Lycanite/LycanitesMobs
    • JayNeedsHelp
      Logger not working

      By JayNeedsHelp · Posted 1 hour ago

      So I'm currently creating a forge mod and I'm having an issue where the console stops logging after some errors. It seems to be connected to the access transformers that I'm using as before I added at's my console was working fine.   Here is my at file:  public-f net.minecraft.client.Minecraft session public net.minecraft.client.Minecraft timer public net.minecraft.client.gui.GuiScreen buttonList public net.minecraft.util.Timer tickLength public net.minecraft.network.play.client.CPacketPlayer onGround public net.minecraft.network.play.server.SPacketEntityVelocity motionX public net.minecraft.network.play.server.SPacketEntityVelocity motionY public net.minecraft.network.play.server.SPacketEntityVelocity motionZ public net.minecraft.network.play.server.SPacketExplosion motionX public net.minecraft.network.play.server.SPacketExplosion motionY public net.minecraft.network.play.server.SPacketExplosion motionZ public net.minecraft.client.renderer.entity.RenderManager renderPosX public net.minecraft.client.renderer.entity.RenderManager renderPosY public net.minecraft.client.renderer.entity.RenderManager renderPosZ   Any help is greatly appreciated thank you!
    • cadbane86140
      Minecraft: Hunger Games Game #36- Shear FIGHT!

      By cadbane86140 · Posted 2 hours ago

      Hello There! Today we are back on Hunger Games after a little break but we are finally back! In this episode we are on the good ol' map Survival Games 4 and it ACTUALLY went well for once. Also we have so many great battles on rooftops, small rooms and just out in the open! We also use shears to fight at one point and that was pretty crazy! There are so many hilarious moments in this episode that I know you guys are gonna love! I hope you all enjoy this video and if you did don't forget to like and sub for more Hunger Games in the future!  
    • Sad Whale
      Game crashes whenever I try to increase the RAM

      By Sad Whale · Posted 2 hours ago

      latest.log
    • diesieben07
      Game crashes whenever I try to increase the RAM

      By diesieben07 · Posted 3 hours ago

      In the logs folder of your game directory.
  • Topics

    • Milk_Shak3s
      1
      OBJ MODELS

      By Milk_Shak3s
      Started 16 hours ago

    • JayNeedsHelp
      0
      Logger not working

      By JayNeedsHelp
      Started 1 hour ago

    • cadbane86140
      0
      Minecraft: Hunger Games Game #36- Shear FIGHT!

      By cadbane86140
      Started 2 hours ago

    • Sad Whale
      6
      Game crashes whenever I try to increase the RAM

      By Sad Whale
      Started 4 hours ago

    • Unusualty
      0
      GUI'S and player editing

      By Unusualty
      Started 3 hours ago

  • Who's Online (See full list)

    • CptPICHU
    • rhinitis
    • Draco18s
    • xcheetoezx
    • brok4d
    • Twu
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.11.2] Let mobs walk through leaves - weird pathing issue
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community