mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
Combine patches for entities loading unloaded chunks
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
From d7b4dc9f2e73e04b56a0eca20a65adad252801bb Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 12 Jul 2019 16:18:55 -0500
|
||||
Subject: [PATCH] Prevent entities from loading unloaded chunks
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/Entity.java | 1 +
|
||||
src/main/java/net/minecraft/server/EntityEnderman.java | 1 +
|
||||
src/main/java/net/minecraft/server/EntityZombie.java | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b1afdf71bb..79fb1c6c8e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -577,6 +577,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
int j = MathHelper.floor(this.locY - 0.20000000298023224D);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
+ if (!world.isLoaded(blockposition)) return; // Purpur
|
||||
IBlockData iblockdata = this.world.getType(blockposition);
|
||||
|
||||
if (iblockdata.isAir()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
index f551192a04..eb07bbcd9e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
@@ -222,6 +222,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
|
||||
private boolean l(double d0, double d1, double d2) {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(d0, d1, d2);
|
||||
+ if (!world.isLoaded(blockposition_mutableblockposition)) return false; // Purpur
|
||||
|
||||
while (blockposition_mutableblockposition.getY() > 0 && !this.world.getType(blockposition_mutableblockposition).getMaterial().isSolid()) {
|
||||
blockposition_mutableblockposition.c(EnumDirection.DOWN);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
index 9dfddd980b..32144bf92d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@@ -296,6 +296,7 @@ public class EntityZombie extends EntityMonster {
|
||||
int j1 = j + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
|
||||
int k1 = k + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
|
||||
BlockPosition blockposition = new BlockPosition(i1, j1 - 1, k1);
|
||||
+ if (!world.isLoaded(blockposition)) continue; // Purpur
|
||||
|
||||
if (this.world.getType(blockposition).a((IBlockAccess) this.world, blockposition, (Entity) entityzombie) && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) {
|
||||
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Reference in New Issue
Block a user