From 8719f42d28a2a523f58af879ff77d7a6566ec72e Mon Sep 17 00:00:00 2001 From: TheBv Date: Mon, 16 Oct 2023 21:36:29 +0200 Subject: [PATCH] fix: fixed certain entities not moving --- .../iceandfire/entity/EntityAmphithere.java | 5 ----- .../alexthe666/iceandfire/entity/EntityCyclops.java | 6 ------ .../iceandfire/entity/EntityDeathWorm.java | 10 ---------- .../iceandfire/entity/EntityDragonBase.java | 11 ----------- .../iceandfire/entity/EntityHippocampus.java | 10 ---------- .../iceandfire/entity/EntityHippogryph.java | 10 ---------- .../alexthe666/iceandfire/entity/ai/AiDebug.java | 3 ++- .../iceandfire/pathfinding/PathNavigateCyclops.java | 4 ++-- .../pathfinding/PathNavigateDeathWormLand.java | 7 ++++++- .../pathfinding/PathNavigateDeathWormSand.java | 12 ++---------- 10 files changed, 12 insertions(+), 66 deletions(-) diff --git a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityAmphithere.java b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityAmphithere.java index 10c8c0d69..9c121876c 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityAmphithere.java +++ b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityAmphithere.java @@ -988,11 +988,6 @@ public boolean removeWhenFarAway(double distanceToClosestPlayer) { return false; } - @Override - public boolean isControlledByLocalInstance() { - return false; - } - @Override public double getFlightSpeedModifier() { return 0.555D; diff --git a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityCyclops.java b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityCyclops.java index d864b8400..7c4595bfb 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityCyclops.java +++ b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityCyclops.java @@ -252,11 +252,6 @@ public void travel(@NotNull Vec3 vec) { super.travel(vec); } - @Override - public boolean isControlledByLocalInstance() { - return false; - } - @Override public boolean isPushable() { return false; @@ -267,7 +262,6 @@ public boolean shouldRiderSit() { return false; } - @Override public void aiStep() { super.aiStep(); diff --git a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDeathWorm.java b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDeathWorm.java index bab0347b0..97f266377 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDeathWorm.java +++ b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDeathWorm.java @@ -799,16 +799,6 @@ public int getMaxHeadYRot() { return 10; } - @Override - public boolean isControlledByLocalInstance() { - return false; - } - - @Override - public void travel(@NotNull Vec3 vec) { - super.travel(vec); - } - @Override public boolean shouldAnimalsFear(Entity entity) { return true; diff --git a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDragonBase.java b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDragonBase.java index cbfbff684..c04afc3b2 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDragonBase.java +++ b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityDragonBase.java @@ -1975,17 +1975,6 @@ public float getDistanceSquared(Vec3 Vector3d) { public abstract Item getVariantEgg(int variant); public abstract Item getSummoningCrystal(); - - @Override - public boolean isControlledByLocalInstance() { - return super.isControlledByLocalInstance(); - } - -/* @Override - public boolean canBeControlledByRider() { - return true; - }*/ - @Override public boolean isImmobile() { return this.getHealth() <= 0.0F || isOrderedToSit() && !this.isVehicle() || this.isModelDead() || this.isPassenger(); diff --git a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityHippocampus.java b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityHippocampus.java index a662f9f7f..fe0b6985c 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityHippocampus.java +++ b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityHippocampus.java @@ -749,16 +749,6 @@ public boolean removeWhenFarAway(double distanceToClosestPlayer) { return false; } - @Override - public boolean isControlledByLocalInstance() { - return false; - } - -/* @Override - public boolean canBeControlledByRider() { - return true; - }*/ - @Nullable public Player getRidingPlayer() { if (this.getControllingPassenger() instanceof Player) { diff --git a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityHippogryph.java b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityHippogryph.java index 2e0597874..9c6e2f2b5 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/entity/EntityHippogryph.java +++ b/src/main/java/com/github/alexthe666/iceandfire/entity/EntityHippogryph.java @@ -223,16 +223,6 @@ public double getYSpeedMod() { protected void checkFallDamage(double y, boolean onGroundIn, @NotNull BlockState state, @NotNull BlockPos pos) { } - @Override - public boolean isControlledByLocalInstance() { - return super.isControlledByLocalInstance(); - } - -/* @Override - public boolean canBeControlledByRider() { - return true; - }*/ - @Override public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) { super.positionRider(passenger, callback); diff --git a/src/main/java/com/github/alexthe666/iceandfire/entity/ai/AiDebug.java b/src/main/java/com/github/alexthe666/iceandfire/entity/ai/AiDebug.java index ba3046bf5..05d98c126 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/entity/ai/AiDebug.java +++ b/src/main/java/com/github/alexthe666/iceandfire/entity/ai/AiDebug.java @@ -1,5 +1,6 @@ package com.github.alexthe666.iceandfire.entity.ai; +import com.github.alexthe666.iceandfire.IceAndFire; import net.minecraft.world.entity.Mob; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -21,7 +22,7 @@ private AiDebug() { } public static boolean isEnabled() { - return false; + return IceAndFire.VERSION.equals("0.0NONE"); } public static void logData() { diff --git a/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateCyclops.java b/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateCyclops.java index cc2b30200..3f5585b16 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateCyclops.java +++ b/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateCyclops.java @@ -1,10 +1,10 @@ package com.github.alexthe666.iceandfire.pathfinding; import com.github.alexthe666.citadel.server.entity.collision.CustomCollisionsNavigator; +import com.github.alexthe666.citadel.server.entity.collision.CustomCollisionsNodeProcessor; import com.github.alexthe666.iceandfire.entity.EntityCyclops; import net.minecraft.world.level.Level; import net.minecraft.world.level.pathfinder.PathFinder; -import net.minecraft.world.level.pathfinder.WalkNodeEvaluator; public class PathNavigateCyclops extends CustomCollisionsNavigator { @@ -14,7 +14,7 @@ public PathNavigateCyclops(EntityCyclops LivingEntityIn, Level worldIn) { @Override protected PathFinder createPathFinder(int i) { - this.nodeEvaluator = new WalkNodeEvaluator(); + this.nodeEvaluator = new CustomCollisionsNodeProcessor(); this.nodeEvaluator.setCanPassDoors(true); this.nodeEvaluator.setCanFloat(true); return new PathFinder(this.nodeEvaluator, i); diff --git a/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateDeathWormLand.java b/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateDeathWormLand.java index ce8c265d1..b17a8ae66 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateDeathWormLand.java +++ b/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateDeathWormLand.java @@ -133,12 +133,17 @@ protected void removeSunnyPath() { /** * Checks if the specified entity can safely walk to the specified location. */ - protected boolean canMoveDirectly(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ) { + @Override + protected boolean canMoveDirectly(Vec3 posVec31, Vec3 posVec32) { int i = Mth.floor(posVec31.x); int j = Mth.floor(posVec31.z); double d0 = posVec32.x - posVec31.x; double d1 = posVec32.z - posVec31.z; double d2 = d0 * d0 + d1 * d1; + int sizeX = (int) worm.getBoundingBox().getXsize(); + int sizeY = (int) worm.getBoundingBox().getYsize(); + int sizeZ = (int) worm.getBoundingBox().getZsize(); + if (d2 < 1.0E-8D) { return false; diff --git a/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateDeathWormSand.java b/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateDeathWormSand.java index d3674a324..234e9b2ff 100644 --- a/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateDeathWormSand.java +++ b/src/main/java/com/github/alexthe666/iceandfire/pathfinding/PathNavigateDeathWormSand.java @@ -20,11 +20,9 @@ import javax.annotation.Nullable; public class PathNavigateDeathWormSand extends WaterBoundPathNavigation { - private final EntityDeathWorm worm; public PathNavigateDeathWormSand(EntityDeathWorm deathworm, Level worldIn) { super(deathworm, worldIn); - worm = deathworm; } @Override @@ -40,9 +38,6 @@ public boolean canFloat() { return new PathFinder(this.nodeEvaluator, i); } - /** - * If on ground or swimming and can swim - */ @Override protected boolean canUpdatePath() { return true; @@ -53,11 +48,8 @@ protected boolean canUpdatePath() { return new Vec3(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ()); } - - /** - * Checks if the specified entity can safely walk to the specified location. - */ - protected boolean canMoveDirectly(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ) { + @Override + protected boolean canMoveDirectly(Vec3 posVec31, Vec3 posVec32) { HitResult raytraceresult = this.level.clip(new CustomRayTraceContext(posVec31, posVec32, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, mob)); if (raytraceresult != null && raytraceresult.getType() == HitResult.Type.BLOCK) { Vec3 vec3i = raytraceresult.getLocation();