|
|
|
|
@@ -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..414c8de2bcc10165e2d328a5746899ac087698b4
|
|
|
|
|
index 0000000000000000000000000000000000000000..79acb3fbca1abc6260d18ee40f7abb9efd14968b
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
|
|
|
|
|
@@ -0,0 +1,398 @@
|
|
|
|
|
@@ -0,0 +1,470 @@
|
|
|
|
|
+package com.tuinity.tuinity.config;
|
|
|
|
|
+
|
|
|
|
|
+import com.destroystokyo.paper.util.SneakyThrow;
|
|
|
|
|
@@ -6011,6 +6011,16 @@ index 0000000000000000000000000000000000000000..414c8de2bcc10165e2d328a5746899ac
|
|
|
|
|
+ return config == null ? this.worldDefaults.getBoolean(path) : config.getBoolean(path, this.worldDefaults.getBoolean(path));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ boolean getBooleanRaw(final String path, final boolean dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ if (TuinityConfig.configVersion < 1) {
|
|
|
|
|
+ if (config != null && config.getBoolean(path) == dfl) {
|
|
|
|
|
+ config.set(path, null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return config == null ? this.worldDefaults.getBoolean(path, dfl) : config.getBoolean(path, this.worldDefaults.getBoolean(path, dfl));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int getInt(final String path, final int dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ this.worldDefaults.addDefault(path, Integer.valueOf(dfl));
|
|
|
|
|
@@ -6022,6 +6032,16 @@ index 0000000000000000000000000000000000000000..414c8de2bcc10165e2d328a5746899ac
|
|
|
|
|
+ return config == null ? this.worldDefaults.getInt(path) : config.getInt(path, this.worldDefaults.getInt(path));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int getIntRaw(final String path, final int dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ if (TuinityConfig.configVersion < 1) {
|
|
|
|
|
+ if (config != null && config.getInt(path) == dfl) {
|
|
|
|
|
+ config.set(path, null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return config == null ? this.worldDefaults.getInt(path, dfl) : config.getInt(path, this.worldDefaults.getInt(path, dfl));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ long getLong(final String path, final long dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ this.worldDefaults.addDefault(path, Long.valueOf(dfl));
|
|
|
|
|
@@ -6033,6 +6053,16 @@ index 0000000000000000000000000000000000000000..414c8de2bcc10165e2d328a5746899ac
|
|
|
|
|
+ return config == null ? this.worldDefaults.getLong(path) : config.getLong(path, this.worldDefaults.getLong(path));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ long getLongRaw(final String path, final long dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ if (TuinityConfig.configVersion < 1) {
|
|
|
|
|
+ if (config != null && config.getLong(path) == dfl) {
|
|
|
|
|
+ config.set(path, null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return config == null ? this.worldDefaults.getLong(path, dfl) : config.getLong(path, this.worldDefaults.getLong(path, dfl));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ double getDouble(final String path, final double dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ this.worldDefaults.addDefault(path, Double.valueOf(dfl));
|
|
|
|
|
@@ -6044,12 +6074,38 @@ index 0000000000000000000000000000000000000000..414c8de2bcc10165e2d328a5746899ac
|
|
|
|
|
+ return config == null ? this.worldDefaults.getDouble(path) : config.getDouble(path, this.worldDefaults.getDouble(path));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ double getDoubleRaw(final String path, final double dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ if (TuinityConfig.configVersion < 1) {
|
|
|
|
|
+ if (config != null && config.getDouble(path) == dfl) {
|
|
|
|
|
+ config.set(path, null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return config == null ? this.worldDefaults.getDouble(path, dfl) : config.getDouble(path, this.worldDefaults.getDouble(path, dfl));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String getString(final String path, final String dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ this.worldDefaults.addDefault(path, dfl);
|
|
|
|
|
+ return config == null ? this.worldDefaults.getString(path) : config.getString(path, this.worldDefaults.getString(path));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String getStringRaw(final String path, final String dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ return config == null ? this.worldDefaults.getString(path, dfl) : config.getString(path, this.worldDefaults.getString(path, dfl));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List getList(final String path, final List dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ this.worldDefaults.addDefault(path, dfl);
|
|
|
|
|
+ return config == null ? this.worldDefaults.getList(path) : config.getList(path, this.worldDefaults.getList(path));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List getListRaw(final String path, final List dfl) {
|
|
|
|
|
+ final ConfigurationSection config = TuinityConfig.config.getConfigurationSection(this.configPath);
|
|
|
|
|
+ return config == null ? this.worldDefaults.getList(path, dfl) : config.getList(path, this.worldDefaults.getList(path, dfl));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** ignored if {@link TuinityConfig#tickWorldsInParallel} == false */
|
|
|
|
|
+ public int threads;
|
|
|
|
|
+
|
|
|
|
|
@@ -6058,6 +6114,22 @@ index 0000000000000000000000000000000000000000..414c8de2bcc10165e2d328a5746899ac
|
|
|
|
|
+ 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.getIntRaw(path + ".monsters", -1);
|
|
|
|
|
+ this.spawnLimitAnimals = this.getIntRaw(path + ".animals", -1);
|
|
|
|
|
+ this.spawnLimitWaterAmbient = this.getIntRaw(path + ".water-ambient", -1);
|
|
|
|
|
+ this.spawnLimitWaterAnimals = this.getIntRaw(path + ".water-animals", -1);
|
|
|
|
|
+ this.spawnLimitAmbient = this.getIntRaw(path + ".ambient", -1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
@@ -17578,6 +17650,50 @@ index 15096a9c2719b8b4c099f62d0a1c808e56b63a8e..9bbd175f7e20591bbefdbddcb5e998e7
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockSoil.java b/src/main/java/net/minecraft/world/level/block/BlockSoil.java
|
|
|
|
|
index 3bedb1c6a0f221c7b40ee0a50f676e8b05bd37a7..ac830ea21e639652908fe82a253853b26b412e4d 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockSoil.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockSoil.java
|
|
|
|
|
@@ -139,19 +139,28 @@ public class BlockSoil extends Block {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean a(IWorldReader iworldreader, BlockPosition blockposition) {
|
|
|
|
|
- Iterator iterator = BlockPosition.a(blockposition.b(-4, 0, -4), blockposition.b(4, 1, 4)).iterator();
|
|
|
|
|
-
|
|
|
|
|
- BlockPosition blockposition1;
|
|
|
|
|
-
|
|
|
|
|
- do {
|
|
|
|
|
- if (!iterator.hasNext()) {
|
|
|
|
|
- return false;
|
|
|
|
|
+ // Tuinity start - remove abstract block iteration
|
|
|
|
|
+ int xOff = blockposition.getX();
|
|
|
|
|
+ int yOff = blockposition.getY();
|
|
|
|
|
+ int zOff = blockposition.getZ();
|
|
|
|
|
+
|
|
|
|
|
+ for (int dz = -4; dz <= 4; ++dz) {
|
|
|
|
|
+ int z = dz + zOff;
|
|
|
|
|
+ for (int dx = -4; dx <= 4; ++dx) {
|
|
|
|
|
+ int x = xOff + dx;
|
|
|
|
|
+ for (int dy = 0; dy <= 1; ++dy) {
|
|
|
|
|
+ int y = dy + yOff;
|
|
|
|
|
+ net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk)iworldreader.getChunkAt(x >> 4, z >> 4);
|
|
|
|
|
+ net.minecraft.world.level.material.Fluid fluid = chunk.getBlockData(x, y, z).getFluid();
|
|
|
|
|
+ if (fluid.isTagged(TagsFluid.WATER)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- blockposition1 = (BlockPosition) iterator.next();
|
|
|
|
|
- } while (!iworldreader.getFluid(blockposition1).a((Tag) TagsFluid.WATER));
|
|
|
|
|
-
|
|
|
|
|
- return true;
|
|
|
|
|
+ return false;
|
|
|
|
|
+ // Tuinity end - remove abstract block iteration
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
|
|
|
|
index 0d26250887f80d0c250bcd6bc7de303362427d3e..1d82f719440c95765c01a588f4785d630b8b527a 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
|
|
|
|
@@ -19846,6 +19962,18 @@ index fc0162e7f543d230277457638f208a66537560d7..3825a3ddea21e7dd14c455daac1a6af5
|
|
|
|
|
|
|
|
|
|
while (objectiterator.hasNext()) {
|
|
|
|
|
entry = (Entry) objectiterator.next();
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/material/Fluid.java b/src/main/java/net/minecraft/world/level/material/Fluid.java
|
|
|
|
|
index 147e628bd562da4cf6f07218724a9d6c79d26e38..1a6120dff8236e83575ed07017844d1bf98b6fda 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/material/Fluid.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/material/Fluid.java
|
|
|
|
|
@@ -72,6 +72,7 @@ public final class Fluid extends IBlockDataHolder<FluidType, Fluid> {
|
|
|
|
|
return this.getType().b(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public final boolean isTagged(Tag<FluidType> tag) { return this.a(tag); } // Tuinity - OBFHELPER
|
|
|
|
|
public boolean a(Tag<FluidType> tag) {
|
|
|
|
|
return this.getType().a(tag);
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathType.java b/src/main/java/net/minecraft/world/level/pathfinder/PathType.java
|
|
|
|
|
index fd20802155097d4951cbe273f64de4809dee5c96..a07612f68f08aaaf75c3c656b6f90886b587d7ee 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathType.java
|
|
|
|
|
@@ -20639,7 +20767,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 c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb27831c008842 100644
|
|
|
|
|
index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..d4ed84e5825e5fb544980a20f0ac4eec48ddd799 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 {
|
|
|
|
|
@@ -20660,7 +20788,33 @@ index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb2783
|
|
|
|
|
if (chunkHolder.getChunk() != null) {
|
|
|
|
|
++ret;
|
|
|
|
|
}
|
|
|
|
|
@@ -433,14 +433,7 @@ public class CraftWorld implements World {
|
|
|
|
|
@@ -353,13 +353,20 @@ public class CraftWorld implements World {
|
|
|
|
|
this.generator = gen;
|
|
|
|
|
|
|
|
|
|
environment = env;
|
|
|
|
|
+ // Tuinity start - per world spawn limits
|
|
|
|
|
+ this.monsterSpawn = world.tuinityConfig.spawnLimitMonsters;
|
|
|
|
|
+ this.animalSpawn = world.tuinityConfig.spawnLimitAnimals;
|
|
|
|
|
+ this.waterAmbientSpawn = world.tuinityConfig.spawnLimitWaterAmbient;
|
|
|
|
|
+ this.waterAnimalSpawn = world.tuinityConfig.spawnLimitWaterAnimals;
|
|
|
|
|
+ this.ambientSpawn = world.tuinityConfig.spawnLimitAmbient;
|
|
|
|
|
// Paper start - per world spawn limits
|
|
|
|
|
- this.monsterSpawn = this.world.paperConfig.spawnLimitMonsters;
|
|
|
|
|
- this.animalSpawn = this.world.paperConfig.spawnLimitAnimals;
|
|
|
|
|
- this.waterAnimalSpawn = this.world.paperConfig.spawnLimitWaterAnimals;
|
|
|
|
|
- this.waterAmbientSpawn = this.world.paperConfig.spawnLimitWaterAmbient;
|
|
|
|
|
- this.ambientSpawn = this.world.paperConfig.spawnLimitAmbient;
|
|
|
|
|
+ if (this.monsterSpawn == -1) this.monsterSpawn = this.world.paperConfig.spawnLimitMonsters;
|
|
|
|
|
+ if (this.animalSpawn == -1) this.animalSpawn = this.world.paperConfig.spawnLimitAnimals;
|
|
|
|
|
+ if (this.waterAnimalSpawn == -1) this.waterAnimalSpawn = this.world.paperConfig.spawnLimitWaterAnimals;
|
|
|
|
|
+ if (this.waterAmbientSpawn == -1) this.waterAmbientSpawn = this.world.paperConfig.spawnLimitWaterAmbient;
|
|
|
|
|
+ if (this.ambientSpawn == -1) this.ambientSpawn = this.world.paperConfig.spawnLimitAmbient;
|
|
|
|
|
// Paper end
|
|
|
|
|
+ // Tuinity end - per world spawn limits
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -433,14 +440,7 @@ public class CraftWorld implements World {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Chunk getChunkAt(int x, int z) {
|
|
|
|
|
@@ -20676,7 +20830,7 @@ index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb2783
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Paper start
|
|
|
|
|
@@ -488,13 +481,16 @@ public class CraftWorld implements World {
|
|
|
|
|
@@ -488,13 +488,16 @@ public class CraftWorld implements World {
|
|
|
|
|
public Chunk[] getLoadedChunks() {
|
|
|
|
|
// Paper start
|
|
|
|
|
if (Thread.currentThread() != world.getMinecraftWorld().serverThread) {
|
|
|
|
|
@@ -20697,7 +20851,7 @@ index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb2783
|
|
|
|
|
return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.Chunk::getBukkitChunk).toArray(Chunk[]::new);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -523,6 +519,7 @@ public class CraftWorld implements World {
|
|
|
|
|
@@ -523,6 +526,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
|
|
|
|
|
@@ -20705,7 +20859,7 @@ index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb2783
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
@@ -736,6 +733,30 @@ public class CraftWorld implements World {
|
|
|
|
|
@@ -736,6 +740,30 @@ public class CraftWorld implements World {
|
|
|
|
|
return ret.entrySet().stream().collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, (entry) -> entry.getValue().build()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -20736,7 +20890,7 @@ index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb2783
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isChunkForceLoaded(int x, int z) {
|
|
|
|
|
return getHandle().getForceLoadedChunks().contains(ChunkCoordIntPair.pair(x, z));
|
|
|
|
|
@@ -2668,7 +2689,7 @@ public class CraftWorld implements World {
|
|
|
|
|
@@ -2668,7 +2696,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);
|
|
|
|
|
@@ -20745,7 +20899,7 @@ index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb2783
|
|
|
|
|
return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
|
|
|
|
|
}, net.minecraft.server.MinecraftServer.getServer());
|
|
|
|
|
}
|
|
|
|
|
@@ -2693,14 +2714,14 @@ public class CraftWorld implements World {
|
|
|
|
|
@@ -2693,14 +2721,14 @@ public class CraftWorld implements World {
|
|
|
|
|
throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]");
|
|
|
|
|
}
|
|
|
|
|
PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
|
|
|
|
|
@@ -20762,7 +20916,7 @@ index c0b49a0eaeda06b89a4fb425eec3d5bfa9717379..3562c20dee06913d03aee49d12cb2783
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -2709,11 +2730,22 @@ public class CraftWorld implements World {
|
|
|
|
|
@@ -2709,11 +2737,22 @@ public class CraftWorld implements World {
|
|
|
|
|
throw new IllegalArgumentException("View distance " + viewDistance + " is out of range of [2, 32]");
|
|
|
|
|
}
|
|
|
|
|
PlayerChunkMap chunkMap = getHandle().getChunkProvider().playerChunkMap;
|
|
|
|
|
|