Add a cleargoals call for rabbits

This commit is contained in:
fullwall 2024-04-07 14:26:47 +08:00
parent 809ef01b5d
commit 5f13340dea
7 changed files with 7 additions and 0 deletions

View File

@ -232,6 +232,7 @@ public class RabbitController extends MobEntityController {
initPathfinder(); // make sure the evil goals include the default AI goals
}
super.setRabbitType(type);
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
} else if (NMSImpl.getRabbitTypeField() != null) {
datawatcher.set(NMSImpl.getRabbitTypeField(), type);
}

View File

@ -232,6 +232,7 @@ public class RabbitController extends MobEntityController {
initPathfinder(); // make sure the evil goals include the default AI goals
}
super.setRabbitType(type);
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
} else if (NMSImpl.getRabbitTypeField() != null) {
datawatcher.set(NMSImpl.getRabbitTypeField(), type);
}

View File

@ -232,6 +232,7 @@ public class RabbitController extends MobEntityController {
initPathfinder(); // make sure the evil goals include the default AI goals
}
super.setRabbitType(type);
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
} else if (NMSImpl.getRabbitTypeField() != null) {
datawatcher.set(NMSImpl.getRabbitTypeField(), type);
}

View File

@ -216,6 +216,7 @@ public class RabbitController extends MobEntityController {
registerGoals(); // make sure the evil goals include the default AI goals
}
super.setRabbitType(type);
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
} else if (NMSImpl.getRabbitTypeField() != null) {
entityData.set(NMSImpl.getRabbitTypeField(), type);
}

View File

@ -217,6 +217,7 @@ public class RabbitController extends MobEntityController {
registerGoals(); // make sure the evil goals include the default AI goals
}
super.setRabbitType(type);
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
} else if (NMSImpl.getRabbitTypeField() != null) {
entityData.set(NMSImpl.getRabbitTypeField(), type);
}

View File

@ -218,6 +218,7 @@ public class RabbitController extends MobEntityController {
registerGoals(); // make sure the evil goals include the default AI goals
}
super.setVariant(variant);
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
} else if (NMSImpl.getRabbitTypeField() != null) {
entityData.set(NMSImpl.getRabbitTypeField(), variant.id());
}

View File

@ -208,6 +208,7 @@ public class RabbitController extends MobEntityController {
registerGoals(); // make sure the evil goals include the default AI goals
}
super.setVariant(variant);
NMSImpl.clearGoals(npc, goalSelector, targetSelector);
} else if (NMSImpl.RABBIT_TYPE_DATAWATCHER != null) {
entityData.set(NMSImpl.RABBIT_TYPE_DATAWATCHER, variant.id());
}