mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
Updated Upstream (Paper & Tuinity)
Upstream has released updates that appear to apply and compile correctly Paper Changes: 3dbb8926e Fix PotionSplashEvent for water splash potions (#5697) b759d006e Adds per-world spawn limits (#4837) 81de619d3 Updated Upstream (CraftBukkit) (#5786) 5e3604f1b Better fix for invulnerable crystals and improve Origin API (#5761) d5fe9c817 Updated Upstream (CraftBukkit) (#5784) Tuinity Changes: df76b3cc5 Update Upstream (Paper)
This commit is contained in:
@@ -5659,10 +5659,10 @@ index 0000000000000000000000000000000000000000..0e4442a94559346b19a536d35ce5def6
|
||||
+}
|
||||
diff --git a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e1dc7c1025e19f7393a45719af8fe7aae016184d
|
||||
index 0000000000000000000000000000000000000000..414c8de2bcc10165e2d328a5746899ac087698b4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
|
||||
@@ -0,0 +1,415 @@
|
||||
@@ -0,0 +1,398 @@
|
||||
+package com.tuinity.tuinity.config;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
@@ -5789,7 +5789,7 @@ index 0000000000000000000000000000000000000000..e1dc7c1025e19f7393a45719af8fe7aa
|
||||
+ tickWorldsInParallel = TuinityConfig.getBoolean("tick-worlds-in-parallel", false);
|
||||
+ tickThreads = TuinityConfig.getInt("server-tick-threads", 1); // will be 4 in the future
|
||||
+ }*/
|
||||
+
|
||||
+
|
||||
+ public static int delayChunkUnloadsBy;
|
||||
+
|
||||
+ private static void delayChunkUnloadsBy() {
|
||||
@@ -6058,23 +6058,6 @@ index 0000000000000000000000000000000000000000..e1dc7c1025e19f7393a45719af8fe7aa
|
||||
+ final int threads = this.getInt("tick-threads", -1);
|
||||
+ this.threads = threads == -1 ? TuinityConfig.tickThreads : threads;
|
||||
+ }*/
|
||||
+
|
||||
+ public int spawnLimitMonsters;
|
||||
+ public int spawnLimitAnimals;
|
||||
+ public int spawnLimitWaterAmbient;
|
||||
+ public int spawnLimitWaterAnimals;
|
||||
+ public int spawnLimitAmbient;
|
||||
+
|
||||
+ private void perWorldSpawnLimit() {
|
||||
+ final String path = "spawn-limits";
|
||||
+
|
||||
+ this.spawnLimitMonsters = this.getInt(path + ".monsters", -1);
|
||||
+ this.spawnLimitAnimals = this.getInt(path + ".animals", -1);
|
||||
+ this.spawnLimitWaterAmbient = this.getInt(path + ".water-ambient", -1);
|
||||
+ this.spawnLimitWaterAnimals = this.getInt(path + ".water-animals", -1);
|
||||
+ this.spawnLimitAmbient = this.getInt(path + ".ambient", -1);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
@@ -11627,7 +11610,7 @@ index 3644e8b24b082e17752ef52934625416130aaa08..58e14c174cdf76cdea861fd3d4d1195f
|
||||
class b extends ChunkMap {
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
|
||||
index 4a71f9a8a57ed123b31c725a8bd5f94ab0e2174d..e0ffea4f5d45a402d4ff5b4b831f2663f9d73eeb 100644
|
||||
index 4a71f9a8a57ed123b31c725a8bd5f94ab0e2174d..1b86c032fde3409cb89b849b9ba094af82cd9269 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
|
||||
@@ -47,6 +47,12 @@ import net.minecraft.world.level.storage.WorldData;
|
||||
@@ -11931,7 +11914,7 @@ index 4a71f9a8a57ed123b31c725a8bd5f94ab0e2174d..e0ffea4f5d45a402d4ff5b4b831f2663
|
||||
this.world.timings.doChunkUnload.stopTiming(); // Spigot
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.clearCache();
|
||||
@@ -834,32 +1017,37 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -834,32 +1017,38 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
for (EntityPlayer player : this.world.players) {
|
||||
Arrays.fill(player.mobCounts, 0);
|
||||
}
|
||||
@@ -11951,7 +11934,7 @@ index 4a71f9a8a57ed123b31c725a8bd5f94ab0e2174d..e0ffea4f5d45a402d4ff5b4b831f2663
|
||||
//List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper
|
||||
//Collections.shuffle(list); // Paper
|
||||
// Paper - moved up
|
||||
- this.world.timings.chunkTicks.startTiming(); // Paper
|
||||
this.world.timings.chunkTicks.startTiming(); // Paper
|
||||
- final int[] chunksTicked = {0}; this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping
|
||||
- Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
|
||||
-
|
||||
@@ -11980,7 +11963,7 @@ index 4a71f9a8a57ed123b31c725a8bd5f94ab0e2174d..e0ffea4f5d45a402d4ff5b4b831f2663
|
||||
ChunkCoordIntPair chunkcoordintpair = playerchunk.i();
|
||||
|
||||
if (!this.playerChunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, false)) { // Paper - optimise isOutsideOfRange
|
||||
@@ -871,12 +1059,15 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -871,11 +1060,15 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
//this.world.timings.chunkTicks.startTiming(); // Spigot // Paper
|
||||
this.world.a(chunk, k);
|
||||
//this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper
|
||||
@@ -11990,16 +11973,15 @@ index 4a71f9a8a57ed123b31c725a8bd5f94ab0e2174d..e0ffea4f5d45a402d4ff5b4b831f2663
|
||||
}
|
||||
}
|
||||
- });
|
||||
- this.world.timings.chunkTicks.stopTiming(); // Paper
|
||||
+ } // Tuinity start - optimise chunk tick iteration
|
||||
+ } finally {
|
||||
+ iterator.finishedIterating();
|
||||
+ }
|
||||
+ // Tuinity end - optimise chunk tick iteration
|
||||
this.world.timings.chunkTicks.stopTiming(); // Paper
|
||||
this.world.getMethodProfiler().enter("customSpawners");
|
||||
if (flag1) {
|
||||
try (co.aikar.timings.Timing ignored = this.world.timings.miscMobSpawning.startTiming()) { // Paper - timings
|
||||
@@ -888,7 +1079,25 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -888,7 +1081,25 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.getMethodProfiler().exit();
|
||||
}
|
||||
|
||||
@@ -12025,7 +12007,7 @@ index 4a71f9a8a57ed123b31c725a8bd5f94ab0e2174d..e0ffea4f5d45a402d4ff5b4b831f2663
|
||||
}
|
||||
|
||||
private void a(long i, Consumer<Chunk> consumer) {
|
||||
@@ -1028,44 +1237,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -1028,44 +1239,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
ChunkProviderServer.this.world.getMethodProfiler().c("runTask");
|
||||
super.executeTask(runnable);
|
||||
}
|
||||
@@ -15372,7 +15354,7 @@ index dca2e9e45116df22d8c95d1be8f0a7e3c2d2b6b1..cb394ec310712cc97d65afe068284b27
|
||||
|
||||
try {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c340672dc816c8 100644
|
||||
index 6e1304f7169c11f67c573b2c8dc11825bcc7da0d..89852779fd9cfd19058afe40feb0cf14ca8d2896 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -228,7 +228,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
@@ -15399,7 +15381,7 @@ index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c34067
|
||||
// Paper start - optimise entity tracking
|
||||
final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this);
|
||||
|
||||
@@ -309,11 +317,59 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
@@ -309,8 +317,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> getPlayersInTrackRange() {
|
||||
@@ -15423,6 +15405,10 @@ index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c34067
|
||||
}
|
||||
// Paper end - optimise entity tracking
|
||||
|
||||
@@ -345,6 +366,41 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
// Paper end - make end portalling safe
|
||||
|
||||
+ // Tuinity start
|
||||
+ /**
|
||||
+ * Overriding this field will cause memory leaks.
|
||||
@@ -15458,9 +15444,9 @@ index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c34067
|
||||
+ }
|
||||
+ // Tuinity end
|
||||
+
|
||||
// Paper start - make end portalling safe
|
||||
public BlockPosition portalBlock;
|
||||
public WorldServer portalWorld;
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.entityCount.incrementAndGet();
|
||||
this.passengers = Lists.newArrayList();
|
||||
@@ -714,7 +770,39 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
return this.onGround;
|
||||
}
|
||||
@@ -15750,7 +15736,7 @@ index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c34067
|
||||
public double h(Entity entity) {
|
||||
return this.e(entity.getPositionVector());
|
||||
}
|
||||
@@ -2068,9 +2313,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
@@ -2073,9 +2318,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
float f1 = this.size.width * 0.8F;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.g((double) f1, 0.10000000149011612D, (double) f1).d(this.locX(), this.getHeadY(), this.locZ());
|
||||
|
||||
@@ -15762,7 +15748,7 @@ index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c34067
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2078,11 +2323,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
@@ -2083,11 +2328,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
return EnumInteractionResult.PASS;
|
||||
}
|
||||
|
||||
@@ -15778,7 +15764,7 @@ index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c34067
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2974,7 +3221,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
@@ -2979,7 +3226,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
this.recursiveStream().forEach((entity) -> {
|
||||
worldserver.chunkCheck(entity);
|
||||
entity.az = true;
|
||||
@@ -15787,7 +15773,7 @@ index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c34067
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
@@ -3432,12 +3679,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
@@ -3437,12 +3684,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
return this.locBlock;
|
||||
}
|
||||
|
||||
@@ -15804,7 +15790,7 @@ index 8ef41182056052686055b7eb88ab19c161e84ed4..d88769e13410c6469df1d118b5c34067
|
||||
}
|
||||
|
||||
public void setMot(double d0, double d1, double d2) {
|
||||
@@ -3492,7 +3743,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
@@ -3497,7 +3748,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
// Paper end
|
||||
if (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2) {
|
||||
@@ -20653,7 +20639,7 @@ index cebecee640ed5a7fc2b978e00ff7eb012228267d..507c5255542ba1b958470b4db2c35b1b
|
||||
public void restart() {
|
||||
org.spigotmc.RestartCommand.restart();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 02198dbe9e80c2990e8a09b2b763748dae727a03..3b6b1f3229b07c84d99db652e01661bcc78368fd 100644
|
||||
index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb27831c008842 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -298,7 +298,7 @@ public class CraftWorld implements World {
|
||||
@@ -20674,22 +20660,7 @@ index 02198dbe9e80c2990e8a09b2b763748dae727a03..3b6b1f3229b07c84d99db652e01661bc
|
||||
if (chunkHolder.getChunk() != null) {
|
||||
++ret;
|
||||
}
|
||||
@@ -353,6 +353,14 @@ public class CraftWorld implements World {
|
||||
this.generator = gen;
|
||||
|
||||
environment = env;
|
||||
+
|
||||
+ //Tuinity start - per world spawn limits
|
||||
+ monsterSpawn = world.tuinityConfig.spawnLimitMonsters;
|
||||
+ animalSpawn = world.tuinityConfig.spawnLimitAnimals;
|
||||
+ waterAmbientSpawn = world.tuinityConfig.spawnLimitWaterAmbient;
|
||||
+ waterAnimalSpawn = world.tuinityConfig.spawnLimitWaterAnimals;
|
||||
+ ambientSpawn = world.tuinityConfig.spawnLimitAmbient;
|
||||
+ //Tuinity end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -426,14 +434,7 @@ public class CraftWorld implements World {
|
||||
@@ -433,14 +433,7 @@ public class CraftWorld implements World {
|
||||
|
||||
@Override
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
@@ -20705,7 +20676,7 @@ index 02198dbe9e80c2990e8a09b2b763748dae727a03..3b6b1f3229b07c84d99db652e01661bc
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -481,13 +482,16 @@ public class CraftWorld implements World {
|
||||
@@ -488,13 +481,16 @@ public class CraftWorld implements World {
|
||||
public Chunk[] getLoadedChunks() {
|
||||
// Paper start
|
||||
if (Thread.currentThread() != world.getMinecraftWorld().serverThread) {
|
||||
@@ -20726,7 +20697,7 @@ index 02198dbe9e80c2990e8a09b2b763748dae727a03..3b6b1f3229b07c84d99db652e01661bc
|
||||
return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.Chunk::getBukkitChunk).toArray(Chunk[]::new);
|
||||
}
|
||||
|
||||
@@ -516,6 +520,7 @@ public class CraftWorld implements World {
|
||||
@@ -523,6 +519,7 @@ public class CraftWorld implements World {
|
||||
org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot
|
||||
if (isChunkLoaded(x, z)) {
|
||||
world.getChunkProvider().removeTicket(TicketType.PLUGIN, new ChunkCoordIntPair(x, z), 0, Unit.INSTANCE); // Paper
|
||||
@@ -20734,7 +20705,7 @@ index 02198dbe9e80c2990e8a09b2b763748dae727a03..3b6b1f3229b07c84d99db652e01661bc
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -729,6 +734,30 @@ public class CraftWorld implements World {
|
||||
@@ -736,6 +733,30 @@ public class CraftWorld implements World {
|
||||
return ret.entrySet().stream().collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, (entry) -> entry.getValue().build()));
|
||||
}
|
||||
|
||||
@@ -20765,7 +20736,7 @@ index 02198dbe9e80c2990e8a09b2b763748dae727a03..3b6b1f3229b07c84d99db652e01661bc
|
||||
@Override
|
||||
public boolean isChunkForceLoaded(int x, int z) {
|
||||
return getHandle().getForceLoadedChunks().contains(ChunkCoordIntPair.pair(x, z));
|
||||
@@ -2661,7 +2690,7 @@ public class CraftWorld implements World {
|
||||
@@ -2668,7 +2689,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> {
|
||||
net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null);
|
||||
@@ -20774,7 +20745,7 @@ index 02198dbe9e80c2990e8a09b2b763748dae727a03..3b6b1f3229b07c84d99db652e01661bc
|
||||
return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
|
||||
}, net.minecraft.server.MinecraftServer.getServer());
|
||||
}
|
||||
@@ -2686,14 +2715,14 @@ public class CraftWorld implements World {
|
||||
@@ -2693,14 +2714,14 @@ public class CraftWorld implements World {
|
||||
throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]");
|
||||
}
|
||||
PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
|
||||
@@ -20791,7 +20762,7 @@ index 02198dbe9e80c2990e8a09b2b763748dae727a03..3b6b1f3229b07c84d99db652e01661bc
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2702,11 +2731,22 @@ public class CraftWorld implements World {
|
||||
@@ -2709,11 +2730,22 @@ public class CraftWorld implements World {
|
||||
throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]");
|
||||
}
|
||||
PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
|
||||
|
||||
Reference in New Issue
Block a user