lemurgoddess Posted April 18, 2016 Share Posted April 18, 2016 New to Forge and Modding. I am trying to create some specific mob behavior and not finding any solutions via search and wondering if someone could set me on the right path. Mob Destroys Blocks I've found some information on this topic. Suggesting that you just convert the target block to an Air block. But I'm not clear the best practice for accomplishing this. Is this done via an EventHandler, a custom AI Task or inside some "onUpdate" (or similar method) in the Entity Class. (For reference, I am using a custom Mob that extends EntityZombie) Mobs Climb Over Each Other. This behavior would ideally be that when mobs hit a wall trying to get to the player, they change their vertical position and "climb" up one another until the pile gets to the top of the wall (If you've seen the movie World War Z). Thus far I tried Override on the "collideWithNearbyEntities" method, but that doesn't seem to be getting called. My hope was that I would, on collide, just move the mob up and over the mob it collides with. Any help would be appreciated. Even just suggestion of directions I should go. As I said, I am new, so I'm not clear on what the best practice is for where to put my custom code. Cheers. Quote Link to comment Share on other sites More sharing options...
BusyBeever Posted April 18, 2016 Share Posted April 18, 2016 Destroying blocks should be a custom AI Task Quote Link to comment Share on other sites More sharing options...
Draco18s Posted April 18, 2016 Share Posted April 18, 2016 Agreed on the custom AI Task. You should poll the target block's hardness and compare to whatever tool the mob is using (if any, which includes "I want it to break as if it had an iron pickaxe") and then store the time spent breaking (look at the existing usages for getHardness to locate how vanilla/Forge calculates the time-to-break (or this section on the wiki)). When the task calculates that the block was broken, do the on-broken stuff (drop the block, replace it with air, etc.) Be sure to follow vanilla and Forge conventions so chests drop their items and so on. The series of calls are easily located using the find-references feature. 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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.