1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-03 21:37:28 +01:00

Do not re-wrap vanilla goals ()

There is no need to rewrap vanilla goals when they're being reregistered,
this breaks some expectations around behavior outside of general
wasting of resources.

Resolves: 
This commit is contained in:
Shane Freeder 2024-05-24 15:22:41 +01:00
parent d644dfaa27
commit e04d670f1d

View file

@ -483,7 +483,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public <T extends Mob> void addGoal(T mob, int priority, Goal<T> goal) {
+ CraftMob craftMob = (CraftMob) mob;
+ getHandle(craftMob, goal.getTypes()).addGoal(priority, new PaperCustomGoal<>(goal));
+ net.minecraft.world.entity.ai.goal.Goal mojangGoal;
+
+ if (goal instanceof PaperVanillaGoal vanillaGoal) {
+ mojangGoal = vanillaGoal.getHandle();
+ } else {
+ mojangGoal = new PaperCustomGoal<>(goal);
+ }
+
+ getHandle(craftMob, goal.getTypes()).addGoal(priority, mojangGoal);
+ }
+
+ @Override