More patches for 1.14
This commit is contained in:
@@ -5,31 +5,31 @@ 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 2b15aa6c9e..3ca32123bb 100644
|
||||
index ce9318c57..541d97344 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 Block g;
|
||||
private final EntityInsentient entity;
|
||||
private int h;
|
||||
private int i;
|
||||
+ private World world; // Paper
|
||||
|
||||
public PathfinderGoalRemoveBlock(Block block, EntityCreature entitycreature, double d0, int i) {
|
||||
super(entitycreature, d0, 24, i);
|
||||
this.f = block;
|
||||
this.g = block;
|
||||
this.entity = entitycreature;
|
||||
+ this.world = entitycreature.world; // Paper
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
|
||||
|
||||
@Nullable
|
||||
private BlockPosition a(BlockPosition blockposition, IBlockAccess iblockaccess) {
|
||||
- if (iblockaccess.getType(blockposition).getBlock() == this.f) {
|
||||
- if (iblockaccess.getType(blockposition).getBlock() == this.g) {
|
||||
+ Block block = world.getBlockIfLoaded(blockposition); // Paper
|
||||
+ if (block == null) return null; // Paper
|
||||
+ if (block == this.f) { // Paper
|
||||
+ if (block == this.g) { // Paper
|
||||
return blockposition;
|
||||
} else {
|
||||
BlockPosition[] ablockposition = new BlockPosition[] { blockposition.down(), blockposition.west(), blockposition.east(), blockposition.north(), blockposition.south(), blockposition.down().down()};
|
||||
@@ -37,23 +37,23 @@ index 2b15aa6c9e..3ca32123bb 100644
|
||||
for (int j = 0; j < i; ++j) {
|
||||
BlockPosition blockposition1 = ablockposition1[j];
|
||||
|
||||
- if (iblockaccess.getType(blockposition1).getBlock() == this.f) {
|
||||
+ if (world.getBlockIfLoaded(blockposition1) == this.f) { // Paper
|
||||
- if (iblockaccess.getType(blockposition1).getBlock() == this.g) {
|
||||
+ if (world.getBlockIfLoaded(blockposition1) == this.g) { // Paper
|
||||
return blockposition1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
|
||||
}
|
||||
|
||||
@Override
|
||||
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();
|
||||
return block == this.g && iworldreader.getType(blockposition.up()).isAir() && iworldreader.getType(blockposition.up(2)).isAir();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
index e58fdee8bb..f2c4048c2b 100644
|
||||
index 8340d6d25..78eb1b39c 100644
|
||||
--- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
@@ -0,0 +0,0 @@ public class RandomPositionGenerator {
|
||||
@@ -61,7 +61,7 @@ index e58fdee8bb..f2c4048c2b 100644
|
||||
|
||||
blockposition1 = new BlockPosition((double) k1 + entitycreature.locX, (double) l1 + entitycreature.locY, (double) i2 + entitycreature.locZ);
|
||||
+ if (!entitycreature.world.isLoaded(blockposition1)) continue; // Paper
|
||||
if ((!flag1 || entitycreature.f(blockposition1)) && navigationabstract.a(blockposition1)) {
|
||||
if ((!flag1 || entitycreature.a(blockposition1)) && navigationabstract.a(blockposition1)) {
|
||||
if (!flag) {
|
||||
blockposition1 = a(blockposition1, entitycreature);
|
||||
@@ -0,0 +0,0 @@ public class RandomPositionGenerator {
|
||||
@@ -74,10 +74,10 @@ index e58fdee8bb..f2c4048c2b 100644
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 630ebfb37c..0d45e21573 100644
|
||||
index 79ded224c..cfab578df 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||
return chunk.getType(blockposition);
|
||||
}
|
||||
}
|
||||
@@ -87,12 +87,11 @@ index 630ebfb37c..0d45e21573 100644
|
||||
+ return getFluid(blockposition);
|
||||
+ } else {
|
||||
+ Chunk chunk = this.getChunkIfLoaded(blockposition);
|
||||
|
||||
+ return chunk != null ? chunk.getFluid(blockposition) : null;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public Fluid getFluid(BlockPosition blockposition) {
|
||||
if (blockposition.isInvalidYLocation()) { // Paper
|
||||
return FluidTypes.EMPTY.i();
|
||||
--
|
||||
Reference in New Issue
Block a user