From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Bud Gidiere Date: Tue, 4 Aug 2020 19:15:55 -0500 Subject: [PATCH] Yatopia Server Fixes diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java index 841a8d2b392acdcef90592b841cbbcb2237c6901..ff2351b57e96c8c17701a0608c9f2596d0adae6e 100644 --- a/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java @@ -232,6 +232,7 @@ public class TimingsExport extends Thread { pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Tuinity - add config to timings report pair("tuinity", mapAsJSON(Bukkit.spigot().getTuinityConfig(), null)) // Tuinity - add config to timings report , pair("akarin", mapAsJSON(Bukkit.spigot().getAkarinConfig(), null)) // Akarin - Server config + , pair("origami", mapAsJSON(Bukkit.spigot().getOrigamiConfig(), null)) // Origami )); new TimingsExport(listeners, parent, history).start(); diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java index dee9655b89d061ec8218ea2c54660c6003e8548f..253b73cfc597d4c7106d969be7b18c68166128ae 100644 --- a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java +++ b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java @@ -295,7 +295,7 @@ public final class PaperTickList extends TickListServer { // extend to avo this.shortScheduledIndex = getNextIndex(this.shortScheduledIndex, SHORT_SCHEDULE_TICK_THRESHOLD); this.timingCleanup.stopTiming(); - this.world.getMethodProfiler().exitEnter("ticking"); + //this.world.getMethodProfiler().exitEnter("ticking"); // Akarin - remove caller this.timingTicking.startTiming(); for (final NextTickListEntry toTick : this.toTickThisTick) { diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java.rej b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java.rej deleted file mode 100644 index c9fa39c5b4b013b56720e339463ffcb5fd3c13f9..0000000000000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java.rej +++ /dev/null @@ -1,10 +0,0 @@ -diff a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java (rejected hunks) -@@ -283,7 +283,7 @@ public final class PaperTickList extends TickListServer { // extend to avo - this.nextTick = this.world.getTime() + 1; - - this.timingCleanup.stopTiming(); -- this.world.getMethodProfiler().exitEnter("ticking"); -+ //this.world.getMethodProfiler().exitEnter("ticking"); // Akarin - remove caller - this.timingTicking.startTiming(); - - for (final NextTickListEntry toTick : this.toTickThisTick) { diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java index fe7330fabe386966c2d203a190a00a785ea21be0..bd107a376eaf660ba1ad61c035f8ed2d9d04749c 100644 --- a/src/main/java/de/minebench/origami/OrigamiConfig.java +++ b/src/main/java/de/minebench/origami/OrigamiConfig.java @@ -112,6 +112,19 @@ public final class OrigamiConfig { config.addDefault("worlds.default." + path, Double.valueOf(dfl)); return config.getDouble("worlds." + worldName + "." + path, config.getDouble("worlds.default." + path, dfl)); } + + public boolean tickEmptyHoppers = false; + public int fullHopperCooldown = 128; + private void hopperOptimizations() { + tickEmptyHoppers = getBoolean("tick-empty-hoppers", tickEmptyHoppers); + fullHopperCooldown = getInt("ticks-per.full-hopper-cooldown", fullHopperCooldown); + } + + public boolean fastFeatureSearchDontLoad = false; + private void fastFeatureSearchDontLoad() { + fastFeatureSearchDontLoad = getBoolean("fast-feature-search-dont-load", fastFeatureSearchDontLoad); + } + } } \ No newline at end of file diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java.rej b/src/main/java/de/minebench/origami/OrigamiConfig.java.rej deleted file mode 100644 index 8428d4bd05075e86b281312fa38106882c54735b..0000000000000000000000000000000000000000 --- a/src/main/java/de/minebench/origami/OrigamiConfig.java.rej +++ /dev/null @@ -1,14 +0,0 @@ -diff a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java (rejected hunks) -@@ -169,6 +169,12 @@ public final class OrigamiConfig { - Bukkit.getLogger().info("Farm detection radius: " + pigmenFarmsRadius + ", count: " + pigmenFarmsCount); - } - } -+ public boolean tickEmptyHoppers = false; -+ public int fullHopperCooldown = 128; -+ private void hopperOptimizations() { -+ tickEmptyHoppers = getBoolean("tick-empty-hoppers", tickEmptyHoppers); -+ fullHopperCooldown = getInt("ticks-per.full-hopper-cooldown", fullHopperCooldown); -+ } - } - - public static boolean teleportingOfVehiclesWithPassenger = true; diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index ee10abb6bc4d957676e7eef377cdc68dc3f43370..c12f4326f68020fbb140e97f0ef43ddcf5a71072 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -974,11 +974,11 @@ public class ChunkProviderServer extends IChunkProvider { player.playerNaturallySpawnedEvent = event; } // Paper end - optimize isOutisdeRange - this.world.getMethodProfiler().enter("pollingChunks"); + //this.world.getMethodProfiler().enter("pollingChunks"); // Akarin - remove caller int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED); boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit - this.world.getMethodProfiler().enter("naturalSpawnCount"); + //this.world.getMethodProfiler().enter("naturalSpawnCount"); // Akarin - remove caller this.world.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.chunkMapDistance.b(); // Paper start - per player mob spawning diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java.rej b/src/main/java/net/minecraft/server/ChunkProviderServer.java.rej deleted file mode 100644 index d1152585c5f482e554966f965561626c78ac4d3a..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java.rej +++ /dev/null @@ -1,15 +0,0 @@ -diff a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java (rejected hunks) -@@ -971,11 +971,11 @@ public class ChunkProviderServer extends IChunkProvider { - player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in isOutsideRange - } - // Paper end - optimize isOutisdeRange -- this.world.getMethodProfiler().enter("pollingChunks"); -+ //this.world.getMethodProfiler().enter("pollingChunks"); // Akarin - remove caller - int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED); - boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit - -- this.world.getMethodProfiler().enter("naturalSpawnCount"); -+ //this.world.getMethodProfiler().enter("naturalSpawnCount"); // Akarin - remove caller - this.world.timings.countNaturalMobs.startTiming(); // Paper - timings - int l = this.chunkMapDistance.b(); - // Paper start - per player mob spawning diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java index e19bb5ce5c32d9c08336f802fa9058603e23c6ab..d73ef98330c4ae643950b16341b3cde0d52928ce 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -758,7 +758,11 @@ public abstract class EntityInsentient extends EntityLiving { this.goalSelector.doTick(); //this.world.getMethodProfiler().exit(); // Akarin - remove caller //this.world.getMethodProfiler().enter("navigation"); // Akarin - remove caller - this.navigation.c(); + // Paper start - async navigation + if (this.navigation instanceof AsyncNavigationAbstract) + ((AsyncNavigationAbstract) this.navigation).asyncTick(); + else + // Paper end //this.world.getMethodProfiler().exit(); // Akarin - remove caller //this.world.getMethodProfiler().enter("mob tick"); // Akarin - remove caller this.mobTick(); diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java.rej b/src/main/java/net/minecraft/server/EntityInsentient.java.rej deleted file mode 100644 index de5ec59cb607030703e7b0361b1fa615b95e289e..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityInsentient.java.rej +++ /dev/null @@ -1,13 +0,0 @@ -diff a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java (rejected hunks) -@@ -757,6 +758,11 @@ public abstract class EntityInsentient extends EntityLiving { - this.goalSelector.doTick(); - this.world.getMethodProfiler().exit(); - this.world.getMethodProfiler().enter("navigation"); -+ // Paper start - async navigation -+ if (this.navigation instanceof AsyncNavigationAbstract) -+ ((AsyncNavigationAbstract) this.navigation).asyncTick(); -+ else -+ // Paper end - this.navigation.c(); - this.world.getMethodProfiler().exit(); - this.world.getMethodProfiler().enter("mob tick"); diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java index 70ae2923e21d7a0312e629a903ca9e380d6c6114..d906c5e530c2e7f779df079223aee619a73b5d51 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -164,6 +164,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation protected void mobTick() { mobTick(false); } protected void mobTick(boolean inactive) { //this.world.getMethodProfiler().enter("villagerBrain"); // Akarin - remove caller + // Purpur start + boolean tick = (world.getTime() + brainTickOffset) % world.purpurConfig.villagerBrainTicks == 0; + if (((WorldServer) world).getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick) + // Purpur end if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper if (this.bM) { this.bM = false; diff --git a/src/main/java/net/minecraft/server/EntityVillager.java.rej b/src/main/java/net/minecraft/server/EntityVillager.java.rej deleted file mode 100644 index 68f0fc0230a4148ab9fc4181736ce93297c7e1b9..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityVillager.java.rej +++ /dev/null @@ -1,12 +0,0 @@ -diff a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java (rejected hunks) -@@ -166,6 +168,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - protected void mobTick() { mobTick(false); } - protected void mobTick(boolean inactive) { - this.world.getMethodProfiler().enter("villagerBrain"); -+ // Purpur start -+ boolean tick = (world.getTime() + brainTickOffset) % world.purpurConfig.villagerBrainTicks == 0; -+ if (((WorldServer) world).getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick) -+ // Purpur end - if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper - if (this.bM) { - this.bM = false; diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java index 9d6d882ad1479771b2a9e7c3a14c71dd00b63172..cc22d89d540a4f86e11d7d09ad2be7fcf070f43d 100644 --- a/src/main/java/net/minecraft/server/LightEngineThreaded.java +++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java @@ -334,10 +334,14 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { private final java.util.List post = new java.util.ArrayList<>(); private void b() { if (queue.poll(pre, post)) { - pre.forEach(Runnable::run); + for (Runnable runnable1 : pre) { + runnable1.run(); + } pre.clear(); super.a(Integer.MAX_VALUE, true, true); - post.forEach(Runnable::run); + for (Runnable runnable : post) { + runnable.run(); + } post.clear(); } else { // might have level updates to go still diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java.rej b/src/main/java/net/minecraft/server/LightEngineThreaded.java.rej deleted file mode 100644 index 74d10212e547adf96762155adb03c0158df00a16..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/LightEngineThreaded.java.rej +++ /dev/null @@ -1,18 +0,0 @@ -diff a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java (rejected hunks) -@@ -288,10 +288,14 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { - int i = Math.min(queue.size(), 4); - boolean ran = false; - while (i-- > 0 && queue.poll(pre, post)) { -- pre.forEach(Runnable::run); -+ for (Runnable runnable1 : pre) { -+ runnable1.run(); -+ } - pre.clear(); - super.a(Integer.MAX_VALUE, true, true); -- post.forEach(Runnable::run); -+ for (Runnable runnable : post) { -+ runnable.run(); -+ } - post.clear(); - ran = true; - } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index de1845b3585d7cf96bf26f5859e1cb4820ad2d56..e17119d37577de42f8d52afcfdfee64c33996941 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1001,7 +1001,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant int j2 = i1 + k * l1; ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper + // Origami start - seed based feature search doesn't load + if (iworldreader instanceof World && ((World) iworldreader).origamiConfig.fastFeatureSearchDontLoad) { + return chunkcoordintpair.l(); + } + // Origami end IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS); StructureStart structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess); diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java.rej b/src/main/java/net/minecraft/server/StructureGenerator.java.rej deleted file mode 100644 index 8b5d001fb8ecb4a5b96bda6532cf8d5900816290..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/StructureGenerator.java.rej +++ /dev/null @@ -1,13 +0,0 @@ -diff a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java (rejected hunks) -@@ -139,6 +139,11 @@ public abstract class StructureGenerator - int j2 = i1 + k * l1; - ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); - if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper -+ // Origami start - seed based feature search doesn't load -+ if (iworldreader instanceof World && ((World) iworldreader).origamiConfig.fastFeatureSearchDontLoad) { -+ return chunkcoordintpair.l(); -+ } -+ // Origami end - // Origami start - option to only find generated features to not generate new chunks - IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS, !(iworldreader instanceof World) || !((World) iworldreader).origamiConfig.onlyFindGeneratedFeatures); - if (ichunkaccess == null) { diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java index 2fbbc1588c2943c8998550db4da6642e666650d8..3ff61141aede4b5a09bf83153222de0d14db5ad0 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -508,6 +508,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi entityitem = (EntityItem) iterator.next(); } while (!a((IInventory) ihopper, entityitem)); + if (ihopper instanceof TileEntityHopper) ((TileEntityHopper) ihopper).shouldTick = true; // Origami - don't tick empty hoppers return true; } return false; // EMC diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java.rej b/src/main/java/net/minecraft/server/TileEntityHopper.java.rej deleted file mode 100644 index cc8866ec1ccbc131e8491c50eda4f85590bb667b..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java.rej +++ /dev/null @@ -1,9 +0,0 @@ -diff a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java (rejected hunks) -@@ -466,6 +497,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - entityitem = (EntityItem) iterator.next(); - } while (!a((IInventory) ihopper, entityitem)); - -+ if (ihopper instanceof TileEntityHopper) ((TileEntityHopper) ihopper).shouldTick = true; // Origami - don't tick empty hoppers - return true; - } - } diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java index 7fe085e48b6ad625a510edf33b112bef24f7d7ad..9459efde54d507231b4aacb7cba14e9905ebb4d7 100644 --- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java +++ b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java @@ -11,7 +11,18 @@ import org.bukkit.entity.HumanEntity; public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable { - private static final int[] a = IntStream.range(0, 27).toArray(); + private static final int[] a; + + static { + int[] arr = new int[10]; + int count = 0; + for (int i1 = 0; i1 < 27; i1++) { + if (arr.length == count) arr = Arrays.copyOf(arr, count * 2); + arr[count++] = i1; + } + arr = Arrays.copyOfRange(arr, 0, count); + a = arr; + } private NonNullList contents; public int c; // PAIL private -> public, rename viewerCount private TileEntityShulkerBox.AnimationPhase i; diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej deleted file mode 100644 index bada470cba41cce9beb9eb04227b42c1d489d731..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej +++ /dev/null @@ -1,22 +0,0 @@ -diff a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java (rejected hunks) -@@ -10,7 +11,19 @@ import org.bukkit.entity.HumanEntity; - - public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable { - -- private static final int[] a = IntStream.range(0, 27).toArray(); -+ private static final int[] a; -+ -+ static { -+ int[] arr = new int[10]; -+ int count = 0; -+ for (int i1 = 0; i1 < 27; i1++) { -+ if (arr.length == count) arr = Arrays.copyOf(arr, count * 2); -+ arr[count++] = i1; -+ } -+ arr = Arrays.copyOfRange(arr, 0, count); -+ a = arr; -+ } -+ - private NonNullList contents; - private int c; - private TileEntityShulkerBox.AnimationPhase i; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index b32638165798a4b6022fc41e9c9ac8d5dac507a5..5111875cdb28b6958dec09215d4d4b8c8cbaad5a 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -96,6 +96,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public final com.tuinity.tuinity.config.TuinityConfig.WorldConfig tuinityConfig; // Tuinity - Server Config public final app.akarin.server.Config.WorldConfig akarinConfig; // Akarin - Server Config + public final us.minevict.papercut.PapercutConfig.WorldConfig papercutConfig; // Papercut + public final net.pl3x.purpur.PurpurWorldConfig purpurConfig; // Purpur + public final de.minebench.origami.OrigamiConfig.WorldConfig origamiConfig; // Origami - World Config public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPosition lastPhysicsProblem; // Spigot @@ -126,6 +129,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config this.akarinConfig = new app.akarin.server.Config.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Akarin - Server Config + this.papercutConfig = new us.minevict.papercut.PapercutConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Papercut + this.purpurConfig = new net.pl3x.purpur.PurpurWorldConfig((((WorldDataServer)worlddatamutable).getName())); // Purpur + this.origamiConfig = new de.minebench.origami.OrigamiConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Origami - World Config + this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit @@ -636,6 +643,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} + public void applyPhysics(BlockPosition blockposition, Block block) { if (captureBlockStates) { return; } // Paper - Cancel all physics during placement this.a(blockposition.west(), block, blockposition); @@ -645,7 +653,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.a(blockposition.north(), block, blockposition); this.a(blockposition.south(), block, blockposition); } - + public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) { if (enumdirection != EnumDirection.WEST) { this.a(blockposition.west(), block, blockposition); @@ -673,6 +681,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } + public void neighborChanged(BlockPosition pos, Block blockIn, BlockPosition fromPos) { a(pos, blockIn, fromPos); } // Paper - OBFHELPER public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { if (!this.isClientSide) { IBlockData iblockdata = this.getTypeIfLoaded(blockposition); // EMC diff --git a/src/main/java/net/minecraft/server/World.java.rej b/src/main/java/net/minecraft/server/World.java.rej deleted file mode 100644 index c632cd030e36d8abfd92a14948e4893d885823ad..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java.rej +++ /dev/null @@ -1,9 +0,0 @@ -diff a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java (rejected hunks) -@@ -646,6 +646,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - } - -+ public void neighborChanged(BlockPosition pos, Block blockIn, BlockPosition fromPos) { a(pos, blockIn, fromPos); } // Paper - OBFHELPER - public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { - if (!this.isClientSide) { - IBlockData iblockdata = this.getType(blockposition); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 64f7fc40a6847ebc6c84b3c179614e186f861e1f..3782d329dc62a9e834f16a9009f4102b5b4aad6f 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -943,7 +943,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // CraftBukkit end */ - gameprofilerfiller.enter("checkDespawn"); + //gameprofilerfiller.enter("checkDespawn"); // Akarin - remove caller if (!entity.dead) { entity.checkDespawn(); // Tuinity start - optimise notify() @@ -955,7 +955,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { // Tuinity end - optimise notify() } - gameprofilerfiller.exit(); + //gameprofilerfiller.exit(); // Akarin - remove caller if (entity1 != null) { if (!entity1.dead && entity1.w(entity)) { continue; @@ -964,13 +964,13 @@ public class WorldServer extends World implements GeneratorAccessSeed { entity.stopRiding(); } - gameprofilerfiller.enter("tick"); + //gameprofilerfiller.enter("tick"); // Akarin - remove caller if (!entity.dead && !(entity instanceof EntityComplexPart)) { this.a(this::entityJoinedWorld, entity); } - gameprofilerfiller.exit(); - gameprofilerfiller.enter("remove"); + //gameprofilerfiller.exit(); // Akarin - remove caller + //gameprofilerfiller.enter("remove"); // Akarin - remove caller if (entity.dead) { this.removeEntityFromChunk(entity); this.entitiesById.remove(entity.getId()); // Tuinity @@ -982,7 +982,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Tuinity end - optimise notify() - gameprofilerfiller.exit(); + //gameprofilerfiller.exit(); // Akarin - remove caller } timings.entityTick.stopTiming(); // Spigot @@ -1414,7 +1414,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { // Tuinity end } - this.getMethodProfiler().exit(); + // this.getMethodProfiler().exit(); // Akarin - remove caller } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java.rej b/src/main/java/net/minecraft/server/WorldServer.java.rej deleted file mode 100644 index 87367c60dd036f8623d6593e73dd2412a477f6a4..0000000000000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/WorldServer.java.rej +++ /dev/null @@ -1,50 +0,0 @@ -diff a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java (rejected hunks) -@@ -943,12 +943,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - // CraftBukkit end */ - -- gameprofilerfiller.enter("checkDespawn"); -+ //gameprofilerfiller.enter("checkDespawn"); // Akarin - remove caller - if (!entity.dead) { - entity.checkDespawn(); - } - -- gameprofilerfiller.exit(); -+ //gameprofilerfiller.exit(); // Akarin - remove caller - if (entity1 != null) { - if (!entity1.dead && entity1.w(entity)) { - continue; -@@ -957,20 +957,20 @@ public class WorldServer extends World implements GeneratorAccessSeed { - entity.stopRiding(); - } - -- gameprofilerfiller.enter("tick"); -+ //gameprofilerfiller.enter("tick"); // Akarin - remove caller - if (!entity.dead && !(entity instanceof EntityComplexPart)) { - this.a(this::entityJoinedWorld, entity); - } - -- gameprofilerfiller.exit(); -- gameprofilerfiller.enter("remove"); -+ //gameprofilerfiller.exit(); // Akarin - remove caller -+ //gameprofilerfiller.enter("remove"); // Akarin - remove caller - if (entity.dead) { - this.removeEntityFromChunk(entity); - this.entitiesById.remove(entity.getId()); // Tuinity - this.unregisterEntity(entity); - } - -- gameprofilerfiller.exit(); -+ //gameprofilerfiller.exit(); // Akarin - remove caller - } - timings.entityTick.stopTiming(); // Spigot - -@@ -1377,7 +1377,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - } - -- this.getMethodProfiler().exit(); -+ //this.getMethodProfiler().exit(); // Akarin - remove caller - } - } - diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java index 1d00832bffc2b6bcc6153b9065a92035ba974138..b3d6e713c2bfa1a0432b4afc3e8c31d4d7ca5844 100644 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java @@ -127,4 +127,23 @@ public class PurpurConfig { config.addDefault(path, def); return config.getString(path, config.getString(path)); } + + public static double laggingThreshold = 19.0D; + private static void tickLoopSettings() { + laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold); + } + + public static boolean useAlternateKeepAlive = false; + private static void useAlternateKeepAlive() { + useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive); + } + public static boolean dontSendUselessEntityPackets = false; + private static void dontSendUselessEntityPackets() { + dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets); + } + + public static boolean tpsCatchup = true; + private static void tpsCatchup() { + tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup); + } } diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java.rej b/src/main/java/net/pl3x/purpur/PurpurConfig.java.rej deleted file mode 100644 index ff05ff6aef1e0f61eb4437253020632745ee2bd2..0000000000000000000000000000000000000000 --- a/src/main/java/net/pl3x/purpur/PurpurConfig.java.rej +++ /dev/null @@ -1,11 +0,0 @@ -diff a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java (rejected hunks) -@@ -194,4 +194,9 @@ public class PurpurConfig { - loggerSuppressInitLegacyMaterialError = getBoolean("settings.logger.suppress-init-legacy-material-errors", loggerSuppressInitLegacyMaterialError); - loggerSuppressIgnoredAdvancementWarnings = getBoolean("settings.logger.suppress-ignored-advancement-warnings", loggerSuppressIgnoredAdvancementWarnings); - } -+ -+ public static boolean tpsCatchup = true; -+ private static void tpsCatchup() { -+ tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup); -+ } - } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index 361f7857e461578e90cb71e15027dadaf794cb69..7cde55ae407012b3445f11b07a0ebc9d00e031e3 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -56,4 +56,16 @@ public class PurpurWorldConfig { PurpurConfig.config.addDefault("world-settings.default." + path, def); return PurpurConfig.config.getString("world-settings." + worldName + "." + path, PurpurConfig.config.getString("world-settings.default." + path)); } + + public int villagerBrainTicks = 1; + public boolean villagerUseBrainTicksOnlyWhenLagging = true; + private void villagerSettings() { + villagerBrainTicks = getInt("mobs.villager.brain-ticks", villagerBrainTicks); + villagerUseBrainTicksOnlyWhenLagging = getBoolean("mobs.villager.use-brain-ticks-only-when-lagging", villagerUseBrainTicksOnlyWhenLagging); + } + + public boolean saveProjectilesToDisk = true; + private void miscGameplayMechanicsSettings() { + saveProjectilesToDisk = getBoolean("gameplay-mechanics.save-projectiles-to-disk", saveProjectilesToDisk); + } } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java.rej b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java.rej deleted file mode 100644 index 120d0df27e76c9beef9f09e6cdc0972454fdd4ca..0000000000000000000000000000000000000000 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java.rej +++ /dev/null @@ -1,15 +0,0 @@ -diff a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java (rejected hunks) -@@ -113,11 +113,13 @@ public class PurpurWorldConfig { - public boolean disableDropsOnCrammingDeath = false; - public boolean entitiesPickUpLootBypassMobGriefing = false; - public boolean milkCuresBadOmen = true; -+ public boolean saveProjectilesToDisk = true; - public double tridentLoyaltyVoidReturnHeight = 0.0D; - private void miscGameplayMechanicsSettings() { - disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath); - entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing); - milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen); -+ saveProjectilesToDisk = getBoolean("gameplay-mechanics.save-projectiles-to-disk", saveProjectilesToDisk); - tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight); - } - diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index d290bc1b8bea4fac9d4e14a1ccdf954055291e66..5bdde162b6f2aa81d136d82504ab5890e5262279 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -842,6 +842,8 @@ public final class CraftServer implements Server { com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper com.tuinity.tuinity.config.TuinityConfig.init((File) console.options.valueOf("tuinity-settings")); // Tuinity - Server Config app.akarin.server.Config.init((File) console.options.valueOf("akarin-settings")); // Akarin - Server Config + net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur + de.minebench.origami.OrigamiConfig.init((File) console.options.valueOf("origami-settings")); // Origami - Server Config for (WorldServer world : console.getWorlds()) { world.worldDataServer.setDifficulty(config.difficulty); world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals); @@ -878,6 +880,9 @@ public final class CraftServer implements Server { world.paperConfig.init(); // Paper world.tuinityConfig.init(); // Tuinity - Server Config world.akarinConfig.init(); // Akarin - Server Config + world.papercutConfig.init(); // Papercut + world.purpurConfig.init(); // Purpur + world.origamiConfig.init(); // Origami - World Config } Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper @@ -2255,6 +2260,25 @@ public final class CraftServer implements Server { } // Akarin End - Server Config + // Papercut start - add config to timings report + @Override + public YamlConfiguration getPapercutConfig() { return us.minevict.papercut.PapercutConfig.config; } + // Papercut end - add config to timings report + + // Purpur start + @Override + public YamlConfiguration getPurpurConfig() { + return net.pl3x.purpur.PurpurConfig.config; + } + /*@Override + public java.util.Properties getServerProperties() { + return getProperties().properties; + }*/ + // Purpur end + + @Override + public YamlConfiguration getOrigamiConfig() { return com.mrivanplays.origami.OrigamiConfig.config; } // Origami - add config to timings report + @Override public void restart() { org.spigotmc.RestartCommand.restart(); @@ -2394,4 +2418,11 @@ public final class CraftServer implements Server { return mobGoals; } // Paper end + + // Purpur start + @Override + public boolean isLagging() { + return getServer().lagging; + } + // Purpur end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java.rej b/src/main/java/org/bukkit/craftbukkit/CraftServer.java.rej deleted file mode 100644 index b9d3fb83434a48b328cf0a0ae1ec29d93e87aa3e..0000000000000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java.rej +++ /dev/null @@ -1,12 +0,0 @@ -diff a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java (rejected hunks) -@@ -2409,5 +2409,10 @@ public final class CraftServer implements Server { - public String getServerName() { - return getProperties().serverName; - } -+ -+ @Override -+ public boolean isLagging() { -+ return getServer().lagging; -+ } - // Purpur end - } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java index 2d12ad72be927712d38d6fb6991f4af7a196fb9b..1a454f74b322605b1006da5be13760b13cc5f931 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -138,6 +138,7 @@ public class Main { .defaultsTo(new File("paper.yml")) .describedAs("Yml file"); // Paper end + // Tuinity Start - Server Config acceptsAll(asList("tuinity", "tuinity-settings"), "File for tuinity settings") .withRequiredArg() @@ -154,6 +155,22 @@ public class Main { .describedAs("Yml file"); // Akarin End - Server Config + // Origami Start - Server Config + acceptsAll(asList("origami", "origami-settings"), "File for origami settings") + .withRequiredArg() + .ofType(File.class) + .defaultsTo(new File("origami.yml")) + .describedAs("Yml file"); + // Origami end - Server Config + + // Purpur Start + acceptsAll(asList("purpur", "purpur-settings"), "File for purpur settings") + .withRequiredArg() + .ofType(File.class) + .defaultsTo(new File("purpur.yml")) + .describedAs("Yml file"); + // Purpur end + // Paper start acceptsAll(asList("server-name"), "Name of the server") .withRequiredArg() diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java.rej b/src/main/java/org/bukkit/craftbukkit/Main.java.rej deleted file mode 100644 index 5d35899d1bedbb8643a601a2e1731a9bc66c7b61..0000000000000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/Main.java.rej +++ /dev/null @@ -1,16 +0,0 @@ -diff a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java (rejected hunks) -@@ -146,6 +146,14 @@ public class Main { - .describedAs("Yml file"); - /* Conctete End - Server Config */ - -+ // Purpur Start -+ acceptsAll(asList("purpur", "purpur-settings"), "File for purpur settings") -+ .withRequiredArg() -+ .ofType(File.class) -+ .defaultsTo(new File("purpur.yml")) -+ .describedAs("Yml file"); -+ // Purpur end -+ - // Paper start - acceptsAll(asList("server-name"), "Name of the server") - .withRequiredArg()