Fix more runtime stuff

Remove chunk neighbour system until we can figure out the chunk system
This commit is contained in:
Spottedleaf 2019-05-06 17:05:41 -07:00
parent a189bdc0fc
commit b5b481da62
17 changed files with 75 additions and 165 deletions

View File

@ -1,4 +1,4 @@
From 0f0f805ffa000c104c0d75167b0071a01ca7e170 Mon Sep 17 00:00:00 2001
From bc0ffd36b7da37fac29585df89bfd63f36d3391e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 18:48:17 -0600
Subject: [PATCH] Timings v2
@ -709,7 +709,7 @@ index 00000000..cc0390c0
+}
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
new file mode 100644
index 00000000..04369523
index 00000000..ddaed812
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
@@ -0,0 +1,354 @@
@ -859,7 +859,7 @@ index 00000000..04369523
+ public JSONPair apply(Map.Entry<EntityType, Counter> entry) {
+ entityTypeSet.add(entry.getKey());
+ return pair(
+ String.valueOf(entry.getKey().getTypeId()),
+ String.valueOf(entry.getKey().ordinal()),
+ entry.getValue().count()
+ );
+ }
@ -872,7 +872,7 @@ index 00000000..04369523
+ public JSONPair apply(Map.Entry<Material, Counter> entry) {
+ tileEntityTypeSet.add(entry.getKey());
+ return pair(
+ String.valueOf(entry.getKey().getId()),
+ String.valueOf(entry.getKey().ordinal()),
+ entry.getValue().count()
+ );
+ }

View File

