Port random ticking optimisation from Moonrise

Dieser Commit ist enthalten in:
Spottedleaf 2024-07-15 11:11:04 -07:00
Ursprung 8b23018575
Commit 3b45454190
12 geänderte Dateien mit 436 neuen und 131 gelöschten Zeilen

Datei anzeigen

@ -7,6 +7,7 @@ Currently includes:
- Starlight + Chunk System - Starlight + Chunk System
- Entity tracker optimisations - Entity tracker optimisations
- Collision optimisations - Collision optimisations
- Random block ticking optimisations
See https://github.com/Tuinity/Moonrise See https://github.com/Tuinity/Moonrise
@ -3363,6 +3364,39 @@ index 0000000000000000000000000000000000000000..e95cc73ddf20050aa4a241b0a309240e
+ throw new RuntimeException(); + throw new RuntimeException();
+ } + }
+} +}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/block_counting/BlockCountingBitStorage.java b/src/main/java/ca/spottedleaf/moonrise/patches/block_counting/BlockCountingBitStorage.java
new file mode 100644
index 0000000000000000000000000000000000000000..aef4fc0d3c272febe675d1ac846b88e58b4e7533
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/block_counting/BlockCountingBitStorage.java
@@ -0,0 +1,10 @@
+package ca.spottedleaf.moonrise.patches.block_counting;
+
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
+
+public interface BlockCountingBitStorage {
+
+ public Int2ObjectOpenHashMap<IntArrayList> moonrise$countEntries();
+
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/block_counting/BlockCountingChunkSection.java b/src/main/java/ca/spottedleaf/moonrise/patches/block_counting/BlockCountingChunkSection.java
new file mode 100644
index 0000000000000000000000000000000000000000..a08ddb0598d44368af5b6bace971ee31edf9919e
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/block_counting/BlockCountingChunkSection.java
@@ -0,0 +1,11 @@
+package ca.spottedleaf.moonrise.patches.block_counting;
+
+import ca.spottedleaf.moonrise.common.list.IBlockDataList;
+
+public interface BlockCountingChunkSection {
+
+ public int moonrise$getSpecialCollidingBlocks();
+
+ public IBlockDataList moonrise$getTickingBlockList();
+
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_getblock/GetBlockChunk.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_getblock/GetBlockChunk.java diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_getblock/GetBlockChunk.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_getblock/GetBlockChunk.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..08338917dc61c856eaba0b76e05c1497c458399d index 0000000000000000000000000000000000000000..08338917dc61c856eaba0b76e05c1497c458399d
@ -18284,7 +18318,7 @@ index 0000000000000000000000000000000000000000..4b9e2fa963c14f65f15407c1814c543c
+} +}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..3cbd02085cc3e2ddb15458faea4b553868cff39a index 0000000000000000000000000000000000000000..748ab4d637ce463272bae4fdbab6842a27385126
--- /dev/null --- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
@@ -0,0 +1,1853 @@ @@ -0,0 +1,1853 @@
@ -19946,7 +19980,7 @@ index 0000000000000000000000000000000000000000..3cbd02085cc3e2ddb15458faea4b5538
+ continue; + continue;
+ } + }
+ +
+ final boolean hasSpecial = ((ca.spottedleaf.moonrise.patches.collisions.world.CollisionLevelChunkSection)section).moonrise$getSpecialCollidingBlocks() != 0; + final boolean hasSpecial = ((ca.spottedleaf.moonrise.patches.block_counting.BlockCountingChunkSection)section).moonrise$getSpecialCollidingBlocks() != 0;
+ final int sectionAdjust = !hasSpecial ? 1 : 0; + final int sectionAdjust = !hasSpecial ? 1 : 0;
+ +
+ final net.minecraft.world.level.chunk.PalettedContainer<net.minecraft.world.level.block.state.BlockState> blocks = section.states; + final net.minecraft.world.level.chunk.PalettedContainer<net.minecraft.world.level.block.state.BlockState> blocks = section.states;
@ -20599,19 +20633,6 @@ index 0000000000000000000000000000000000000000..e851e81e13edbad6316df63fcb7095d4
+ public int moonrise$getMaxSection(); + public int moonrise$getMaxSection();
+ +
+} +}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/world/CollisionLevelChunkSection.java b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/world/CollisionLevelChunkSection.java
new file mode 100644
index 0000000000000000000000000000000000000000..2f0b43374b70a51aeabfd9e0e16738e0ab584517
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/world/CollisionLevelChunkSection.java
@@ -0,0 +1,7 @@
+package ca.spottedleaf.moonrise.patches.collisions.world;
+
+public interface CollisionLevelChunkSection {
+
+ public int moonrise$getSpecialCollidingBlocks();
+
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/entity_tracker/EntityTrackerEntity.java b/src/main/java/ca/spottedleaf/moonrise/patches/entity_tracker/EntityTrackerEntity.java diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/entity_tracker/EntityTrackerEntity.java b/src/main/java/ca/spottedleaf/moonrise/patches/entity_tracker/EntityTrackerEntity.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..5f5734c00ce8245a1ff69b2d4c3036579d5392e0 index 0000000000000000000000000000000000000000..5f5734c00ce8245a1ff69b2d4c3036579d5392e0
@ -28540,7 +28561,7 @@ index 3dc1daa3c6a04d3ff1a2353773b465fc380994a2..3575782f13a7f3c52e64dc5046803305
} }
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index be9604a0f267558c95125852d86761a2f175732a..67eb2fb32de3555b3afb4b4b7a3a47a164158ac8 100644 index be9604a0f267558c95125852d86761a2f175732a..d2cb358c340bcf7532fd25eccdd33c6945d16de4 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -46,7 +46,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp @@ -46,7 +46,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
@ -28699,7 +28720,7 @@ index be9604a0f267558c95125852d86761a2f175732a..67eb2fb32de3555b3afb4b4b7a3a47a1
- } else { - } else {
- return this.getChunkAtIfLoadedMainThread(chunkX, chunkZ); // Paper - Perf: Optimise getChunkAt calls for loaded chunks - return this.getChunkAtIfLoadedMainThread(chunkX, chunkZ); // Paper - Perf: Optimise getChunkAt calls for loaded chunks
- } - }
+ return ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getFullChunkIfLoaded(chunkX, chunkZ); // Paper - rewrite chunk system + return this.fullChunks.get(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunkX, chunkZ)); // Paper - rewrite chunk system
} }
private void clearCache() { private void clearCache() {
@ -28947,7 +28968,7 @@ index 1d849ce4e2c85f149af25318b8ffb6dcef6c6788..12d86f27d04bffed8c3844e36b42fbc2
if (!list.equals(this.lastPassengers)) { if (!list.equals(this.lastPassengers)) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e999090fee1 100644 index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..bb3826481d6165991f4201ed39d56fa5824a841f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -184,7 +184,7 @@ import org.bukkit.event.weather.LightningStrikeEvent; @@ -184,7 +184,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@ -28968,7 +28989,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
private final GameEventDispatcher gameEventDispatcher; private final GameEventDispatcher gameEventDispatcher;
public boolean noSave; public boolean noSave;
private final SleepStatus sleepStatus; private final SleepStatus sleepStatus;
@@ -339,6 +339,185 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -339,6 +339,176 @@ public class ServerLevel extends Level implements WorldGenLevel {
return player != null && player.level() == this ? player : null; return player != null && player.level() == this ? player : null;
} }
// Paper end - optimise getPlayerByUUID // Paper end - optimise getPlayerByUUID
@ -28986,16 +29007,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
+ +
+ @Override + @Override
+ public final LevelChunk moonrise$getFullChunkIfLoaded(final int chunkX, final int chunkZ) { + public final LevelChunk moonrise$getFullChunkIfLoaded(final int chunkX, final int chunkZ) {
+ final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder newChunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunkX, chunkZ)); + return this.chunkSource.getChunkNow(chunkX, chunkZ);
+ if (newChunkHolder == null || !newChunkHolder.isFullChunkReady()) {
+ return null;
+ }
+
+ if (newChunkHolder.getCurrentChunk() instanceof LevelChunk levelChunk) {
+ return levelChunk;
+ }
+ // race condition: chunk unloaded, only happens off-main
+ return null;
+ } + }
+ +
+ @Override + @Override
@ -29154,7 +29166,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
@@ -385,14 +564,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -385,14 +555,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
DataFixer datafixer = minecraftserver.getFixerUpper(); DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver); EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
@ -29172,7 +29184,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
return minecraftserver.overworld().getDataStorage(); return minecraftserver.overworld().getDataStorage();
}); });
this.chunkSource.getGeneratorState().ensureStructuresGenerated(); this.chunkSource.getGeneratorState().ensureStructuresGenerated();
@@ -420,6 +598,19 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -420,6 +589,19 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> { this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences"); return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
}); });
@ -29192,7 +29204,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
} }
@@ -553,7 +744,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -553,7 +735,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.push("checkDespawn"); gameprofilerfiller.push("checkDespawn");
entity.checkDespawn(); entity.checkDespawn();
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@ -29201,7 +29213,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
Entity entity1 = entity.getVehicle(); Entity entity1 = entity.getVehicle();
if (entity1 != null) { if (entity1 != null) {
@@ -578,13 +769,16 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -578,13 +760,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
gameprofilerfiller.push("entityManagement"); gameprofilerfiller.push("entityManagement");
@ -29220,7 +29232,108 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} }
protected void tickTime() { protected void tickTime() {
@@ -976,6 +1170,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -626,6 +811,63 @@ public class ServerLevel extends Level implements WorldGenLevel {
});
}
+ // Paper start - optimise random ticking
+ private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) {
+ final LevelChunkSection[] sections = chunk.getSections();
+ final int minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection((ServerLevel)(Object)this);
+ final RandomSource random = this.random;
+ final boolean tickFluids = false; // Paper - not configurable - MC-224294
+
+ final ChunkPos cpos = chunk.getPos();
+ final int offsetX = cpos.x << 4;
+ final int offsetZ = cpos.z << 4;
+
+ for (int sectionIndex = 0, sectionsLen = sections.length; sectionIndex < sectionsLen; sectionIndex++) {
+ final int offsetY = (sectionIndex + minSection) << 4;
+ final LevelChunkSection section = sections[sectionIndex];
+ final net.minecraft.world.level.chunk.PalettedContainer<net.minecraft.world.level.block.state.BlockState> states = section.states;
+ if (section == null || !section.isRandomlyTickingBlocks()) {
+ continue;
+ }
+
+ final ca.spottedleaf.moonrise.common.list.IBlockDataList tickList = ((ca.spottedleaf.moonrise.patches.block_counting.BlockCountingChunkSection)section).moonrise$getTickingBlockList();
+ if (tickList.size() == 0) {
+ continue;
+ }
+
+ for (int i = 0; i < tickSpeed; ++i) {
+ final int tickingBlocks = tickList.size();
+ final int index = random.nextInt() & ((16 * 16 * 16) - 1);
+
+ if (index >= tickingBlocks) {
+ // most of the time we fall here
+ continue;
+ }
+
+ final long raw = tickList.getRaw(index);
+ final int location = ca.spottedleaf.moonrise.common.list.IBlockDataList.getLocationFromRaw(raw);
+ final int randomX = (location & 15);
+ final int randomY = ((location >>> (4 + 4)) & 255);
+ final int randomZ = ((location >>> 4) & 15);
+ final BlockState state = states.get(randomX | (randomZ << 4) | (randomY << 8));
+
+ // do not use a mutable pos, as some random tick implementations store the input without calling immutable()!
+ final BlockPos pos = new BlockPos(randomX | offsetX, randomY | offsetY, randomZ | offsetZ);
+
+ state.randomTick((ServerLevel)(Object)this, pos, random);
+ if (tickFluids) {
+ final FluidState fluidState = state.getFluidState();
+ if (fluidState.isRandomlyTicking()) {
+ fluidState.randomTick((ServerLevel)(Object)this, pos, random);
+ }
+ }
+ }
+ }
+
+ return;
+ }
+ // Paper end - optimise random ticking
+
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
ChunkPos chunkcoordintpair = chunk.getPos();
boolean flag = this.isRaining();
@@ -675,35 +917,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.popPush("tickBlocks");
timings.chunkTicksBlocks.startTiming(); // Paper
if (randomTickSpeed > 0) {
- LevelChunkSection[] achunksection = chunk.getSections();
-
- for (int i1 = 0; i1 < achunksection.length; ++i1) {
- LevelChunkSection chunksection = achunksection[i1];
-
- if (chunksection.isRandomlyTicking()) {
- int j1 = chunk.getSectionYFromSectionIndex(i1);
- int k1 = SectionPos.sectionToBlockCoord(j1);
-
- for (int l1 = 0; l1 < randomTickSpeed; ++l1) {
- BlockPos blockposition1 = this.getBlockRandomPos(j, k1, k, 15);
-
- gameprofilerfiller.push("randomTick");
- BlockState iblockdata = chunksection.getBlockState(blockposition1.getX() - j, blockposition1.getY() - k1, blockposition1.getZ() - k);
-
- if (iblockdata.isRandomlyTicking()) {
- iblockdata.randomTick(this, blockposition1, this.random);
- }
-
- FluidState fluid = iblockdata.getFluidState();
-
- if (fluid.isRandomlyTicking()) {
- fluid.randomTick(this, blockposition1, this.random);
- }
-
- gameprofilerfiller.pop();
- }
- }
- }
+ this.optimiseRandomTick(chunk, randomTickSpeed); // Paper - optimise random ticking
}
timings.chunkTicksBlocks.stopTiming(); // Paper
@@ -976,6 +1190,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (fluid1.is(fluid)) { if (fluid1.is(fluid)) {
fluid1.tick(this, pos); fluid1.tick(this, pos);
} }
@ -29232,7 +29345,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} }
@@ -985,6 +1184,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -985,6 +1204,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (iblockdata.is(block)) { if (iblockdata.is(block)) {
iblockdata.tick(this, pos, this.random); iblockdata.tick(this, pos, this.random);
} }
@ -29244,7 +29357,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} }
@@ -1061,6 +1265,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1061,6 +1285,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) { public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) {
@ -29256,7 +29369,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
ServerChunkCache chunkproviderserver = this.getChunkSource(); ServerChunkCache chunkproviderserver = this.getChunkSource();
if (!savingDisabled) { if (!savingDisabled) {
@@ -1076,16 +1285,21 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1076,16 +1305,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
timings.worldSaveChunks.startTiming(); // Paper timings.worldSaveChunks.startTiming(); // Paper
@ -29284,7 +29397,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
// CraftBukkit start - moved from MinecraftServer.saveChunks // CraftBukkit start - moved from MinecraftServer.saveChunks
ServerLevel worldserver1 = this; ServerLevel worldserver1 = this;
@@ -1218,7 +1432,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1218,7 +1452,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED); this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
} }
@ -29293,7 +29406,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} }
// CraftBukkit start // CraftBukkit start
@@ -1249,7 +1463,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1249,7 +1483,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
// CraftBukkit end // CraftBukkit end
@ -29302,7 +29415,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} }
} }
@@ -1260,11 +1474,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1260,11 +1494,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
// CraftBukkit end // CraftBukkit end
@ -29315,7 +29428,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
return false; return false;
} else { } else {
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
@@ -1850,7 +2060,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1850,7 +2080,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
@ -29324,7 +29437,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size())); bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size()));
bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
@@ -1899,7 +2109,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1899,7 +2129,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1); BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
try { try {
@ -29333,7 +29446,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} catch (Throwable throwable4) { } catch (Throwable throwable4) {
if (bufferedwriter2 != null) { if (bufferedwriter2 != null) {
try { try {
@@ -1920,7 +2130,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1920,7 +2150,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2); BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
try { try {
@ -29342,7 +29455,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} catch (Throwable throwable6) { } catch (Throwable throwable6) {
if (bufferedwriter3 != null) { if (bufferedwriter3 != null) {
try { try {
@@ -2062,7 +2272,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2062,7 +2292,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@VisibleForTesting @VisibleForTesting
public String getWatchdogStats() { public String getWatchdogStats() {
@ -29351,7 +29464,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
}), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats()); }), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats());
} }
@@ -2092,15 +2302,25 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2092,15 +2322,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public LevelEntityGetter<Entity> getEntities() { public LevelEntityGetter<Entity> getEntities() {
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
@ -29380,7 +29493,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} }
public void startTickingChunk(LevelChunk chunk) { public void startTickingChunk(LevelChunk chunk) {
@@ -2120,34 +2340,47 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2120,34 +2360,47 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public void close() throws IOException { public void close() throws IOException {
super.close(); super.close();
@ -29435,7 +29548,7 @@ index 4d7e234d379a451c4bb53bc2fcdf22cb191f8d1a..e955bf0c9f76f6e90bd726342f204e99
} }
@Override @Override
@@ -2173,7 +2406,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2173,7 +2426,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report); CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
crashreportsystemdetails.setDetail("Loaded entity count", () -> { crashreportsystemdetails.setDetail("Loaded entity count", () -> {
@ -29940,6 +30053,87 @@ index cdd66e6ce96e2613afe7f06ca8da3cfaa6704b2d..32634e45ac8433648e49e47e20081e15
handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null));
// Paper start - PlayerChunkLoadEvent // Paper start - PlayerChunkLoadEvent
if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
index 68648c5a5e3ff079f832092af0f2f801c42d1ede..19661e106612b8e4e152085fb398db7bd06acc23 100644
--- a/src/main/java/net/minecraft/util/BitStorage.java
+++ b/src/main/java/net/minecraft/util/BitStorage.java
@@ -2,7 +2,7 @@ package net.minecraft.util;
import java.util.function.IntConsumer;
-public interface BitStorage {
+public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counting.BlockCountingBitStorage { // Paper - block counting
int getAndSet(int index, int value);
void set(int index, int value);
@@ -20,4 +20,22 @@ public interface BitStorage {
void unpack(int[] out);
BitStorage copy();
+
+ // Paper start - block counting
+ // provide default impl in case mods implement this...
+ @Override
+ public default it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.ints.IntArrayList> moonrise$countEntries() {
+ final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.ints.IntArrayList> ret = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>();
+
+ final int size = this.getSize();
+ for (int index = 0; index < size; ++index) {
+ final int paletteIdx = this.get(index);
+ ret.computeIfAbsent(paletteIdx, (final int key) -> {
+ return new it.unimi.dsi.fastutil.ints.IntArrayList();
+ }).add(index);
+ }
+
+ return ret;
+ }
+ // Paper end - block counting
}
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
index 9f438d9c6eb05e43d24e4af68188a3d4c46a938c..8acf2f2491a8d9d13392c5e89b2bd5c9918285e1 100644
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
@@ -362,6 +362,40 @@ public class SimpleBitStorage implements BitStorage {
return new SimpleBitStorage(this.bits, this.size, (long[])this.data.clone());
}
+ // Paper start - block counting
+ @Override
+ public final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.ints.IntArrayList> moonrise$countEntries() {
+ final int valuesPerLong = this.valuesPerLong;
+ final int bits = this.bits;
+ final long mask = this.mask;
+ final int size = this.size;
+
+ // we may be backed by global palette, so limit bits for init capacity
+ final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.ints.IntArrayList> ret = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(
+ 1 << Math.min(6, bits)
+ );
+
+ int index = 0;
+
+ for (long value : this.data) {
+ int li = 0;
+ do {
+ final int paletteIdx = (int)(value & mask);
+ value >>= bits;
+
+ ret.computeIfAbsent(paletteIdx, (final int key) -> {
+ return new it.unimi.dsi.fastutil.ints.IntArrayList();
+ }).add(index);
+
+ ++li;
+ ++index;
+ } while (li < valuesPerLong && index < size);
+ }
+
+ return ret;
+ }
+ // Paper end - block counting
+
public static class InitializationException extends RuntimeException {
InitializationException(String message) {
super(message);
diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java
index ea72dcb064a35bc6245bc5c94d592efedd8faf41..87ee8e51dfa7657ed7d83fcbceef48bf857043e1 100644 index ea72dcb064a35bc6245bc5c94d592efedd8faf41..87ee8e51dfa7657ed7d83fcbceef48bf857043e1 100644
--- a/src/main/java/net/minecraft/util/SortedArraySet.java --- a/src/main/java/net/minecraft/util/SortedArraySet.java
@ -30035,6 +30229,33 @@ index ea72dcb064a35bc6245bc5c94d592efedd8faf41..87ee8e51dfa7657ed7d83fcbceef48bf
private SortedArraySet(int initialCapacity, Comparator<T> comparator) { private SortedArraySet(int initialCapacity, Comparator<T> comparator) {
this.comparator = comparator; this.comparator = comparator;
if (initialCapacity < 0) { if (initialCapacity < 0) {
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
index 50040c497a819cd1229042ab3cb057d34a32cacc..15c5164d0ef41a978c16ee317fa73e97f2480207 100644
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
@@ -62,4 +62,22 @@ public class ZeroBitStorage implements BitStorage {
public BitStorage copy() {
return this;
}
+
+ // Paper start - block counting
+ @Override
+ public final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.ints.IntArrayList> moonrise$countEntries() {
+ final int size = this.size;
+
+ final int[] raw = new int[size];
+ for (int i = 0; i < size; ++i) {
+ raw[i] = i;
+ }
+
+ final it.unimi.dsi.fastutil.ints.IntArrayList coordinates = it.unimi.dsi.fastutil.ints.IntArrayList.wrap(raw, size);
+
+ final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.ints.IntArrayList> ret = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(1);
+ ret.put(0, coordinates);
+ return ret;
+ }
+ // Paper end - block counting
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2e2101274f3afebbae783fa119f5cae8104de45d..4f4b7e738fe604808d837a38d23bf437bc1d5329 100644 index 2e2101274f3afebbae783fa119f5cae8104de45d..4f4b7e738fe604808d837a38d23bf437bc1d5329 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
@ -31308,7 +31529,7 @@ index bff83fe413c7baef4ba56a3270ea4463a58c792f..a248d859cbce48f4a34c4771a7acffc1
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2f02efad5 100644 index e27d3547d1e19c137e05e6b8d075127a8bafb237..c4c2dc649e69d6097fbf6884ce82a34efb3e0e4d 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -81,6 +81,7 @@ import net.minecraft.world.level.storage.LevelData; @@ -81,6 +81,7 @@ import net.minecraft.world.level.storage.LevelData;
@ -31328,7 +31549,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
public static final Codec<ResourceKey<Level>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION); public static final Codec<ResourceKey<Level>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
public static final ResourceKey<Level> OVERWORLD = ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld")); public static final ResourceKey<Level> OVERWORLD = ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld"));
@@ -199,6 +200,451 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -199,6 +200,483 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey(); public abstract ResourceKey<LevelStem> getTypeKey();
@ -31387,6 +31608,22 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
+ public void moonrise$midTickTasks() { + public void moonrise$midTickTasks() {
+ // no-op on ClientLevel + // no-op on ClientLevel
+ } + }
+ /**
+ * @reason Turn all getChunk(x, z, status) calls into virtual invokes, instead of interface invokes:
+ * 1. The interface invoke is expensive
+ * 2. The method makes other interface invokes (again, expensive)
+ * Instead, we just directly call getChunk(x, z, status, true) which avoids the interface invokes entirely.
+ * @author Spottedleaf
+ */
+ @Override
+ public ChunkAccess getChunk(final int x, final int z, final ChunkStatus status) {
+ return ((Level)(Object)this).getChunk(x, z, status, true);
+ }
+
+ @Override
+ public BlockPos getHeightmapPos(Heightmap.Types types, BlockPos blockPos) {
+ return new BlockPos(blockPos.getX(), this.getHeight(types, blockPos.getX(), blockPos.getZ()), blockPos.getZ());
+ }
+ // Paper end - rewrite chunk system + // Paper end - rewrite chunk system
+ // Paper start - optimise collisions + // Paper start - optimise collisions
+ private final int minSection; + private final int minSection;
@ -31776,11 +32013,27 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
+ return java.util.Optional.ofNullable(selected); + return java.util.Optional.ofNullable(selected);
+ } + }
+ // Paper end - optimise collisions + // Paper end - optimise collisions
+ // Paper start - optimise random ticking
+ @Override
+ public abstract Holder<Biome> getUncachedNoiseBiome(final int x, final int y, final int z);
+
+ /**
+ * @reason Make getChunk and getUncachedNoiseBiome virtual calls instead of interface calls
+ * by implementing the superclass method in this class.
+ * @author Spottedleaf
+ */
+ @Override
+ public Holder<Biome> getNoiseBiome(final int x, final int y, final int z) {
+ final ChunkAccess chunk = this.getChunk(x >> 2, z >> 2, ChunkStatus.BIOMES, false);
+
+ return chunk != null ? chunk.getNoiseBiome(x, y, z) : this.getUncachedNoiseBiome(x, y, z);
+ }
+ // Paper end - optimise random ticking
+ +
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
@@ -281,6 +727,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -281,6 +759,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
@ -31792,7 +32045,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
} }
// Paper start - Cancel hit for vanished players // Paper start - Cancel hit for vanished players
@@ -549,7 +1000,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -549,7 +1032,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2); this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
} }
@ -31801,7 +32054,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i); this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
} }
@@ -813,6 +1264,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -813,6 +1296,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator(); // Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
boolean flag = this.tickRateManager().runsNormally(); boolean flag = this.tickRateManager().runsNormally();
@ -31810,7 +32063,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
int tilesThisCycle = 0; int tilesThisCycle = 0;
var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
toRemove.add(null); // Paper - Fix MC-117075 toRemove.add(null); // Paper - Fix MC-117075
@@ -828,6 +1281,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -828,6 +1313,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot end // Spigot end
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) { } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
tickingblockentity.tick(); tickingblockentity.tick();
@ -31822,7 +32075,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
} }
} }
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
@@ -850,12 +1308,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -850,12 +1340,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
// Paper end - Prevent block entity and entity crashes // Paper end - Prevent block entity and entity crashes
} }
@ -31844,7 +32097,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
} }
// Paper end - Option to prevent armor stands from doing entity lookups // Paper end - Option to prevent armor stands from doing entity lookups
@@ -949,7 +1415,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -949,7 +1447,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
// Paper end - Perf: Optimize capturedTileEntities lookup // Paper end - Perf: Optimize capturedTileEntities lookup
// CraftBukkit end // CraftBukkit end
@ -31853,24 +32106,24 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
} }
public void setBlockEntity(BlockEntity blockEntity) { public void setBlockEntity(BlockEntity blockEntity) {
@@ -1039,28 +1505,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1039,28 +1537,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override @Override
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) { public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
this.getProfiler().incrementCounter("getEntities"); this.getProfiler().incrementCounter("getEntities");
- List<Entity> list = Lists.newArrayList(); - List<Entity> list = Lists.newArrayList();
- + // Paper start - rewrite chunk system
+ final List<Entity> ret = new java.util.ArrayList<>();
- this.getEntities().get(box, (entity1) -> { - this.getEntities().get(box, (entity1) -> {
- if (entity1 != except && predicate.test(entity1)) { - if (entity1 != except && predicate.test(entity1)) {
- list.add(entity1); - list.add(entity1);
- } - }
+ // Paper start - rewrite chunk system + ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(except, box, ret, predicate);
+ final List<Entity> ret = new java.util.ArrayList<>();
- if (entity1 instanceof EnderDragon) { - if (entity1 instanceof EnderDragon) {
- EnderDragonPart[] aentitycomplexpart = ((EnderDragon) entity1).getSubEntities(); - EnderDragonPart[] aentitycomplexpart = ((EnderDragon) entity1).getSubEntities();
- int i = aentitycomplexpart.length; - int i = aentitycomplexpart.length;
+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(except, box, ret, predicate); -
- for (int j = 0; j < i; ++j) { - for (int j = 0; j < i; ++j) {
- EnderDragonPart entitycomplexpart = aentitycomplexpart[j]; - EnderDragonPart entitycomplexpart = aentitycomplexpart[j];
- -
@ -31887,7 +32140,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2
} }
@Override @Override
@@ -1075,36 +1526,77 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1075,36 +1558,77 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE); this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE);
} }
@ -32010,6 +32263,32 @@ index a0ae26d6197e1069ca09982b4f8b706c55ae8491..1a4dc4b2561dbaf01246b4fb46266b1a
@Nullable @Nullable
ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create); ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create);
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
index 15f82c9a1ce1fef2e951d1b3c7a65e64b82061ea..90c165c890a2d998e3b0af9b4310e3995ede6f64 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
@@ -111,20 +111,7 @@ public final class Biome {
@Deprecated
public float getTemperature(BlockPos blockPos) {
- long l = blockPos.asLong();
- Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = this.temperatureCache.get();
- float f = long2FloatLinkedOpenHashMap.get(l);
- if (!Float.isNaN(f)) {
- return f;
- } else {
- float g = this.getHeightAdjustedTemperature(blockPos);
- if (long2FloatLinkedOpenHashMap.size() == 1024) {
- long2FloatLinkedOpenHashMap.removeFirstFloat();
- }
-
- long2FloatLinkedOpenHashMap.put(l, g);
- return g;
- }
+ return this.getHeightAdjustedTemperature(blockPos); // Paper - optimise random ticking
}
public boolean shouldFreeze(LevelReader world, BlockPos blockPos) {
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index d775ab8b0d37797f29e650842191d40691fb7afc..a7108b2be0746aa1f0e574d8c6f5ffad6d369835 100644 index d775ab8b0d37797f29e650842191d40691fb7afc..a7108b2be0746aa1f0e574d8c6f5ffad6d369835 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java --- a/src/main/java/net/minecraft/world/level/block/Block.java
@ -32619,7 +32898,7 @@ index 602ad80c2b93d320bf2a25832d25a58cb8c72e4b..214bb6759d2670042d87b2fd0aae41df
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index 90d1c3e23e753c29660f7d993b3c90ac022941c3..1f767bb9342611a66c1be79ee23df39a4cad1102 100644 index 90d1c3e23e753c29660f7d993b3c90ac022941c3..d7b8d984122ba6b6ef5a0be6e012a8828a1af22d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -13,7 +13,7 @@ import net.minecraft.world.level.block.Blocks; @@ -13,7 +13,7 @@ import net.minecraft.world.level.block.Blocks;
@ -32627,53 +32906,74 @@ index 90d1c3e23e753c29660f7d993b3c90ac022941c3..1f767bb9342611a66c1be79ee23df39a
import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.FluidState;
-public class LevelChunkSection { -public class LevelChunkSection {
+public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.collisions.world.CollisionLevelChunkSection { // Paper - optimise collisions +public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_counting.BlockCountingChunkSection { // Paper - block counting
public static final int SECTION_WIDTH = 16; public static final int SECTION_WIDTH = 16;
public static final int SECTION_HEIGHT = 16; public static final int SECTION_HEIGHT = 16;
@@ -26,6 +26,15 @@ public class LevelChunkSection { @@ -26,6 +26,28 @@ public class LevelChunkSection {
// CraftBukkit start - read/write // CraftBukkit start - read/write
private PalettedContainer<Holder<Biome>> biomes; private PalettedContainer<Holder<Biome>> biomes;
+ // Paper start - optimise collisions + // Paper start - block counting
+ private static final it.unimi.dsi.fastutil.ints.IntArrayList FULL_LIST = new it.unimi.dsi.fastutil.ints.IntArrayList(16*16*16);
+ static {
+ for (int i = 0; i < (16*16*16); ++i) {
+ FULL_LIST.add(i);
+ }
+ }
+
+ private int specialCollidingBlocks; + private int specialCollidingBlocks;
+ private final ca.spottedleaf.moonrise.common.list.IBlockDataList tickingBlocks = new ca.spottedleaf.moonrise.common.list.IBlockDataList();
+ +
+ @Override + @Override
+ public final int moonrise$getSpecialCollidingBlocks() { + public final int moonrise$getSpecialCollidingBlocks() {
+ return this.specialCollidingBlocks; + return this.specialCollidingBlocks;
+ } + }
+ // Paper end - optimise collisions +
+ @Override
+ public final ca.spottedleaf.moonrise.common.list.IBlockDataList moonrise$getTickingBlockList() {
+ return this.tickingBlocks;
+ }
+ // Paper end - block counting
+ +
public LevelChunkSection(PalettedContainer<BlockState> datapaletteblock, PalettedContainer<Holder<Biome>> palettedcontainerro) { public LevelChunkSection(PalettedContainer<BlockState> datapaletteblock, PalettedContainer<Holder<Biome>> palettedcontainerro) {
// CraftBukkit end // CraftBukkit end
this.states = datapaletteblock; this.states = datapaletteblock;
@@ -92,6 +101,15 @@ public class LevelChunkSection { @@ -92,6 +114,22 @@ public class LevelChunkSection {
++this.tickingFluidCount; ++this.tickingFluidCount;
} }
+ // Paper start - optimise collisions + // Paper start - block counting
+ if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(state)) {
+ ++this.specialCollidingBlocks;
+ }
+ if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(iblockdata1)) { + if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(iblockdata1)) {
+ --this.specialCollidingBlocks; + --this.specialCollidingBlocks;
+ } + }
+ // Paper end - optimise collisions + if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(state)) {
+ ++this.specialCollidingBlocks;
+ }
+
+ if (iblockdata1.isRandomlyTicking()) {
+ this.tickingBlocks.remove(x, y, z);
+ }
+ if (state.isRandomlyTicking()) {
+ this.tickingBlocks.add(x, y, z, state);
+ }
+ // Paper end - block counting
+ +
return iblockdata1; return iblockdata1;
} }
@@ -112,40 +130,58 @@ public class LevelChunkSection { @@ -112,40 +150,65 @@ public class LevelChunkSection {
} }
public void recalcBlockCounts() { public void recalcBlockCounts() {
- class a implements PalettedContainer.CountConsumer<BlockState> { - class a implements PalettedContainer.CountConsumer<BlockState> {
+ // Paper start - optimise collisions + // Paper start - block counting
+ // reset, then recalculate + // reset, then recalculate
+ this.nonEmptyBlockCount = (short)0; + this.nonEmptyBlockCount = (short)0;
+ this.tickingBlockCount = (short)0; + this.tickingBlockCount = (short)0;
+ this.tickingFluidCount = (short)0; + this.tickingFluidCount = (short)0;
+ this.specialCollidingBlocks = (short)0; + this.specialCollidingBlocks = (short)0;
+ this.tickingBlocks.clear();
+ +
+ if (this.maybeHas((final BlockState state) -> !state.isAir())) { + if (this.maybeHas((final BlockState state) -> !state.isAir())) {
+ final PalettedContainer.Data<BlockState> data = this.states.data; + final PalettedContainer.Data<BlockState> data = this.states.data;
@ -32681,22 +32981,22 @@ index 90d1c3e23e753c29660f7d993b3c90ac022941c3..1f767bb9342611a66c1be79ee23df39a
+ final int paletteSize = palette.getSize(); + final int paletteSize = palette.getSize();
+ final net.minecraft.util.BitStorage storage = data.storage(); + final net.minecraft.util.BitStorage storage = data.storage();
+ +
+ final it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap counts = new it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap(paletteSize); + final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.ints.IntArrayList> counts;
+ if (paletteSize == 1) { + if (paletteSize == 1) {
+ counts.addTo(0, storage.getSize()); + counts = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(1);
+ counts.put(0, FULL_LIST);
+ } else { + } else {
+ storage.getAll((final int paletteIdx) -> { + counts = ((ca.spottedleaf.moonrise.patches.block_counting.BlockCountingBitStorage)storage).moonrise$countEntries();
+ counts.addTo(paletteIdx, 1);
+ });
+ } + }
- public int nonEmptyBlockCount; - public int nonEmptyBlockCount;
- public int tickingBlockCount; - public int tickingBlockCount;
- public int tickingFluidCount; - public int tickingFluidCount;
+ for (final java.util.Iterator<it.unimi.dsi.fastutil.ints.Int2IntMap.Entry> iterator = counts.int2IntEntrySet().fastIterator(); iterator.hasNext();) { + for (final java.util.Iterator<it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<it.unimi.dsi.fastutil.ints.IntArrayList>> iterator = counts.int2ObjectEntrySet().fastIterator(); iterator.hasNext();) {
+ final it.unimi.dsi.fastutil.ints.Int2IntMap.Entry entry = iterator.next(); + final it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<it.unimi.dsi.fastutil.ints.IntArrayList> entry = iterator.next();
+ final int paletteIdx = entry.getIntKey(); + final int paletteIdx = entry.getIntKey();
+ final int paletteCount = entry.getIntValue(); + final it.unimi.dsi.fastutil.ints.IntArrayList coordinates = entry.getValue();
+ final int paletteCount = coordinates.size();
- a(final LevelChunkSection chunksection) {} - a(final LevelChunkSection chunksection) {}
+ final BlockState state = palette.valueFor(paletteIdx); + final BlockState state = palette.valueFor(paletteIdx);
@ -32711,17 +33011,22 @@ index 90d1c3e23e753c29660f7d993b3c90ac022941c3..1f767bb9342611a66c1be79ee23df39a
- this.nonEmptyBlockCount += i; - this.nonEmptyBlockCount += i;
- if (iblockdata.isRandomlyTicking()) { - if (iblockdata.isRandomlyTicking()) {
- this.tickingBlockCount += i; - this.tickingBlockCount += i;
- }
+ if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(state)) { + if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(state)) {
+ this.specialCollidingBlocks += paletteCount; + this.specialCollidingBlocks += paletteCount;
} + }
+ this.nonEmptyBlockCount += paletteCount; + this.nonEmptyBlockCount += paletteCount;
+ if (state.isRandomlyTicking()) { + if (state.isRandomlyTicking()) {
+ this.tickingBlockCount += paletteCount; + this.tickingBlockCount += paletteCount;
+ } + final int[] raw = coordinates.elements();
+ +
+ final FluidState fluid = state.getFluidState(); + java.util.Objects.checkFromToIndex(0, paletteCount, raw.length);
+ for (int i = 0; i < paletteCount; ++i) {
+ this.tickingBlocks.add(raw[i], state);
}
}
+ final FluidState fluid = state.getFluidState();
+
if (!fluid.isEmpty()) { if (!fluid.isEmpty()) {
- this.nonEmptyBlockCount += i; - this.nonEmptyBlockCount += i;
+ //this.nonEmptyBlockCount += count; // fix vanilla bug: make non empty block count correct + //this.nonEmptyBlockCount += count; // fix vanilla bug: make non empty block count correct
@ -32740,15 +33045,15 @@ index 90d1c3e23e753c29660f7d993b3c90ac022941c3..1f767bb9342611a66c1be79ee23df39a
- this.nonEmptyBlockCount = (short) a0.nonEmptyBlockCount; - this.nonEmptyBlockCount = (short) a0.nonEmptyBlockCount;
- this.tickingBlockCount = (short) a0.tickingBlockCount; - this.tickingBlockCount = (short) a0.tickingBlockCount;
- this.tickingFluidCount = (short) a0.tickingFluidCount; - this.tickingFluidCount = (short) a0.tickingFluidCount;
+ // Paper end - optimise collisions + // Paper end - block counting
} }
public PalettedContainer<BlockState> getStates() { public PalettedContainer<BlockState> getStates() {
@@ -163,6 +199,7 @@ public class LevelChunkSection { @@ -163,6 +226,7 @@ public class LevelChunkSection {
datapaletteblock.read(buf); datapaletteblock.read(buf);
this.biomes = datapaletteblock; this.biomes = datapaletteblock;
+ this.recalcBlockCounts(); // Paper - optimise collisions + this.recalcBlockCounts(); // Paper - block counting
} }
public void readBiomes(FriendlyByteBuf buf) { public void readBiomes(FriendlyByteBuf buf) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] disable forced empty world ticks
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e955bf0c9f76f6e90bd726342f204e999090fee1..e5c44d2b02848aca5dcfc86006ab688598244f16 100644 index 9bebb4648b6490abb9942f6406ad4f96d4bf799f..e90199531c6c2975644e1223502bcecb4469220f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -719,7 +719,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -710,7 +710,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.handlingTick = false; this.handlingTick = false;
gameprofilerfiller.pop(); gameprofilerfiller.pop();

Datei anzeigen

@ -29,10 +29,10 @@ index 02367ef1371dde94ff6c4cd40bd32e800d6ccaaf..7b0fc7135bc107103dcaed6dc0707b18
this.x = x; this.x = x;
this.y = y; this.y = y;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 8b3522d2ff60d2ab79837b9cb32839c2f02efad5..b5f0590e85b00b728f833f7c17ca1c1cf57957cd 100644 index c4c2dc649e69d6097fbf6884ce82a34efb3e0e4d..2dcd2f9085de19a91f32f161b89572ec1fbe4805 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -792,7 +792,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -824,7 +824,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
// Paper end // Paper end
public boolean isInWorldBounds(BlockPos pos) { public boolean isInWorldBounds(BlockPos pos) {

Datei anzeigen

@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed. Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e5c44d2b02848aca5dcfc86006ab688598244f16..eee9aa0d82c7446f3d32a9655abceb5279ea5226 100644 index e90199531c6c2975644e1223502bcecb4469220f..aa5c2ccf2a49d0f29c17babcf853b750f0b37a4f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2498,6 +2498,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -2518,6 +2518,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
{ {
if ( iter.next().player == entity ) if ( iter.next().player == entity )
{ {

Datei anzeigen

@ -62,10 +62,10 @@ index bb8e962e63c7a2d931f9bd7f7c002aa35cfa5fd3..0fa131a6c98adb498fc8d534e0e39647
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) { default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
// Paper start - Add predicate for blocks when raytracing // Paper start - Add predicate for blocks when raytracing
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b5f0590e85b00b728f833f7c17ca1c1cf57957cd..6b7f61d0418cc1203726d4bb99ba0a996539b9c4 100644 index 2dcd2f9085de19a91f32f161b89572ec1fbe4805..2809990109e624db95d400aba7a1cc588bc767c2 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -784,10 +784,87 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -816,10 +816,87 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
return null; return null;
} }

Datei anzeigen

@ -17,7 +17,7 @@ Adds villagers as separate config
public net.minecraft.world.entity.Entity isInsidePortal public net.minecraft.world.entity.Entity isInsidePortal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index eee9aa0d82c7446f3d32a9655abceb5279ea5226..a12864921a35a1fb3b6081d72e6505820a6c64f1 100644 index aa5c2ccf2a49d0f29c17babcf853b750f0b37a4f..70fbce91ef8f132fec4ab778f465a948c80d0ce8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -28,7 +28,7 @@ index eee9aa0d82c7446f3d32a9655abceb5279ea5226..a12864921a35a1fb3b6081d72e650582
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
@@ -1196,17 +1195,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1216,17 +1215,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
++TimingHistory.entityTicks; // Paper - timings ++TimingHistory.entityTicks; // Paper - timings
// Spigot start // Spigot start
co.aikar.timings.Timing timer; // Paper co.aikar.timings.Timing timer; // Paper
@ -50,7 +50,7 @@ index eee9aa0d82c7446f3d32a9655abceb5279ea5226..a12864921a35a1fb3b6081d72e650582
try { try {
// Paper end - timings // Paper end - timings
entity.setOldPosAndRot(); entity.setOldPosAndRot();
@@ -1217,9 +1216,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1237,9 +1236,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
}); });
gameprofilerfiller.incrementCounter("tickNonPassenger"); gameprofilerfiller.incrementCounter("tickNonPassenger");
@ -64,7 +64,7 @@ index eee9aa0d82c7446f3d32a9655abceb5279ea5226..a12864921a35a1fb3b6081d72e650582
Iterator iterator = entity.getPassengers().iterator(); Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1227,13 +1230,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1247,13 +1250,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.tickPassenger(entity, entity1); this.tickPassenger(entity, entity1);
} }
@ -84,7 +84,7 @@ index eee9aa0d82c7446f3d32a9655abceb5279ea5226..a12864921a35a1fb3b6081d72e650582
passenger.setOldPosAndRot(); passenger.setOldPosAndRot();
++passenger.tickCount; ++passenger.tickCount;
ProfilerFiller gameprofilerfiller = this.getProfiler(); ProfilerFiller gameprofilerfiller = this.getProfiler();
@@ -1242,8 +1250,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1262,8 +1270,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString(); return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
}); });
gameprofilerfiller.incrementCounter("tickPassenger"); gameprofilerfiller.incrementCounter("tickPassenger");
@ -102,7 +102,7 @@ index eee9aa0d82c7446f3d32a9655abceb5279ea5226..a12864921a35a1fb3b6081d72e650582
gameprofilerfiller.pop(); gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator(); Iterator iterator = passenger.getPassengers().iterator();
@@ -1253,6 +1270,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1273,6 +1290,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.tickPassenger(passenger, entity2); this.tickPassenger(passenger, entity2);
} }
@ -340,7 +340,7 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d
+ +
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0eeae82b1357c339dc0ea69a74ebbd6896c0c3b2..6048b243205a7f856fe5169303a4482723e208f9 100644 index 2809990109e624db95d400aba7a1cc588bc767c2..bd1f7cf95288a15b2a06a93878303b03ac603e5e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -157,6 +157,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -157,6 +157,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl

Datei anzeigen

@ -1104,10 +1104,10 @@ index 183b2191fa1c1b27adedf39593e1b5a223fb1279..8ead66c134688b11dca15f6509147e72
private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) { private ClientboundLevelChunkWithLightPacket(RegistryFriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a12864921a35a1fb3b6081d72e6505820a6c64f1..8a3f58e6dfdb0af767be334087748f93c06ec797 100644 index 70fbce91ef8f132fec4ab778f465a948c80d0ce8..b1e96f74ca3c9607795044e5fc746d9465310fdb 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -524,7 +524,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -515,7 +515,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
@ -1168,7 +1168,7 @@ index 9b1a6d8351fb473eec75a2fd08fb892b770e3586..0d0b07c9199be9ca0d5ac3feb1d44f14
} }
// Paper end - Send empty chunk // Paper end - Send empty chunk
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 11fa27f6fdf763f589fba46337a144f7bb02adb8..070071096d30d368c25e748834f2b695a93903d2 100644 index bd1f7cf95288a15b2a06a93878303b03ac603e5e..d077b7be012af2092caa6fe9c56f4ac712d27874 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -172,6 +172,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -172,6 +172,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@ -1179,16 +1179,16 @@ index 11fa27f6fdf763f589fba46337a144f7bb02adb8..070071096d30d368c25e748834f2b695
public final co.aikar.timings.WorldTimingsHandler timings; // Paper public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter entityLimiter;
@@ -651,7 +652,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -683,7 +684,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
} }
// Paper end - optimise collisions // Paper end - optimise random ticking
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config - protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray + protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
this.generator = gen; this.generator = gen;
@@ -738,6 +739,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -770,6 +771,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
this.minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection(this); this.minSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMinSection(this);
this.maxSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMaxSection(this); this.maxSection = ca.spottedleaf.moonrise.common.util.WorldUtil.getMaxSection(this);
// Paper end - optimise collisions // Paper end - optimise collisions
@ -1196,7 +1196,7 @@ index 11fa27f6fdf763f589fba46337a144f7bb02adb8..070071096d30d368c25e748834f2b695
} }
// Paper start - Cancel hit for vanished players // Paper start - Cancel hit for vanished players
@@ -1015,6 +1017,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -1047,6 +1049,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
// CraftBukkit end // CraftBukkit end
BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag
@ -1244,10 +1244,10 @@ index 214bb6759d2670042d87b2fd0aae41df600a95ee..d4429eedd9164d4b7c367345a8c662a1
this.level = (ServerLevel) world; // CraftBukkit - type this.level = (ServerLevel) world; // CraftBukkit - type
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap(); this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap();
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index 1f767bb9342611a66c1be79ee23df39a4cad1102..d4bd71f70f80ea74947e6d478ff636be2ab7d432 100644 index d7b8d984122ba6b6ef5a0be6e012a8828a1af22d..c3b1caa352b988ec44fa2b2eb0536517711f5460 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -42,9 +42,12 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.collis @@ -55,9 +55,12 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
this.recalcBlockCounts(); this.recalcBlockCounts();
} }
@ -1263,7 +1263,7 @@ index 1f767bb9342611a66c1be79ee23df39a4cad1102..d4bd71f70f80ea74947e6d478ff636be
} }
public BlockState getBlockState(int x, int y, int z) { public BlockState getBlockState(int x, int y, int z) {
@@ -209,10 +212,13 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.collis @@ -236,10 +239,13 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
this.biomes = datapaletteblock; this.biomes = datapaletteblock;
} }

