
Missing PetGoalMeleeAttack
Htgan opened this issue ยท 12 comments
Not sure if this was missed out on purpose or by accident
java.lang.ClassNotFoundException: com.dsh105.echopet.compat.nms.v1_8_R2.entity.ai.PetGoalMeleeAttack
๐ฏ
Actually if you look at here https://github.com/DSH105/EchoPet/tree/master/modules/v1_8_R2/src/main/java/com/dsh105/echopet/compat/nms/v1_8_R2/entity/ai
and compare it to the preceding module
https://github.com/DSH105/EchoPet/tree/master/modules/v1_8_R1/src/main/java/com/dsh105/echopet/compat/nms/v1_8_R1/entity/ai
you can see there are some missing.
Basically I was trying to make the pet attack whichever entity the owner attaks.
I'm not sure if this is the right way to do it but I can't test it out since the pet goal MeleeAttack is missing from 1_8_R2
@EventHandler
public void onHit(EntityDamageByEntityEvent e) {
Entity damager = e.getDamager();
if(damager instanceof Player) {
Player player = (Player) damager;
if(!getPetAPI().hasPet(player)) {
return;
}
IPet pet = getPetAPI().getPet(player);
getPetAPI().setAttackTarget(pet, (LivingEntity) e.getEntity());
getPetAPI().addGoal(pet, GoalType.ATTACK);
}
}
I suspect that I haven't done it right, because I don't understand how the pet goal works at all, also I compiled an edited version where I copy/pasted that PetGoalMeleeAttack.java from v1_8_R1 to v1_8_R2 replacing anything that says "v1_8_R1" to "v1_8_R2", I'm kinda dumb and trial and error is the main approach to every problem.
Just in case you insist on full stacktrace:
Attacking isn't implemented yet, nor has it ever been. I can add the class into the 1_8_R2 module, but it won't make a difference.
;O I was so thrilled, i was looking forward to it.
Would it be possible to make the pet attack an entity with my code? By attack I mean melee attack up close. So making the pet chase down the enemy and attack them until they die.
If it is remotely possible I'll try everything I can. If not I'll have to go with throwing projectile from the pet location.
Not really, sorry :. Pet skills were being worked on for EchoPet 3 back when development was more active, so all I can suggest is waiting for that to be completed.
My apologies that I can't really help you out much here; the v2 infrastructure isn't overly supportive of this kind of feature :(.
I didn't think the feature was in a working state before the 1.8.3 update anyway. Had you tested it out before then?
I began to do some work on this and found all the v1.8.3 NMS methods that were used in the last developed version.
I created a gist of the class here: https://gist.github.com/StevePavlin/26039419f7c4374e2fc9
If you can implement this, that would be extremely helpful.
No, I was wondering if it ever did work in previous versions. Even if it's added it may not function correctly as it wasn't really completed.
No I haven't, it seems like it was still included in the pet AI in version 1.8 R1 all I have done was scan the NMS 1.8.3 classes that were modified in the last working version of this class, and change them to the current working methods/fields. I'm sure that they will work.
What I'm asking for, is if its possible for you to implement this using the API's addGoal() method because the current build is missing this class and will not allow me to add the goal to my pets.