@ -1,4 +1,4 @@
From 5649d05624dac0cd18bc362f5769c01606b59019 Mon Sep 17 00:00:00 2001
From f7f8402e29b9516fedb8a617a5079f0861603d12 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -322,40 +322,10 @@ index 8b91e27c66..fd23d45346 100644
private final float frictionFactor;
protected final BlockStateList<Block, IBlockData> blockStateList;
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 9cce929c3e..1a2cc0258a 100644
index 9cce929c3e..5c34fe52a4 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -89,6 +89,29 @@ public class Chunk implements IChunkAccess {
return removed;
}
}
+ public boolean areNeighborsLoaded(final int radius) {
+ switch (radius) {
+ case 2:
+ return this.neighbors == Integer.MAX_VALUE >> 6;
+ case 1:
+ final int mask =
+ // x z offset x z offset x z offset
+ (0x1 << (1 * 5 + 1 + 12)) | (0x1 << (0 * 5 + 1 + 12)) | (0x1 << (-1 * 5 + 1 + 12)) |
+ (0x1 << (1 * 5 + 0 + 12)) | (0x1 << (0 * 5 + 0 + 12)) | (0x1 << (-1 * 5 + 0 + 12)) |
+ (0x1 << (1 * 5 + -1 + 12)) | (0x1 << (0 * 5 + -1 + 12)) | (0x1 << (-1 * 5 + -1 + 12));
+ return (this.neighbors & mask) == mask;
+ default:
+ throw new UnsupportedOperationException(String.valueOf(radius));
+ }
+ }
+
+ public void setNeighborLoaded(final int x, final int z) {
+ this.neighbors |= 0x1 << (x * 5 + 12 + z);
+ }
+
+ public void setNeighborUnloaded(final int x, final int z) {
+ this.neighbors &= ~(0x1 << (x * 5 + 12 + z));
+ }
// Paper end
public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeBase[] abiomebase, ChunkConverter chunkconverter, TickList<Block> ticklist, TickList<FluidType> ticklist1, long i, @Nullable ChunkSection[] achunksection, @Nullable Consumer<Chunk> consumer) {
@@ -546,6 +569,7 @@ public class Chunk implements IChunkAccess {
@@ -546,6 +546,7 @@ public class Chunk implements IChunkAccess {
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration));
if (this.needsDecoration) {
@ -363,7 +333,7 @@ index 9cce929c3e..1a2cc0258a 100644
java.util.Random random = new java.util.Random();
random.setSeed(world.getSeed());
long xRand = random.nextLong() / 2L * 2L + 1L;
@@ -564,6 +588,7 @@ public class Chunk implements IChunkAccess {
@@ -564,6 +565,7 @@ public class Chunk implements IChunkAccess {
}
}
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
@ -792,7 +762,7 @@ index 4de927416b..4c1c914132 100644
this.methodProfiler.exit();
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 755c0406e1..5816c7bcc7 100644
index 755c0406e1..036577dd0e 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1,6 +1,8 @@
@ -804,59 +774,7 @@ index 755c0406e1..5816c7bcc7 100644
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.mojang.datafixers.DataFixer;
@@ -244,6 +246,27 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
playerchunk = new PlayerChunk(new ChunkCoordIntPair(i), j, this.lightEngine, this.q, this);
}
+ // TODO: VERIFY THIS
+ ChunkCoordIntPair currentChunkPair = new ChunkCoordIntPair(i);
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
+ if (x == 0 && z == 0) {
+ continue;
+ }
+
+
+ PlayerChunk neighborPlayer = getUpdatingChunk(ChunkCoordIntPair.pair(currentChunkPair.x + x, currentChunkPair.z + z));
+ if (neighborPlayer != null) {
+ Chunk neighbor = neighborPlayer.getChunk();
+ Chunk player = playerchunk.getChunk();
+ if (neighbor != null && player != null) {
+ neighbor.setNeighborLoaded(-x, -z);
+ player.setNeighborLoaded(x, z);
+ }
+ }
+ }
+ }
+
this.updatingChunks.put(i, playerchunk);
this.updatingChunksModified = true;
}
@@ -332,6 +355,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk, chunk.isNeedsSaving());
this.world.getServer().getPluginManager().callEvent(event);
this.saveChunk(ichunkaccess, event.isSaveChunk());
+ // TODO: VERIFY THIS
+ // Paper - Update neighbor counts
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
+ if (x == 0 && z == 0) {
+ continue;
+ }
+
+
+ Chunk neighbor = ((Chunk) ichunkaccess).world.getChunkProvider().getChunkAt(event.getChunk().getX(), event.getChunk().getZ(), false);
+ if (neighbor != null) {
+ neighbor.setNeighborUnloaded(-x, -z);
+ ((Chunk) ichunkaccess).setNeighborUnloaded(x, z);
+ }
+ }
+ }
+ // Paper
// CraftBukkit end
chunk.c(false);
@@ -402,7 +442,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -402,7 +404,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
});
return completablefuture.thenComposeAsync((either) -> {
@ -865,7 +783,7 @@ index 755c0406e1..5816c7bcc7 100644
try {
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture1 = chunkstatus.a(this.world, this.chunkGenerator, this.definedStructureManager, this.lightEngine, (ichunkaccess) -> {
return this.b(playerchunk);
@@ -879,6 +919,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -879,6 +881,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker;
ObjectIterator objectiterator;
@ -873,7 +791,7 @@ index 755c0406e1..5816c7bcc7 100644
for (objectiterator = this.trackedEntities.values().iterator(); objectiterator.hasNext(); playerchunkmap_entitytracker.trackerEntry.a()) {
playerchunkmap_entitytracker = (PlayerChunkMap.EntityTracker) objectiterator.next();
@@ -896,13 +937,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -896,13 +899,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
playerchunkmap_entitytracker.e = sectionposition1;
}
}
@ -1632,7 +1550,7 @@ index 06728e53d5..783676b747 100644
* This helper class represents the different NBT Tags.
* <p>
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 76b060a126..bf35950867 100644
index 76b060a126..2daecf5049 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -30,7 +30,7 @@ import net.minecraft.server.EntityWither;
@ -1684,19 +1602,11 @@ index 76b060a126..bf35950867 100644
return true;
}
@@ -274,7 +272,14 @@ public class ActivationRange
@@ -274,7 +272,6 @@ public class ActivationRange
{
isActive = false;
}
- SpigotTimings.checkIfActiveTimer.stopTiming();
+ int x = MathHelper.floor( entity.locX );
+ int z = MathHelper.floor( entity.locZ );
+ // Make sure not on edge of unloaded chunk
+ Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 );
+ if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) )
+ {
+ isActive = false;
+ }
return isActive;
}
}

View File

