Mowzie's Mobs

Mowzie's Mobs

58M Downloads

Barako (and the Barakoa) is not targeting all Skeleton variants

Yellowbross opened this issue ยท 0 comments

commented

i'm not sure if this is an intended feature or a bug, but barako and the barakoa seem to only target the regular skeleton variant instead of all skeleton variants, even though they target all zombie variants.

this was probably caused by the fact that barako. barakoa, and the ServerEventHandler are checking if the entity is an instance of the SkeletonEntity class instead of the AbstractSkeletonEntity class, which is what all skeleton variants of minecraft extend. (the reason why this issue isn't happening for zombies is due to the fact that zombies do not extend an AbstractZombieEntity class like skeletons do, instead the variants of zombies directly extend from the ZombieEntity class itself)

to reproduce:

  1. spawn barako, or any barakoa
  2. spawn any skeleton variant that is not the regular skeleton (wither skeleton, stray, etc.)
  3. notice the barakoa/barako and the skeleton are chill with each other's existence and not fighting

to fix this issue, change these lines:
in the EntityBarako, EntityBarakoa, EntityBarakoaVillager classes, change these lines:
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, SkeletonEntity.class, 0, false, false, null));
to this:
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, AbstractSkeletonEntity.class, 0, false, false, null));

in the ServerEventHandler class, change this line:
if (entity instanceof SkeletonEntity) {
to this:
if (entity instanceof AbstractSkeletonEntity) {

finally, within these classes, change the imports to import AbstractSkeletonEntity instead of SkeletonEntity:
change this line:
import net.minecraft.entity.monster.SkeletonEntity;
to this:
import net.minecraft.entity.monster.AbstractSkeletonEntity;