Jump to content

[1.7.10][solved] spawnEntityInWorld producing unresponsive mobs


Recommended Posts

Posted

 

  Reveal hidden contents

 

 

This code is part of a boss entity. He summons these adds and can pass his attack target to them. But the mobs summoned in this code are largely idle,  don't fight back and won't respond to passed threat. In contrast the same skeletons summoned using an egg will happily attack anything that they're told to by the boss.

 

According to the system.out i used, the constructor  for the sacrifical skeletons is run, so presumably the super [which calls EntitySkeleton] is too, yet, it's like it isn't.

 

 

Posted

Post your EntitySacrificialSkeleton code, I'm assuming it has something to do with

onSpawnWithEgg(null)

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

The problem predates the inclusion of aid.onspawnwithegg. I added that today after seeing it used in similar circumstances for vanilla code. it made no difference. the sac. skel entity has no implimentation of onspawn, anyway. also note that my skeleton, when spawned by other means, behaves correctly. it is only the version summoned by the boss code that is not working correctly.

 

the class:

 

 

  Reveal hidden contents

 

 

as you can see, theres nothing here but tweaks to code for loot and valid light checks. if it wasn't for an issue with mounted shooting and an abandoned interest in upping their dmg, the ranged attack method wouldn't even be here.

 

is there a chance this is due to an issue with an older forge? my 1.7.10 is a year old, i think.

Posted

Hm, the Forge version shouldn't affect it, no. Are you getting any interesting messages in your console log?

 

Are your skeleton aids stuck in the ground at all? I notice you don't really adjust the y position other than +1, but with the random x/z position, that may not be enough.

 

Otherwise, your spawn code looks pretty standard, especially if your entity is working as expected otherwise... I dunno, maybe show the code that calls the #wakeTheDamned method?

Posted

so, yeah. ID-10T issue.

 

the wakeTheDamned() method gives the skeletons a custom bow. the combat tasks method in EntitySkeleton only checks against Items.bow, so the aid has no ranged attack task. eliminating the appropriate line fixed everything, even if i have new stuff to deal with. :) I will most likely overwrite the combat task method to allow a check for the custom bow.

 

i was staring at it only yesterday and am kicking myself for not managing to put 2 and 2 together.

 

thanks for the troubleshooting.

Posted

Do note that in order to add AI tasks, you need to wait until after the entity has spawned in the world.  EntityLivingBase#tasks is null until then.

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.

Posted
  On 4/7/2016 at 3:14 PM, Draco18s said:

Do note that in order to add AI tasks, you need to wait until after the entity has spawned in the world.  EntityLivingBase#tasks is null until then.

 

EntityLiving#tasks

is initialised in the

EntityLiving

constructor, so you can add tasks in the constructor of your entity class (if you're spawning your own entity) or after the entity has been constructed (if you're spawning an existing entity with new AI tasks).

 

If you're dealing with entities being spawned from external code (e.g. vanilla or other mods), you can't add tasks in

EntityEvent.EntityConstructing

as it's called from the

Entity

constructor before the

EntityLiving

constructor has run. The first event fired after the

EntityLiving

constructor has run is

EntityJoinWorldEvent

, which is the earliest you can add tasks in this situation.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.