@ -1,14 +1,14 @@
From fe64055921f76ebcdb8891a74b35ef5c8aa9eccd Mon Sep 17 00:00:00 2001
From 5107f10a7d0b494d3974f0b55e0fb1b7d1afb31c Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 15:08:03 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 89bce93c61..3be7f7d297 100644
index 5c34fe52a4..8e71c8af11 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -523,6 +523,10 @@ public class Chunk implements IChunkAccess {
@@ -500,6 +500,10 @@ public class Chunk implements IChunkAccess {
}
// CraftBukkit start

View File

@ -1,4 +1,4 @@
From 4bff48bda3c4df4e6896391c5c99aac244f1d070 Mon Sep 17 00:00:00 2001
From 25fb9ab71cb5abc7f5a5ffbac4de33af9b5b5a96 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 1 Mar 2016 23:09:29 -0600
Subject: [PATCH] Further improve server tick loop
@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 13a0918cea..320af3f503 100644
index 13a0918cea..c53224b11d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -150,7 +150,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -152,7 +152,7 @@ index 13a0918cea..320af3f503 100644
- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
+ //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
+ this.a(this::canSleepForTick);
+ lastTick = curTime;
this.nextTick += 50L;
if (this.T) {
this.T = false;

View File

@ -1,4 +1,4 @@
From c20c4977df4d9a8009cb08f54fcfc710883fa8c4 Mon Sep 17 00:00:00 2001
From 65e8c4b55fd401af9fa2490bb37b70cb6ba47fcd Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Wed, 2 Mar 2016 23:13:07 -0600
Subject: [PATCH] Send absolute position the first time an entity is seen
@ -77,10 +77,10 @@ index 315c3d9165..aaf3a54b08 100644
this.c();
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 5816c7bcc7..4bbf9244f2 100644
index 036577dd0e..efdfab10da 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1035,10 +1035,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -997,10 +997,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final Entity tracker;
private final int trackingDistance;
private SectionPosition e;
@ -97,7 +97,7 @@ index 5816c7bcc7..4bbf9244f2 100644
this.tracker = entity;
this.trackingDistance = i;
this.e = SectionPosition.a(entity);
@@ -1120,7 +1124,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1082,7 +1086,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
// CraftBukkit end

View File

@ -1,4 +1,4 @@
From 55a0321f3f6c273aac277c629058f59702cda47e Mon Sep 17 00:00:00 2001
From de39dfbcb3bb52924e1d01a51420f2df3f8918b5 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
@ -49,7 +49,7 @@ index 0000000000..f699ce18ca
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 1cf5e388e4..c4103680d4 100644
index 8e71c8af11..d578679920 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@
@ -59,7 +59,7 @@ index 1cf5e388e4..c4103680d4 100644
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
@@ -528,10 +529,15 @@ public class Chunk implements IChunkAccess {
@@ -505,10 +506,15 @@ public class Chunk implements IChunkAccess {
this.tileEntities.remove(blockposition);
// Paper end
} else {
@ -121,10 +121,10 @@ index 1dd793d2fb..61ea2818b1 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 4bbf9244f2..5dc8e62021 100644
index efdfab10da..1370565b36 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -599,6 +599,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -561,6 +561,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.world.checkSession();
} catch (ExceptionWorldConflict exceptionworldconflict) {
PlayerChunkMap.LOGGER.error("Couldn't save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
@ -132,7 +132,7 @@ index 4bbf9244f2..5dc8e62021 100644
return;
}
@@ -625,6 +626,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -587,6 +588,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.write(chunkcoordintpair, nbttagcompound);
} catch (Exception exception) {
PlayerChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception);

View File

@ -1,4 +1,4 @@
From 3eca27df8c7688c5f1d10ce9fe77d6c66b48f5f5 Mon Sep 17 00:00:00 2001
From 15e7fb2e3e3c72b1c7f72fe540e5a70d098c37bb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 20:16:03 -0400
Subject: [PATCH] Add World Util Methods
@ -6,10 +6,10 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index c4103680d4..9433d04f43 100644
index d578679920..2928f7d218 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -388,6 +388,7 @@ public class Chunk implements IChunkAccess {
@@ -365,6 +365,7 @@ public class Chunk implements IChunkAccess {
return this.world.getChunkProvider().getLightEngine();
}
@ -45,7 +45,7 @@ index bac6c9d65b..0930552b1f 100644
@Nullable
IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 01f5105884..556d7af07a 100644
index 24ea0dbe03..e1cebacb83 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -46,7 +46,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose

View File

@ -1,4 +1,4 @@
From 48a682eac7e1502586e5edae0c1233ae181823df Mon Sep 17 00:00:00 2001
From 4ed471356d2a121be6ed130098d24f68590c325a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 02:07:55 -0600
Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling
@ -12,7 +12,7 @@ Replace all calls to the new place to the unnecessary forward.
Optimize getType and getBlockData to manually inline and optimize the calls
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index 2852a17f2..7cb46d7a9 100644
index 2852a17f23..7cb46d7a9c 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -10,6 +10,14 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
@ -31,7 +31,7 @@ index 2852a17f2..7cb46d7a9 100644
public BaseBlockPosition(int i, int j, int k) {
this.a = i;
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index c927d524a..64700b97c 100644
index c927d524a8..64700b97c0 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -339,6 +339,16 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
@ -52,10 +52,10 @@ index c927d524a..64700b97c 100644
public MutableBlockPosition() {
this(0, 0, 0);
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 9433d04f4..98ec98e02 100644
index 2928f7d218..7a0ab24a91 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -232,12 +232,24 @@ public class Chunk implements IChunkAccess {
@@ -209,12 +209,24 @@ public class Chunk implements IChunkAccess {
return this.sections;
}
@ -86,7 +86,7 @@ index 9433d04f4..98ec98e02 100644
IBlockData iblockdata = null;
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index c973ab607..0d7eab0e0 100644
index 30701fd7f3..43f75fc837 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -9,7 +9,7 @@ public class ChunkSection {
@ -99,7 +99,7 @@ index c973ab607..0d7eab0e0 100644
public ChunkSection(int i) {
this(i, (short) 0, (short) 0, (short) 0);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index cdc5d7009..78d1a5c71 100644
index e1cebacb83..31c38e1051 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -197,11 +197,11 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose

View File

@ -1,4 +1,4 @@
From 415febb133d2a64f91317c9b2757f323e7307dbf Mon Sep 17 00:00:00 2001
From 3ac48ee8c663e1d3d38dfc50b68585bc156efce9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:46:14 -0400
Subject: [PATCH] Configurable Chunk Inhabited Time
@ -11,7 +11,7 @@ For people who want all chunks to be treated equally, you can chose a fixed valu
This allows to fine-tune vanilla gameplay.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2a71381da..e43866991 100644
index 2a71381dae..e43866991c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -229,4 +229,19 @@ public class PaperWorldConfig {
@ -35,10 +35,10 @@ index 2a71381da..e43866991 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 98ec98e02..a413dc73b 100644
index 7a0ab24a91..ed7899abb2 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -826,7 +826,7 @@ public class Chunk implements IChunkAccess {
@@ -803,7 +803,7 @@ public class Chunk implements IChunkAccess {
@Override
public long q() {

View File

@ -1,11 +1,11 @@
From 1320b81faa9a9bbf0aaebbab509c6b6fb579afc7 Mon Sep 17 00:00:00 2001
From a8b53fb5c3798192239fb36ef5d55815f10fc75c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 5 Oct 2016 16:27:36 -0500
Subject: [PATCH] Option to remove corrupt tile entities
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 92ab55182..eed454bf4 100644
index 92ab55182f..eed454bf40 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -296,4 +296,9 @@ public class PaperWorldConfig {
@ -19,10 +19,10 @@ index 92ab55182..eed454bf4 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index a413dc73b..54bb7f551 100644
index ed7899abb2..5f0329d0b1 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -550,6 +550,12 @@ public class Chunk implements IChunkAccess {
@@ -527,6 +527,12 @@ public class Chunk implements IChunkAccess {
"Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
e.printStackTrace();
ServerInternalException.reportInternalException(e);

View File

@ -1,14 +1,14 @@
From a10267a106c969bb7c1a0e6e0f2c017ed9703baa Mon Sep 17 00:00:00 2001
From 82970c53b5f0fc7f3efa48dc5f603bbe300ebbc9 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 7 Feb 2017 16:55:35 -0600
Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 5dc8e62021..4be53f89bb 100644
index 1370565b36..8e40027acf 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -314,7 +314,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -293,7 +293,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Spigot start
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
activityAccountant.startActivity(0.5);

View File

@ -1,4 +1,4 @@
From 2b0dd101a780ba65566dadf37c91bef781ab7ea8 Mon Sep 17 00:00:00 2001
From e1761ca14d86a46faf103fcf2d34fd79e208a14a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
@ -9,10 +9,10 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 4be53f89bb..34f97ce222 100644
index 8e40027acf..eee03e39b1 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -713,11 +713,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -675,11 +675,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
int chunkRange = world.spigotConfig.mobSpawnRange;
chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;

View File

@ -1,4 +1,4 @@
From 13aa59139e439b184472d721ea0adc84fc68b3dd Mon Sep 17 00:00:00 2001
From ebdfbf4828b4b305b2aa5880d5239eb37a134dae Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 22 Jul 2018 21:21:41 -0400
Subject: [PATCH] Don't save Proto Chunks
@ -8,10 +8,10 @@ the loadChunk method refuses to acknoledge they exists, and will restart
a new chunk generation process to begin with, so saving them serves no benefit.
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 34f97ce222..804824bfe2 100644
index eee03e39b1..239bac9839 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -592,6 +592,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -554,6 +554,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
public void saveChunk(IChunkAccess ichunkaccess, boolean save) {

View File

@ -1,4 +1,4 @@
From 6702adf4aaf939989fef82ae6899f3c2f7dabe69 Mon Sep 17 00:00:00 2001
From c4b1af2626f609e6bae4e19896b2df0ffaa63954 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:18:31 -0400
Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
@ -6,10 +6,10 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 54bb7f5515..8b6a52d722 100644
index 5f0329d0b1..c23891f73a 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -433,6 +433,7 @@ public class Chunk implements IChunkAccess {
@@ -410,6 +410,7 @@ public class Chunk implements IChunkAccess {
entity.chunkY = k;
entity.chunkZ = this.loc.z;
this.entitySlices[k].add(entity);
@ -17,7 +17,7 @@ index 54bb7f5515..8b6a52d722 100644
}
@Override
@@ -459,6 +460,7 @@ public class Chunk implements IChunkAccess {
@@ -436,6 +437,7 @@ public class Chunk implements IChunkAccess {
return;
}
entityCounts.decrement(entity.getMinecraftKeyString());

View File

@ -1,4 +1,4 @@
From 427f7dcd47331bf8e6f66159c475b3ce6568ee22 Mon Sep 17 00:00:00 2001
From 88075086ab0ce189abe18270d7b670f8d57e6074 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:44:23 -0400
Subject: [PATCH] Add some Debug to Chunk Entity slices
@ -9,10 +9,10 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 8b6a52d722..0c8a2ac902 100644
index c23891f73a..d787a4ab30 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -425,6 +425,25 @@ public class Chunk implements IChunkAccess {
@@ -402,6 +402,25 @@ public class Chunk implements IChunkAccess {
if (k >= this.entitySlices.length) {
k = this.entitySlices.length - 1;
}
@ -38,7 +38,7 @@ index 8b6a52d722..0c8a2ac902 100644
if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper
entity.inChunk = true;
@@ -433,6 +452,7 @@ public class Chunk implements IChunkAccess {
@@ -410,6 +429,7 @@ public class Chunk implements IChunkAccess {
entity.chunkY = k;
entity.chunkZ = this.loc.z;
this.entitySlices[k].add(entity);
@ -46,7 +46,7 @@ index 8b6a52d722..0c8a2ac902 100644
this.markDirty(); // Paper
}
@@ -456,6 +476,9 @@ public class Chunk implements IChunkAccess {
@@ -433,6 +453,9 @@ public class Chunk implements IChunkAccess {
}
// Paper start
if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);

View File

@ -1,4 +1,4 @@
From 4bc4dee4a3bcbef50d0e436a59e01df8e92944d6 Mon Sep 17 00:00:00 2001
From 3255a5046a0949487ce88bfec42c7bf2e8765c9b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:18:27 -0400
Subject: [PATCH] Ignore Dead Entities in entityList iteration
@ -23,10 +23,10 @@ index 3354fdd60d..ab09104542 100644
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0c8a2ac902..21fae98c10 100644
index d787a4ab30..d313b9b3ca 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -665,6 +665,7 @@ public class Chunk implements IChunkAccess {
@@ -642,6 +642,7 @@ public class Chunk implements IChunkAccess {
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();
@ -34,7 +34,7 @@ index 0c8a2ac902..21fae98c10 100644
if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) {
if (predicate == null || predicate.test(entity1)) {
@@ -702,6 +703,7 @@ public class Chunk implements IChunkAccess {
@@ -679,6 +680,7 @@ public class Chunk implements IChunkAccess {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -42,7 +42,7 @@ index 0c8a2ac902..21fae98c10 100644
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
list.add(entity);
@@ -723,6 +725,7 @@ public class Chunk implements IChunkAccess {
@@ -700,6 +702,7 @@ public class Chunk implements IChunkAccess {
while (iterator.hasNext()) {
T t0 = (T) iterator.next(); // CraftBukkit - decompile error

View File

@ -1,4 +1,4 @@
From 412513806cb6e6a36fdabcaef9f4d70e5db3d80b Mon Sep 17 00:00:00 2001
From 22110e16bbd4752ac2920b96a8e2fee13d10ece5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 28 Sep 2018 22:27:33 -0400
Subject: [PATCH] Don't recheck type after setting a block
@ -16,10 +16,10 @@ be having data corruption issues anyways.
This provides a small boost to all setType calls.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 21fae98c10..98ca253bda 100644
index d313b9b3ca..2dcfb60f4d 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -361,7 +361,7 @@ public class Chunk implements IChunkAccess {
@@ -338,7 +338,7 @@ public class Chunk implements IChunkAccess {
this.world.removeTileEntity(blockposition);
}