Prevent pathfinding and zombie AI from loading chunks
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 10 Sep 2018 23:56:36 -0400
|
||||
Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java
|
||||
index b1661693cf..2cbb6c8f91 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
|
||||
private final Block f;
|
||||
private final EntityInsentient g;
|
||||
private int h;
|
||||
+ private World world; // Paper
|
||||
|
||||
public PathfinderGoalRemoveBlock(Block block, EntityCreature entitycreature, double d0, int i) {
|
||||
super(entitycreature, d0, 24, i);
|
||||
this.f = block;
|
||||
this.g = entitycreature;
|
||||
+ this.world = entitycreature.world; // Paper
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
|
||||
|
||||
@Nullable
|
||||
private BlockPosition a(BlockPosition blockposition, IBlockAccess iblockaccess) {
|
||||
- if (iblockaccess.getType(blockposition).getBlock() == this.f) {
|
||||
+ Block block = world.getBlockIfLoaded(blockposition); // Paper
|
||||
+ if (block == null) return null; // Paper
|
||||
+ if (block == this.f) { // Paper
|
||||
return blockposition;
|
||||
} else {
|
||||
BlockPosition[] ablockposition = new BlockPosition[]{blockposition.down(), blockposition.west(), blockposition.east(), blockposition.north(), blockposition.south(), blockposition.down().down()};
|
||||
|
||||
for(BlockPosition blockposition1 : ablockposition) {
|
||||
- if (iblockaccess.getType(blockposition1).getBlock() == this.f) {
|
||||
+ if (world.getBlockIfLoaded(blockposition1) == this.f) { // Paper
|
||||
return blockposition1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
|
||||
}
|
||||
|
||||
protected boolean a(IWorldReader iworldreader, BlockPosition blockposition) {
|
||||
- Block block = iworldreader.getType(blockposition).getBlock();
|
||||
+ Block block = world.getBlockIfLoaded(blockposition); // Paper
|
||||
+ if (block == null) return false; // Paper
|
||||
return block == this.f && iworldreader.getType(blockposition.up()).isAir() && iworldreader.getType(blockposition.up(2)).isAir();
|
||||
}
|
||||
}
|
||||
--
|
||||
Reference in New Issue
Block a user