mirror of
https://github.com/SparklyPower/SparklyPaper.git
synced 2025-12-19 15:09:27 +00:00
Update upstream
This commit is contained in:
@@ -5,7 +5,7 @@ Subject: [PATCH] new fork who dis - Rebrand to SparklyPaper and Build Changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..b2e2eb5d6e3e63d13e8c4ca1ea0ebf16735555e7 100644
|
||||
index 58da26ad2f128ba0b66f86820f60853f4be352f0..f2c2d7af8d3647879702c27e8a0ee62e76afd6e7 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -3,6 +3,8 @@ import io.papermc.paperweight.util.*
|
||||
@@ -17,10 +17,10 @@ index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..b2e2eb5d6e3e63d13e8c4ca1ea0ebf16
|
||||
id("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
@@ -27,8 +29,15 @@ repositories {
|
||||
@@ -13,8 +15,15 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
extraRuntime(platform("net.kyori:adventure-bom:4.15.0-SNAPSHOT"))
|
||||
- implementation(project(":paper-api"))
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ // SparklyPaper start
|
||||
@@ -35,7 +35,7 @@ index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..b2e2eb5d6e3e63d13e8c4ca1ea0ebf16
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -78,13 +87,18 @@ tasks.jar {
|
||||
@@ -64,13 +73,18 @@ tasks.jar {
|
||||
manifest {
|
||||
val git = Git(rootProject.layout.projectDirectory.path)
|
||||
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||
@@ -56,7 +56,7 @@ index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..b2e2eb5d6e3e63d13e8c4ca1ea0ebf16
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -168,7 +182,7 @@ fun TaskContainer.registerRunTask(
|
||||
@@ -154,7 +168,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
|
||||
@@ -14,10 +14,10 @@ This seems stupid, but it does seem that it improves the performance a bit, and
|
||||
We also create a "canSee" method tailored for "ChunkMap#updatePlayer()", a method without the equals check (the "updatePlayer()" already checks if the entity is the same entity) because the CraftPlayer's `equals()` check is a *bit* expensive compared to only checking the object's identity, and because the identity has already been check, we don't need to check it twice.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index caa73632aee15583c6b6ed12a668c8f49b794708..fa4c8a52a57775ef8f23e48e57b76ff7abc370c0 100644
|
||||
index d9cd497bc1b654030ff1a597f038b6a881df9f6b..5c70baf0113004e5c5cbc2fd6a6d34c75cf65217 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1436,7 +1436,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1435,7 +1435,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - check Y
|
||||
|
||||
// CraftBukkit start - respect vanish API
|
||||
@@ -27,7 +27,7 @@ index caa73632aee15583c6b6ed12a668c8f49b794708..fa4c8a52a57775ef8f23e48e57b76ff7
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 3be5e4df190bff0087c8450b16e4e37b07169040..960cc85150172eae9ba1eb1b6876ea8d21f2de34 100644
|
||||
index c54df6e4aed9b7b46a41af4108a8e90d96c1fe1f..c856311f0f50d6e097b9acf27a630cae9fd855ba 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -181,7 +181,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrPowerGamerBR <git@mrpowergamerbr.com>
|
||||
Date: Sun, 26 Nov 2023 12:52:34 -0300
|
||||
Date: Tue, 26 Dec 2023 16:45:54 -0300
|
||||
Subject: [PATCH] Revert "Fix MC-117075: TE Unload Lag Spike"
|
||||
|
||||
This reverts commit 188c1c5b77133f7c3da9c67a97432d79d50d2b34.
|
||||
This reverts commit f5e3e154a00754c18d557401cfb8d4aad5bc45e9.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index f5e3c87581cbdc762806ad4412b68d3c84612b88..0740a7e90c8b7947448990cd9e76328d7d4a7e95 100644
|
||||
index fdb86e3bcd48c9a27ca91e105bcd035de5781923..ed736827a7741a54e3a712cf5fcd19195aebaee5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1281,8 +1281,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -18,15 +18,7 @@ index f5e3c87581cbdc762806ad4412b68d3c84612b88..0740a7e90c8b7947448990cd9e76328d
|
||||
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
|
||||
@@ -1290,6 +1288,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity == null) {
|
||||
this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
|
||||
tilesThisCycle--;
|
||||
+ this.blockEntityTickers.remove(this.tileTickPosition--);
|
||||
continue;
|
||||
}
|
||||
// Spigot end
|
||||
@@ -1297,7 +1296,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1291,7 +1289,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity.isRemoved()) {
|
||||
// Spigot start
|
||||
tilesThisCycle--;
|
||||
@@ -35,7 +27,7 @@ index f5e3c87581cbdc762806ad4412b68d3c84612b88..0740a7e90c8b7947448990cd9e76328d
|
||||
// Spigot end
|
||||
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
tickingblockentity.tick();
|
||||
@@ -1308,7 +1307,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1302,7 +1300,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end - execute chunk tasks during tick
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ We replaced the `blockEntityTickers` list with a custom list based on fastutil's
|
||||
This is WAY FASTER than using `removeAll` with a list of entries to be removed, because we don't need to calculate the identity of each block entity to be removed, and we can jump directly to where the search should begin, giving a performance boost for small removals (because we don't need to loop thru the entire list to find what element should be removed) and a performance boost for big removals (no need to calculate the identity of each block entity).
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0740a7e90c8b7947448990cd9e76328d7d4a7e95..d9acec6352adf9e7d774cf3ea9486e57fc02ff83 100644
|
||||
index ed736827a7741a54e3a712cf5fcd19195aebaee5..7681bce91247c13c8211ed6fd2a2998b815604f0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -120,7 +120,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -20,16 +20,7 @@ index 0740a7e90c8b7947448990cd9e76328d7d4a7e95..d9acec6352adf9e7d774cf3ea9486e57
|
||||
protected final NeighborUpdater neighborUpdater;
|
||||
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
|
||||
private boolean tickingBlockEntities;
|
||||
@@ -1288,7 +1288,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity == null) {
|
||||
this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
|
||||
tilesThisCycle--;
|
||||
- this.blockEntityTickers.remove(this.tileTickPosition--);
|
||||
+ this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // this.blockEntityTickers.remove(this.tileTickPosition--); // SparklyPaper - optimize block entity removals
|
||||
continue;
|
||||
}
|
||||
// Spigot end
|
||||
@@ -1296,7 +1296,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1289,7 +1289,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (tickingblockentity.isRemoved()) {
|
||||
// Spigot start
|
||||
tilesThisCycle--;
|
||||
@@ -38,7 +29,7 @@ index 0740a7e90c8b7947448990cd9e76328d7d4a7e95..d9acec6352adf9e7d774cf3ea9486e57
|
||||
// Spigot end
|
||||
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
tickingblockentity.tick();
|
||||
@@ -1307,7 +1307,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1300,7 +1300,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Paper end - execute chunk tasks during tick
|
||||
}
|
||||
}
|
||||
@@ -153,3 +144,109 @@ index 0000000000000000000000000000000000000000..7affec7e343c39a83390ae13ce23f3bf
|
||||
+ size = j;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/kotlin/net/sparklypower/sparklypaper/BlockEntityTickersList.java b/src/main/kotlin/net/sparklypower/sparklypaper/BlockEntityTickersList.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7affec7e343c39a83390ae13ce23f3bfa0db1eb6
|
||||
--- /dev/null
|
||||
+++ b/src/main/kotlin/net/sparklypower/sparklypaper/BlockEntityTickersList.java
|
||||
@@ -0,0 +1,100 @@
|
||||
+package net.sparklypower.sparklypaper;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
+import net.minecraft.world.level.block.entity.TickingBlockEntity;
|
||||
+
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collection;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+
|
||||
+/**
|
||||
+ * A list for ServerLevel's blockEntityTickers
|
||||
+ *
|
||||
+ * This list is behaves identically to ObjectArrayList, but it has an additional method, `removeAllByIndex`, that allows a list of integers to be passed indicating what
|
||||
+ * indexes should be deleted from the list
|
||||
+ *
|
||||
+ * This is faster than using removeAll, since we don't need to compare the identity of each block entity, and faster than looping thru each index manually and deleting with remove,
|
||||
+ * since we don't need to resize the array every single remove.
|
||||
+ */
|
||||
+public final class BlockEntityTickersList extends ObjectArrayList<TickingBlockEntity> {
|
||||
+ private final IntOpenHashSet toRemove = new IntOpenHashSet();
|
||||
+ private int startSearchFromIndex = -1;
|
||||
+
|
||||
+ /** Creates a new array list with {@link #DEFAULT_INITIAL_CAPACITY} capacity. */
|
||||
+ public BlockEntityTickersList() {
|
||||
+ super();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new array list and fills it with a given collection.
|
||||
+ *
|
||||
+ * @param c a collection that will be used to fill the array list.
|
||||
+ */
|
||||
+ public BlockEntityTickersList(final Collection<? extends TickingBlockEntity> c) {
|
||||
+ super(c);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Marks an entry as removed
|
||||
+ *
|
||||
+ * @param index the index of the item on the list to be marked as removed
|
||||
+ */
|
||||
+ public void markAsRemoved(final int index) {
|
||||
+ // The block entities list always loop starting from 0, so we only need to check if the startSearchFromIndex is -1 and that's it
|
||||
+ if (this.startSearchFromIndex == -1)
|
||||
+ this.startSearchFromIndex = index;
|
||||
+ this.toRemove.add(index);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Removes elements that have been marked as removed.
|
||||
+ */
|
||||
+ public void removeMarkedEntries() {
|
||||
+ if (this.startSearchFromIndex == -1) // No entries in the list, skip
|
||||
+ return;
|
||||
+
|
||||
+ removeAllByIndex(startSearchFromIndex, toRemove);
|
||||
+ toRemove.clear();
|
||||
+ this.startSearchFromIndex = -1; // Reset the start search index
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Removes elements by their index.
|
||||
+ */
|
||||
+ private void removeAllByIndex(final int startSearchFromIndex, final IntOpenHashSet c) { // can't use Set<Integer> because we want to avoid autoboxing when using contains
|
||||
+ final int requiredMatches = c.size();
|
||||
+ if (requiredMatches == 0)
|
||||
+ return; // exit early, we don't need to do anything
|
||||
+
|
||||
+ final Object[] a = this.a;
|
||||
+ int j = startSearchFromIndex;
|
||||
+ int matches = 0;
|
||||
+ for (int i = startSearchFromIndex; i < size; i++) { // If the user knows the first index to be removed, we can skip a lot of unnecessary comparsions
|
||||
+ if (!c.contains(i)) {
|
||||
+ // TODO: It can be possible to optimize this loop by tracking the start/finish and then using arraycopy to "skip" the elements,
|
||||
+ // this would optimize cases where the index to be removed are far apart, HOWEVER it does have a big performance impact if you are doing
|
||||
+ // "arraycopy" for each element
|
||||
+ a[j++] = a[i];
|
||||
+ } else {
|
||||
+ matches++;
|
||||
+ }
|
||||
+
|
||||
+ if (matches == requiredMatches) { // Exit the loop if we already removed everything, we don't need to check anything else
|
||||
+ // We need to update the final size here, because we know that we already found everything!
|
||||
+ // Because we know that the size must be currentSize - requiredMatches (because we have matched everything), let's update the value
|
||||
+ // However, we need to copy the rest of the stuff over
|
||||
+ if (i != (size - 1)) { // If it isn't the last index...
|
||||
+ // i + 1 because we want to copy the *next* element over
|
||||
+ // and the size - i - 1 is because we want to get the current size, minus the current index (which is i), and then - 1 because we want to copy -1 ahead (remember, we are adding +1 to copy the *next* element)
|
||||
+ System.arraycopy(a, i + 1, a, j, size - i - 1);
|
||||
+ }
|
||||
+ j = size - requiredMatches;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ Arrays.fill(a, j, size, null);
|
||||
+ size = j;
|
||||
+ }
|
||||
+}
|
||||
|
||||
@@ -12,7 +12,7 @@ But here's the thing: We don't care if we have a small performance penalty if th
|
||||
And finally, we also cache the chunk's coordinate key when creating the block entity, which is actually "free" because we just reuse the already cached chunk coordinate key from the chunk!
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index d9acec6352adf9e7d774cf3ea9486e57fc02ff83..4c0aa4b4c79562d43df9fc07a56731056f6a2348 100644
|
||||
index 7681bce91247c13c8211ed6fd2a2998b815604f0..608259c6092f5353e818b5fbeb0e1a5249ed136b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1281,6 +1281,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -26,7 +26,7 @@ index d9acec6352adf9e7d774cf3ea9486e57fc02ff83..4c0aa4b4c79562d43df9fc07a5673105
|
||||
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
|
||||
TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
|
||||
@@ -1298,13 +1302,25 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1291,13 +1295,25 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
tilesThisCycle--;
|
||||
this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // this.blockEntityTickers.remove(this.tileTickPosition--); // SparklyPaper - optimize block entity removals
|
||||
// Spigot end
|
||||
|
||||
@@ -922,7 +922,7 @@ index 094a6ddebf79aa49b3e3cd8a032db7b8d23607c4..e640ad5dd3f1caab04a8a99f967ef20b
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index d1f20a8a3ccea1f074624163eb96da023142a459..0b1ff85ab00ea11182986c503873df612a99aacf 100644
|
||||
index 0eb3384df396508c3d26d1e155cd0e6d64251346..548bbf8bf3aa128c8b0e24a4f98e0f355fce7f6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -17,6 +17,7 @@ import java.util.OptionalInt;
|
||||
@@ -1299,7 +1299,7 @@ index 9442f58dff89ec843c321533965fbee2727d02f8..ab30f345381e32a1751adbd2344d8f3c
|
||||
continue;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 4c0aa4b4c79562d43df9fc07a56731056f6a2348..0398d5083ac776af5717ae4eab2a5481c2f93be8 100644
|
||||
index 608259c6092f5353e818b5fbeb0e1a5249ed136b..ed07b4a584f4b51b9156ec58a8963436cf229b0f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -15,6 +15,8 @@ import java.util.function.Consumer;
|
||||
@@ -1328,7 +1328,7 @@ index 4c0aa4b4c79562d43df9fc07a56731056f6a2348..0398d5083ac776af5717ae4eab2a5481
|
||||
// CraftBukkit start - tree generation
|
||||
if (this.captureTreeGeneration) {
|
||||
// Paper start
|
||||
@@ -1317,7 +1320,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1310,7 +1313,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
tickingblockentity.tick();
|
||||
// Paper start - execute chunk tasks during tick
|
||||
if ((this.tileTickPosition & 7) == 0) {
|
||||
@@ -1337,7 +1337,7 @@ index 4c0aa4b4c79562d43df9fc07a56731056f6a2348..0398d5083ac776af5717ae4eab2a5481
|
||||
}
|
||||
// Paper end - execute chunk tasks during tick
|
||||
} // SparklyPaper end
|
||||
@@ -1334,7 +1337,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1327,7 +1330,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
|
||||
try {
|
||||
tickConsumer.accept(entity);
|
||||
@@ -1346,7 +1346,7 @@ index 4c0aa4b4c79562d43df9fc07a56731056f6a2348..0398d5083ac776af5717ae4eab2a5481
|
||||
} catch (Throwable throwable) {
|
||||
if (throwable instanceof ThreadDeath) throw throwable; // Paper
|
||||
// Paper start - Prevent tile entity and entity crashes
|
||||
@@ -1441,6 +1444,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1434,6 +1437,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
@Nullable
|
||||
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {
|
||||
@@ -1354,7 +1354,7 @@ index 4c0aa4b4c79562d43df9fc07a56731056f6a2348..0398d5083ac776af5717ae4eab2a5481
|
||||
// Paper start - Optimize capturedTileEntities lookup
|
||||
net.minecraft.world.level.block.entity.BlockEntity blockEntity;
|
||||
if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(blockposition)) != null) {
|
||||
@@ -1448,10 +1452,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1441,10 +1445,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
// Paper end
|
||||
// CraftBukkit end
|
||||
@@ -1367,7 +1367,7 @@ index 4c0aa4b4c79562d43df9fc07a56731056f6a2348..0398d5083ac776af5717ae4eab2a5481
|
||||
BlockPos blockposition = blockEntity.getBlockPos();
|
||||
|
||||
if (!this.isOutsideBuildHeight(blockposition)) {
|
||||
@@ -1537,6 +1542,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1530,6 +1535,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
|
||||
@@ -1375,7 +1375,7 @@ index 4c0aa4b4c79562d43df9fc07a56731056f6a2348..0398d5083ac776af5717ae4eab2a5481
|
||||
this.getProfiler().incrementCounter("getEntities");
|
||||
List<Entity> list = Lists.newArrayList();
|
||||
((ServerLevel)this).getEntityLookup().getEntities(except, box, list, predicate); // Paper - optimise this call
|
||||
@@ -1803,8 +1809,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1796,8 +1802,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
public final BlockPos.MutableBlockPos getRandomBlockPosition(int x, int y, int z, int l, BlockPos.MutableBlockPos out) {
|
||||
// Paper end
|
||||
@@ -1727,10 +1727,10 @@ index 4cdfc433df67afcd455422e9baf56f167dd712ae..f52b3740bd48f8527a36d48a0454e7d6
|
||||
// To ensure nothing weird happens with dimension travelling, do not iterate over new entries...
|
||||
// (by dfl iterator() is configured to not iterate over new entries)
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf5545666cf5e 100644
|
||||
index 03eab4e7c2648c722c25387ec9353e8dafc09618..c78f1d934d0209ee01303835be7c3287609754fc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -435,7 +435,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -434,7 +434,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
}
|
||||
|
||||
private boolean unloadChunk0(int x, int z, boolean save) {
|
||||
@@ -1739,7 +1739,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
if (!this.isChunkLoaded(x, z)) {
|
||||
return true;
|
||||
}
|
||||
@@ -450,7 +450,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -449,7 +449,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public boolean regenerateChunk(int x, int z) {
|
||||
@@ -1748,7 +1748,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
warnUnsafeChunk("regenerating a faraway chunk", x, z); // Paper
|
||||
// Paper start - implement regenerateChunk method
|
||||
final ServerLevel serverLevel = this.world;
|
||||
@@ -511,6 +511,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -510,6 +510,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public boolean refreshChunk(int x, int z) {
|
||||
@@ -1756,7 +1756,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
|
||||
if (playerChunk == null) return false;
|
||||
|
||||
@@ -546,7 +547,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -545,7 +546,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public boolean loadChunk(int x, int z, boolean generate) {
|
||||
@@ -1765,7 +1765,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
warnUnsafeChunk("loading a faraway chunk", x, z); // Paper
|
||||
// Paper start - Optimize this method
|
||||
ChunkPos chunkPos = new ChunkPos(x, z);
|
||||
@@ -809,6 +810,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -808,6 +809,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
|
||||
@@ -1773,7 +1773,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
this.world.captureTreeGeneration = true;
|
||||
this.world.captureBlockStates = true;
|
||||
boolean grownTree = this.generateTree(loc, type);
|
||||
@@ -919,11 +921,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -918,11 +920,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
|
||||
@@ -1787,7 +1787,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled;
|
||||
}
|
||||
// Paper end
|
||||
@@ -993,6 +997,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -992,6 +996,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
|
||||
@@ -1795,7 +1795,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper
|
||||
// Transient load for this tick
|
||||
return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
|
||||
@@ -1023,6 +1028,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1022,6 +1027,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@Override
|
||||
public void setBiome(int x, int y, int z, Holder<net.minecraft.world.level.biome.Biome> bb) {
|
||||
BlockPos pos = new BlockPos(x, 0, z);
|
||||
@@ -1803,7 +1803,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
if (this.world.hasChunkAt(pos)) {
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkAt(pos);
|
||||
|
||||
@@ -2311,6 +2317,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -2359,6 +2365,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
|
||||
@@ -1811,7 +1811,7 @@ index e1fad381b861471a17529c246bb8a4a9c7646420..7075cd07d93f0f70a96d0cc3d54bf554
|
||||
getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.get(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
|
||||
}
|
||||
// Paper end
|
||||
@@ -2465,7 +2472,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -2462,7 +2469,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
// Paper start
|
||||
public java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
|
||||
warnUnsafeChunk("getting a faraway chunk async", x, z); // Paper
|
||||
|
||||
Reference in New Issue
Block a user