Fix missing chunks on client (View distance issue)

This commit is contained in:
Spottedleaf 2020-06-28 00:58:25 -04:00 committed by Aikar
parent 15613201c4
commit d871ae80fe
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
5 changed files with 37 additions and 22 deletions

View file

@ -49,19 +49,6 @@ index a3afe60b0d85cf90bf7a170dc0a0b61a796381a7..85f799a713db0c822d46b689010f9f6b
} else {
System.arraycopy(this.b, 0, au, 0, this.c);
if (au.length > this.c) {
diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
index 84a872dfd35249972129130083d51d71d75bff1e..b4976b9e00e631c1431543c0cb2064e153f3a2ef 100644
--- a/src/main/java/net/minecraft/server/BehaviorFindPosition.java
+++ b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
@@ -81,7 +81,7 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
villageplace.a(this.b.c(), (blockposition1) -> {
return blockposition1.equals(blockposition);
}, blockposition, 1);
- entitycreature.getBehaviorController().setMemory(this.c, (Object) GlobalPos.create(worldserver.getDimensionKey(), blockposition));
+ entitycreature.getBehaviorController().setMemory(this.c, GlobalPos.create(worldserver.getDimensionKey(), blockposition)); // Paper - decompile fix
this.f.clear();
PacketDebug.c(worldserver, blockposition);
});
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index 6c2ed9c1b8567abcdb11bdc3dbaeed217a2f61e7..ae0ac8d383ca11a683465d8c83a8b8a66e567079 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java

View file

@ -105,7 +105,7 @@ index 2b06c95b4fac97513e706ef073fdd7418e1f092c..67fda8bd5a0ad6fea2df0066c61e006c
this.world.b(this.position, this);
if (!this.c.isAir()) {
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index a0a3adac3e2bc939b1809c5587929f674f4318a5..728c829c18db4bb25ad4581b485bb8a44300d1b1 100644
index a0a3adac3e2bc939b1809c5587929f674f4318a5..20df9bd21d0e4d2579d05d79672da2eb26478044 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -168,6 +168,160 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
@ -369,8 +369,12 @@ index a0a3adac3e2bc939b1809c5587929f674f4318a5..728c829c18db4bb25ad4581b485bb8a4
} else {
Iterator iterator = c(ihopper).iterator();
@@ -268,7 +467,8 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
private static boolean a(IHopper ihopper, IInventory iinventory, int i, EnumDirection enumdirection) {
@@ -265,10 +464,11 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
}
- private static boolean a(IHopper ihopper, IInventory iinventory, int i, EnumDirection enumdirection) {
+ private static boolean a(IHopper ihopper, IInventory iinventory, int i, EnumDirection enumdirection) {// Paper - method unused as logic is inlined above
ItemStack itemstack = iinventory.getItem(i);
- if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) {

View file

@ -331,7 +331,7 @@ index b1cf9fac28031b7f8051a0d1d5d7ce63b06d5f2d..3a46076a125bbfa19ca8a22dc5ab71fd
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 438e86595760be233e89c49224963e5e8ce335e3..ff2b21305e4a46a8cafa247a0d4e786a6b7cb627 100644
index 438e86595760be233e89c49224963e5e8ce335e3..43a763746f6eb72ae93c9b376e458edf6d86be36 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -150,6 +150,37 @@ public class Main {
@ -372,7 +372,7 @@ index 438e86595760be233e89c49224963e5e8ce335e3..ff2b21305e4a46a8cafa247a0d4e786a
try {
options = parser.parse(args);
} catch (joptsimple.OptionException ex) {
@@ -245,8 +276,61 @@ public class Main {
@@ -245,8 +276,62 @@ public class Main {
} catch (Throwable t) {
t.printStackTrace();
}
@ -415,6 +415,7 @@ index 438e86595760be233e89c49224963e5e8ce335e3..ff2b21305e4a46a8cafa247a0d4e786a
+ // Minecraft, seen during saving
+ tryPreloadClass("net.minecraft.server.LightEngineLayerEventListener$Void");
+ tryPreloadClass("net.minecraft.server.LightEngineLayerEventListener");
+ tryPreloadClass("net.minecraft.server.ExceptionSuppressor");
+ // Paper end
+ }
+ }

View file

@ -127,6 +127,20 @@ index fb2b64628b974758cace770ce6debe5e88318ae8..0e3ceb60e503c74fc65b1d08371645ff
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, worldserver.getSpawn(), gameprofile);
this.spawnDimension = World.OVERWORLD;
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index a68e4fc411ae84f12b1ca7443fa66f6325712af8..d24b5fa7e77bb18626459f6c3ab4aa20a7512712 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -620,7 +620,8 @@ public final class MCUtil {
});
worldData.addProperty("name", world.getWorld().getName());
- worldData.addProperty("view-distance", world.spigotConfig.viewDistance);
+ worldData.addProperty("view-distance", world.getChunkProvider().playerChunkMap.getEffectiveViewDistance());
+ worldData.addProperty("no-view-distance", world.getChunkProvider().playerChunkMap.getRawNoTickViewDistance());
worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory);
worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange);
worldData.addProperty("visible-chunk-count", visibleChunks.size());
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 7f660d3c528f5fb4150e4ee8b29913436f125b06..40347212ad1bcf857d5b8ddb0ee6a698e2568201 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
@ -553,9 +567,18 @@ index 026562c72d7e95345d9369c6d6331cf6cedb8f17..fe343f70ce8024c86363637fda8e5c09
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index f7c23ec053b261a5e7e069fb61dd803c385d6758..e1ed059fd347465929b89c1d5a324f494104d602 100644
index f7c23ec053b261a5e7e069fb61dd803c385d6758..477b1920869bfdab166b815f433d2df2821e5d58 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -177,7 +177,7 @@ public abstract class PlayerList {
boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO);
// Spigot - view distance
- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.E(), this.s, worldserver1.getTypeKey(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver1.spigotConfig.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld()));
+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.E(), this.s, worldserver1.getTypeKey(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver.getChunkProvider().playerChunkMap.getLoadViewDistance(), flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); // Paper - no-tick view distance
entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@@ -819,7 +819,7 @@ public abstract class PlayerList {
// CraftBukkit start
WorldData worlddata = worldserver1.getWorldData();

View file

@ -617,10 +617,10 @@ index 0e3ceb60e503c74fc65b1d08371645ffbb26ef5c..d5740a25bb487fc186333e908968c6a2
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i);
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index a68e4fc411ae84f12b1ca7443fa66f6325712af8..ce17f5114e997b48073bb078336dc43bdae190a7 100644
index d24b5fa7e77bb18626459f6c3ab4aa20a7512712..e9cedbc8b62180134e774b119fb156c54f5767de 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -654,6 +654,7 @@ public final class MCUtil {
@@ -655,6 +655,7 @@ public final class MCUtil {
chunkData.addProperty("x", playerChunk.location.x);
chunkData.addProperty("z", playerChunk.location.z);
chunkData.addProperty("ticket-level", playerChunk.getTicketLevel());
@ -1144,7 +1144,7 @@ index 681de2638eb606185077668d87340f7258e2ad90..fcd30d3fa5bac44ca71714a13917d847
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index e1ed059fd347465929b89c1d5a324f494104d602..09d7435ed4e5a00f8215aceedf26033fc703d659 100644
index 477b1920869bfdab166b815f433d2df2821e5d58..a8100f7ade20932a87c55750b412d6a755a9cdd5 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -200,8 +200,8 @@ public abstract class PlayerList {