Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Spigot-Server-Patches/0302-Don-t-load-chunks-for-villager-door-checks.patch
Aikar 18c3716c49
Current Chunk for Entity and Block Entities, counts by entity type
This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.

We also store counts by type to further enable other performance optimizations in later patches.
2018-07-04 03:58:56 -04:00

47 Zeilen
1.8 KiB
Diff

From d6a8a38833e30365423d53a34ce66c467f13c403 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Jun 2018 00:32:22 -0400
Subject: [PATCH] Don't load chunks for villager door checks
This avoids villages spam loading chunks sync
diff --git a/src/main/java/net/minecraft/server/PersistentVillage.java b/src/main/java/net/minecraft/server/PersistentVillage.java
index 01f7cee38..a3aa9f82e 100644
--- a/src/main/java/net/minecraft/server/PersistentVillage.java
+++ b/src/main/java/net/minecraft/server/PersistentVillage.java
@@ -226,7 +226,12 @@ public class PersistentVillage extends PersistentBase {
}
private boolean f(BlockPosition blockposition) {
- IBlockData iblockdata = this.world.getType(blockposition);
+ // Paper start
+ IBlockData iblockdata = this.world.getTypeIfLoaded(blockposition);
+ if (iblockdata == null) {
+ return false;
+ }
+ // Paper end
Block block = iblockdata.getBlock();
return block instanceof BlockDoor ? iblockdata.getMaterial() == Material.WOOD : false;
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index 2eb33a986..9f1867ddd 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -327,7 +327,12 @@ public class Village {
}
private boolean f(BlockPosition blockposition) {
- IBlockData iblockdata = this.a.getType(blockposition);
+ // Paper start
+ IBlockData iblockdata = this.a.getTypeIfLoaded(blockposition);
+ if (iblockdata == null) {
+ return false;
+ }
+ // Paper end
Block block = iblockdata.getBlock();
return block instanceof BlockDoor ? iblockdata.getMaterial() == Material.WOOD : false;
--
2.18.0