Datei anzeigen

@ -2009,7 +2009,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8a3f58e6dfdb0af767be334087748f93c06ec797..7ba34da235ea536b929e1c8bc2cc39e48b33f5aa 100644 index b1e96f74ca3c9607795044e5fc746d9465310fdb..2a08dfbda588bd6282d78b35bf33a0802b178a70 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@ -2020,7 +2020,7 @@ index 8a3f58e6dfdb0af767be334087748f93c06ec797..7ba34da235ea536b929e1c8bc2cc39e4
public LevelChunk getChunkIfLoaded(int x, int z) { public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
@@ -2429,6 +2430,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -2449,6 +2450,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return crashreportsystemdetails; return crashreportsystemdetails;
} }
@ -2035,10 +2035,10 @@ index 8a3f58e6dfdb0af767be334087748f93c06ec797..7ba34da235ea536b929e1c8bc2cc39e4
EntityCallbacks() {} EntityCallbacks() {}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 070071096d30d368c25e748834f2b695a93903d2..260ce9660346774bda4c93da17596b968fdc1611 100644 index d077b7be012af2092caa6fe9c56f4ac712d27874..20a7971b75ee39bceedf7670a5c600fd014db4cb 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1981,4 +1981,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -2013,4 +2013,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
} }
} }
// Paper end - notify observers even if grow failed // Paper end - notify observers even if grow failed

