Started by
tntapplecraft YT
on
Topic category: Advanced modding
So basically I want to make a necromancer mob that can control undead and make them attack. If they get attacked by the player all the undead around it should attack the player afterwards. I also want the necromancer to drop it's robes, which let the player control the undead. Is there anyway to do this?
Wrote this up just for you😘 lol;
Explain more, like how control them. Control movement, etc.
just the same thing with the necromancers
Ok, something similar to this should work, I am on my phone right now so some of the methods may be incorrect.
so where do I put this code?
Since these are events, they can be in any registered class using,
Ok I did the first code for calling all undead to attack the player, but when I put the code into the necromancer damage event and edit it a little and then run client an error message pops up. I think I need to put the code into tick update, but I'm not sure. can you clarify this for me?
Post what you have
package net.mcreator.thestonesofpower.procedures;
import net.mcreator.thestonesofpower.ThestonesofpowerModElements;
@ThestonesofpowerModElements.ModElement.Tag
public class NecromancerEntityIsHurtProcedure extends ThestonesofpowerModElements.ModElement {
public NecromancerEntityIsHurtProcedure(ThestonesofpowerModElements instance) {
super(instance, 133);
}
public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
if (event.getEntity() instanceof NecromancerEntity && event.getSource().getTrueSource() instanceof LivingEntity) { List<MobEntity> mobEntities = event.getEntity().world.getEntitiesWithinAABB(MobEntity.class, event.getEntity().getBoundingBox().grow(20
0)); Iterator iterator = mobEntities.iterator(); while (iterator.hasNext()) { MobEntity mobEntity = (MobEntity) event.getEntity(); if (mobEntity.isEntityUndead()) { mobEntity.setAttackTarget((LivingEntity) event.getSource().getTrueSource()); } } } }
}
}
Don't use the code I provided with the procedure wrapper. It provides dependencies, not the event.
Instead you should create a custom element, register it, and then use the code in its entirety.
oh ok
I still get the error message that the code doesn't compile properly when i try to run client
Can you post the error?