Fix entity pathing not matching vanilla. Closes #6755

This commit is contained in:
LexManos 2020-06-12 16:24:27 -07:00
parent e374f62037
commit 07b62b77e6
3 changed files with 19 additions and 3 deletions

View file

@ -0,0 +1,16 @@
--- a/net/minecraft/pathfinding/PathNodeType.java
+++ b/net/minecraft/pathfinding/PathNodeType.java
@@ -33,4 +33,13 @@
public float func_186289_a() {
return this.field_186307_r;
}
+
+ @javax.annotation.Nullable
+ public PathNodeType getDanger() {
+ return (this == DAMAGE_FIRE || this == DANGER_FIRE ) ? DANGER_FIRE :
+ (this == DAMAGE_CACTUS || this == DANGER_CACTUS) ? DANGER_CACTUS :
+ (this == DAMAGE_OTHER || this == DANGER_OTHER ) ? DANGER_OTHER :
+ (this == LAVA) ? DAMAGE_FIRE :
+ null;
+ }
}

View file

@ -14,8 +14,8 @@
- } else {
- p_193578_4_ = PathNodeType.DANGER_FIRE;
- }
+ PathNodeType type = func_189553_b(p_193578_0_, p_193578_1_, p_193578_2_, p_193578_3_);
+ if (type == PathNodeType.DANGER_CACTUS || type == PathNodeType.DANGER_FIRE || type == PathNodeType.DANGER_OTHER)
+ PathNodeType type = func_189553_b(p_193578_0_, p_193578_1_ + i, p_193578_2_ + j, p_193578_3_ + k).getDanger();
+ if (type != null)
+ p_193578_4_ = type;
}
}

View file

@ -882,7 +882,7 @@ public interface IForgeBlock
@Nullable
default PathNodeType getAiPathNodeType(BlockState state, IBlockReader world, BlockPos pos, @Nullable MobEntity entity)
{
return state.isBurning(world, pos) ? PathNodeType.DANGER_FIRE : null;
return state.getBlock() == Blocks.LAVA ? PathNodeType.LAVA : state.isBurning(world, pos) ? PathNodeType.DAMAGE_FIRE : null;
}
/**