Skip to content

Commit

Permalink
fix: fixed certain entities not moving
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBv committed Oct 16, 2023
1 parent e0f198f commit 8719f42
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -988,11 +988,6 @@ public boolean removeWhenFarAway(double distanceToClosestPlayer) {
return false;
}

@Override
public boolean isControlledByLocalInstance() {
return false;
}

@Override
public double getFlightSpeedModifier() {
return 0.555D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -267,7 +262,6 @@ public boolean shouldRiderSit() {
return false;
}


@Override
public void aiStep() {
super.aiStep();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,7 +22,7 @@ private AiDebug() {
}

public static boolean isEnabled() {
return false;
return IceAndFire.VERSION.equals("0.0NONE");
}

public static void logData() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 8719f42

Please sign in to comment.