mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
ea855e2b46
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Developers!: You will need to clean up your work/Minecraft/1.13.2 folder for this Also, restore a patch that was dropped in the last upstream Bukkit Changes: 279eeab3 Fix command description not being set 96e2bb18 Remove debug print from SyntheticEventTest CraftBukkit Changes:d3ed1516
Fix dangerously threaded beacons217a293d
Don't relocate joptsimple to allow --help to work.1be05a21
Prepare for imminent Java 12 releasea49270b2
Mappings Update5259d80c
SPIGOT-4669: Fix PlayerTeleportEvent coordinates for relative teleports Spigot Changes: e6eb36f2 Rebuild patches
101 lines
4.8 KiB
Diff
101 lines
4.8 KiB
Diff
From b9d64587ae8fa0d608b6d970b08368113e8f73aa 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 2b15aa6c9..3ca32123b 100644
|
|
--- a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java
|
|
+++ b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java
|
|
@@ -12,11 +12,13 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
|
|
private final Block f;
|
|
private final EntityInsentient entity;
|
|
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.entity = entitycreature;
|
|
+ this.world = entitycreature.world; // Paper
|
|
}
|
|
|
|
public boolean a() {
|
|
@@ -99,7 +101,9 @@ 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()};
|
|
@@ -109,7 +113,7 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
|
|
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
|
|
return blockposition1;
|
|
}
|
|
}
|
|
@@ -119,7 +123,8 @@ 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();
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
|
index e58fdee8b..f2c4048c2 100644
|
|
--- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
|
+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
|
@@ -87,6 +87,7 @@ public class RandomPositionGenerator {
|
|
}
|
|
|
|
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 (!flag) {
|
|
blockposition1 = a(blockposition1, entitycreature);
|
|
@@ -155,6 +156,7 @@ public class RandomPositionGenerator {
|
|
}
|
|
|
|
private static boolean b(BlockPosition blockposition, EntityCreature entitycreature) {
|
|
- return entitycreature.world.getFluid(blockposition).a(TagsFluid.WATER);
|
|
+ Fluid fluid = entitycreature.world.getFluidIfLoaded(blockposition); // Paper
|
|
+ return fluid != null && fluid.a(TagsFluid.WATER); // Paper
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index d12e4763a..a7302b39c 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -764,7 +764,17 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
return chunk.getType(blockposition);
|
|
}
|
|
}
|
|
+ // Paper start
|
|
+ public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
|
+ if (blockposition.isInvalidYLocation()) { // Paper
|
|
+ return getFluid(blockposition);
|
|
+ } else {
|
|
+ Chunk chunk = this.getChunkIfLoaded(blockposition);
|
|
|
|
+ return chunk != null ? chunk.getFluid(blockposition) : null;
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
public Fluid getFluid(BlockPosition blockposition) {
|
|
if (blockposition.isInvalidYLocation()) { // Paper
|
|
return FluidTypes.EMPTY.i();
|
|
--
|
|
2.21.0
|
|
|