This repository has been archived by the owner on Jun 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lithium AI fixup: use vanilla method for getClosestEntity (#470)
Fixes #467
- Loading branch information
1 parent
b1b3f8a
commit 939f275
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
patches/server/0071-lithium-AI-fixup-use-vanilla-method-for-getClosestEn.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Simon Gardling <titaniumtown@gmail.com> | ||
Date: Wed, 21 Apr 2021 14:13:14 -0400 | ||
Subject: [PATCH] lithium AI fixup: use vanilla method for getClosestEntity | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalAvoidTarget.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalAvoidTarget.java | ||
index eea1a396f06e8feaa5637ba4e589a13169f514da..804bdc1c2d759799ecf48d9fd0b9e8b23d22851e 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalAvoidTarget.java | ||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalAvoidTarget.java | ||
@@ -1,6 +1,6 @@ | ||
package net.minecraft.world.entity.ai.goal; | ||
|
||
-import me.jellysquid.mods.lithium.common.entity.tracker.nearby.NearbyEntityTracker; | ||
+// import me.jellysquid.mods.lithium.common.entity.tracker.nearby.NearbyEntityTracker; | ||
|
||
import java.util.EnumSet; | ||
import java.util.function.Predicate; | ||
@@ -27,7 +27,7 @@ public class PathfinderGoalAvoidTarget<T extends EntityLiving> extends Pathfinde | ||
protected final Predicate<EntityLiving> g; | ||
protected final Predicate<EntityLiving> h; | ||
private final PathfinderTargetCondition k; | ||
- private NearbyEntityTracker<T> tracker; // Yatopia - Port Lithium | ||
+ // private NearbyEntityTracker<T> tracker; // Yatopia - Port Lithium | ||
|
||
public PathfinderGoalAvoidTarget(EntityCreature entitycreature, Class<T> oclass, float f, double d0, double d1) { | ||
this(entitycreature, oclass, entityliving -> true, f, d0, d1, IEntitySelector.e::test); // Purpur - decompile fix | ||
@@ -44,10 +44,12 @@ public class PathfinderGoalAvoidTarget<T extends EntityLiving> extends Pathfinde | ||
this.e = entitycreature.getNavigation(); | ||
this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); | ||
this.k = (new PathfinderTargetCondition()).a((double) f).a(predicate1.and(predicate)); | ||
+ /* | ||
// Yatopia start - Port Lithium | ||
this.tracker = new NearbyEntityTracker<>(oclass, entitycreature, f); | ||
entitycreature.getListener().addListener(this.tracker); | ||
// Yatopia end | ||
+ */ | ||
} | ||
|
||
public PathfinderGoalAvoidTarget(EntityCreature entitycreature, Class<T> oclass, float f, double d0, double d1, Predicate<EntityLiving> predicate) { | ||
@@ -58,7 +60,8 @@ public class PathfinderGoalAvoidTarget<T extends EntityLiving> extends Pathfinde | ||
|
||
@Override | ||
public boolean a() { | ||
- this.b = this.tracker.getClosestEntity(this.a.getBoundingBox().grow((double) this.c, 3.0D, (double) this.c), this.k); // Yatopia - Port lithium | ||
+ // this.b = this.tracker.getClosestEntity(this.a.getBoundingBox().grow((double) this.c, 3.0D, (double) this.c), this.k); // Yatopia - Port lithium | ||
+ this.b = this.a.world.b(this.f, this.k, this.a, this.a.locX(), this.a.locY(), this.a.locZ(), this.a.getBoundingBox().grow((double) this.c, 3.0D, (double) this.c)); | ||
if (this.b == null) { | ||
return false; | ||
} else { | ||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalLookAtPlayer.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalLookAtPlayer.java | ||
index 8b41274aa388a758bd8acf9637e2a19caf744c57..c42b0032124df3ee4bc28fb6a5166e712edd1e1f 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalLookAtPlayer.java | ||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalLookAtPlayer.java | ||
@@ -1,6 +1,6 @@ | ||
package net.minecraft.world.entity.ai.goal; | ||
|
||
-import me.jellysquid.mods.lithium.common.entity.tracker.nearby.NearbyEntityTracker; | ||
+// import me.jellysquid.mods.lithium.common.entity.tracker.nearby.NearbyEntityTracker; | ||
import java.util.EnumSet; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.EntityInsentient; | ||
@@ -11,7 +11,7 @@ import net.minecraft.world.entity.player.EntityHuman; | ||
|
||
public class PathfinderGoalLookAtPlayer extends PathfinderGoal { | ||
|
||
- private NearbyEntityTracker<? extends EntityLiving> tracker; // Yatopia - Port lithium | ||
+ // private NearbyEntityTracker<? extends EntityLiving> tracker; // Yatopia - Port lithium | ||
protected final EntityInsentient a; | ||
protected Entity b; | ||
protected final float c; | ||
@@ -37,10 +37,12 @@ public class PathfinderGoalLookAtPlayer extends PathfinderGoal { | ||
} else { | ||
this.f = (new PathfinderTargetCondition()).a((double) f).b().a().d(); | ||
} | ||
+ /* | ||
// Yatopia start - Port lithium | ||
this.tracker = new NearbyEntityTracker<>(oclass, entityinsentient, f); | ||
entityinsentient.getListener().addListener(this.tracker); | ||
// Yatopia end | ||
+ */ | ||
} | ||
|
||
@Override | ||
@@ -53,9 +55,11 @@ public class PathfinderGoalLookAtPlayer extends PathfinderGoal { | ||
} | ||
|
||
if (this.e == EntityHuman.class) { | ||
- this.b = this.tracker.getClosestEntity(null, this.f); // Yatopia - Port lithium | ||
+ // this.b = this.tracker.getClosestEntity(null, this.f); // Yatopia - Port lithium | ||
+ this.b = this.a.world.a(this.f, this.a, this.a.locX(), this.a.getHeadY(), this.a.locZ()); | ||
} else { | ||
- this.b = this.tracker.getClosestEntity(this.a.getBoundingBox().grow((double) this.c, 3.0D, (double) this.c), this.f); // Yatopia - Port lithium | ||
+ // this.b = this.tracker.getClosestEntity(this.a.getBoundingBox().grow((double) this.c, 3.0D, (double) this.c), this.f); // Yatopia - Port lithium | ||
+ this.b = this.a.world.b(this.e, this.f, this.a, this.a.locX(), this.a.getHeadY(), this.a.locZ(), this.a.getBoundingBox().grow((double) this.c, 3.0D, (double) this.c)); | ||
} | ||
|
||
return this.b != null; |