mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 02:19:19 +00:00
remove capture world in async target finding
This commit is contained in:
@@ -52,8 +52,8 @@ public class AsyncGoalExecutor {
|
||||
if (entity == null || entity.isRemoved() || !(entity instanceof Mob mob)) {
|
||||
return;
|
||||
}
|
||||
mob.goalSelector.ctx.wake();
|
||||
mob.targetSelector.ctx.wake();
|
||||
mob.goalSelector.ctx.wake(this.world);
|
||||
mob.targetSelector.ctx.wake(this.world);
|
||||
}
|
||||
|
||||
private boolean poll(Mob mob) {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package org.dreeam.leaf.async.ai;
|
||||
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface VWaker {
|
||||
@Nullable Object wake();
|
||||
@Nullable Object wake(ServerLevel world);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.dreeam.leaf.async.ai;
|
||||
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Waker {
|
||||
@@ -16,11 +17,16 @@ public class Waker {
|
||||
return result;
|
||||
}
|
||||
|
||||
final void wake() {
|
||||
final var wake = this.wake;
|
||||
public final void cancel() {
|
||||
this.wake = null;
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
final void wake(ServerLevel world) {
|
||||
final VWaker wake = this.wake;
|
||||
if (wake != null) {
|
||||
try {
|
||||
this.result = wake.wake();
|
||||
this.result = wake.wake(world);
|
||||
} catch (Exception e) {
|
||||
AsyncGoalExecutor.LOGGER.error("Exception while wake", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user