Hey, I want to modify the AI of the creeper so that it can target other entities as well. I’m considering adding a new goal to its initGoals
method. Since I’m new to this, I have a few questions. I am new to this stuff, so here are my questions:
- Can I add something to the AI code?
- If yes, I tried doing this stuff:
@Mixin(CreeperEntity.class)
public class ChangeAI extends HostileEntity {
protected ChangeAI(EntityType<? extends HostileEntity> entityType, World world) {
super(entityType, world);
}
@Inject(method = "initGoals", at = @At("TAIL"))
private void inject(){
CreeperEntity creeperEntity = (CreeperEntity)(Object)this;
targetSelector.add(3, new ActiveTargetGoal<>(creeperEntity, IronGolemEntity.class,true ));
}
}
And it gives me these errors:
1)
Caused by: java.lang.BootstrapMethodError: java.lang.RuntimeException: Mixin transformation of net.minecraft.entity.mob.CreeperEntity failed
Caused by: java.lang.RuntimeException: Mixin transformation of net.minecraft.entity.mob.CreeperEntity failed
Caused by: org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered
Caused by: org.spongepowered.asm.mixin.throwables.MixinApplyError: Mixin [templatemod.mixins.json:ChangeAI from mod template-mod] from phase [DEFAULT] in config [templatemod.mixins.json] FAILED during APPLY
Caused by: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: Invalid descriptor on templatemod.mixins.json:ChangeAI from mod template-mod->@Inject::inject()V! Expected (Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V but found ()V [INJECT_APPLY Applicator Phase -> templatemod.mixins.json:ChangeAI from mod template-mod -> Apply Injections -> -> Inject -> templatemod.mixins.json:ChangeAI from mod template-mod->@Inject::inject()V]