Datei anzeigen

@ -287,10 +287,10 @@ index 2510589400b3012b827efcab477c6483d9d55901..43487a9ee202c5b0e5a416519939111f
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 260ce9660346774bda4c93da17596b968fdc1611..a72a189f537e0a64c2c31e7eefbb49fa896a6f3c 100644 index 20a7971b75ee39bceedf7670a5c600fd014db4cb..bbb0d543197001fe8bb5179dde7201327fec4274 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1387,6 +1387,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -1419,6 +1419,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
try { try {
tickConsumer.accept(entity); tickConsumer.accept(entity);
} catch (Throwable throwable) { } catch (Throwable throwable) {

Datei anzeigen

@ -28,10 +28,10 @@ index 330bee331335454a61cf8350a6654217c8124445..54e581db732c3a104142a2bbc228ecbe
this.profiler.push(() -> { this.profiler.push(() -> {
String s = String.valueOf(worldserver); String s = String.valueOf(worldserver);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 7ba34da235ea536b929e1c8bc2cc39e48b33f5aa..dafc35584d86ed1c18e4f328cb92523952664f73 100644 index 2a08dfbda588bd6282d78b35bf33a0802b178a70..9c9107add605c09445cf795f4c850b080b4f995d 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -518,6 +518,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -509,6 +509,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return this.nearbyPlayers; return this.nearbyPlayers;
} }
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
@ -63,7 +63,7 @@ index 24b1715397ba8e6f5e9841a030d0e3d964356f89..cc01ead133cc6859ca5d7a1d0ac3c129
if (this.hasDelayedDestroy) { if (this.hasDelayedDestroy) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 909accac7538e1c0c0c51deb2ee0605697c059d0..4c4050fe8f3b788481350caeb2077fa91be12060 100644 index d6699caad1909857793e34228cff78dd3b8b6f41..fe435d4a387bb28be6831cec0c8bb0a7c8b603a4 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3900,6 +3900,10 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3900,6 +3900,10 @@ public abstract class LivingEntity extends Entity implements Attackable {

Datei anzeigen

@ -76,10 +76,10 @@ index d0d36a57ec4896bcb74970f8fb24d8f3e17db133..e2c24813f59c2fd075c740ac1842a38f
}); });
throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index dafc35584d86ed1c18e4f328cb92523952664f73..9456047974db6de9ed38265d5d1ab822225c484f 100644 index 9c9107add605c09445cf795f4c850b080b4f995d..4b601c066b94fddd7d878677098bca0d3ae2e5a3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1203,7 +1203,26 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1223,7 +1223,26 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
} }
@ -106,7 +106,7 @@ index dafc35584d86ed1c18e4f328cb92523952664f73..9456047974db6de9ed38265d5d1ab822
++TimingHistory.entityTicks; // Paper - timings ++TimingHistory.entityTicks; // Paper - timings
// Spigot start // Spigot start
co.aikar.timings.Timing timer; // Paper co.aikar.timings.Timing timer; // Paper
@@ -1243,7 +1262,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1263,7 +1282,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.tickPassenger(entity, entity1); this.tickPassenger(entity, entity1);
} }
// } finally { timer.stopTiming(); } // Paper - timings - move up // } finally { timer.stopTiming(); } // Paper - timings - move up

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Write SavedData IO async
Co-Authored-By: Shane Freeder <theboyetronic@gmail.com> Co-Authored-By: Shane Freeder <theboyetronic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 64ed296cfbe7e5d27286b8cee70454fd1d99ebb0..36fbbf45ae064a345bf4aafbb9ac527197326eb9 100644 index 61e222fb129c5733411ce95aaa5f035dbd95b01a..3575fe6f57457ab865a29d20836512f6f5a98115 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -370,6 +370,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @@ -370,6 +370,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@ -24,10 +24,10 @@ index 64ed296cfbe7e5d27286b8cee70454fd1d99ebb0..36fbbf45ae064a345bf4aafbb9ac5271
// CraftBukkit start - modelled on below // CraftBukkit start - modelled on below
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9456047974db6de9ed38265d5d1ab822225c484f..4e5fc39f3839d4d626925bcef1c83415376195f4 100644 index 4b601c066b94fddd7d878677098bca0d3ae2e5a3..db40701c22d7526b696d503df1e198a70f5beaa9 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1334,7 +1334,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1354,7 +1354,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
} }
@ -36,7 +36,7 @@ index 9456047974db6de9ed38265d5d1ab822225c484f..4e5fc39f3839d4d626925bcef1c83415
if (progressListener != null) { if (progressListener != null) {
progressListener.progressStage(Component.translatable("menu.savingChunks")); progressListener.progressStage(Component.translatable("menu.savingChunks"));
} }
@@ -1365,12 +1365,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. @@ -1385,12 +1385,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
// CraftBukkit end // CraftBukkit end
} }