diff --git a/gradle.properties b/gradle.properties index 5ce56b8..04b3767 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group = gq.bxteam.divinemc version = 1.20.1-R0.1-SNAPSHOT -purpurRef = 042e192444ecc577c172710e3dab1d38413b1ea2 +purpurRef = 617240ebb0fe76f889997bd163bdefe8dbd97e78 org.gradle.caching = true org.gradle.parallel = true diff --git a/patches/api/0002-Disable-reload-command-by-default.patch b/patches/api/0002-Disable-reload-command-by-default.patch index a9de3f0..b024e02 100644 --- a/patches/api/0002-Disable-reload-command-by-default.patch +++ b/patches/api/0002-Disable-reload-command-by-default.patch @@ -7,13 +7,13 @@ This is fully rewritten reload command. Reloading in Bukkit VERY, VERY UNSTABLE Read this article why reload is VERY UNSAFE in Bukkit: https://madelinemiller.dev/blog/problem-with-reload/ diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java -index 3ec32b46264cfff857b50129b5e0fa5584943ec6..6975b442ca0f9f7682d7f860256856ecf18b746d 100644 +index 3ec32b46264cfff857b50129b5e0fa5584943ec6..9cf8ed9c4c42f9469bd06b2eb43b51621a5883c4 100644 --- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java +++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java -@@ -1,14 +1,14 @@ +@@ -1,60 +1,32 @@ package org.bukkit.command.defaults; - import java.util.Arrays; +-import java.util.Arrays; -import java.util.Collections; import java.util.List; -import org.bukkit.Bukkit; @@ -28,7 +28,14 @@ index 3ec32b46264cfff857b50129b5e0fa5584943ec6..6975b442ca0f9f7682d7f860256856ec public class ReloadCommand extends BukkitCommand { public ReloadCommand(@NotNull String name) { super(name); -@@ -22,39 +22,12 @@ public class ReloadCommand extends BukkitCommand { + this.description = "Reloads the server configuration and plugins"; + this.usageMessage = "/reload [permissions|commands|confirm]"; // Paper + this.setPermission("bukkit.command.reload"); +- this.setAliases(Arrays.asList("rl")); ++ this.setAliases(List.of("rl")); + } + + @Override public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { // Paper if (!testPermission(sender)) return true; diff --git a/patches/server/0001-Divine-Branding.patch b/patches/server/0001-Divine-Branding.patch index 5654dea..8ac94a4 100644 --- a/patches/server/0001-Divine-Branding.patch +++ b/patches/server/0001-Divine-Branding.patch @@ -138,33 +138,33 @@ index 3cb56595822799926a8141e60a42f5d1edfc6de5..05478a1ea04ec0396bc8c97090edef4a .completer(new ConsoleCommandCompleter(this.server)) .option(LineReader.Option.COMPLETE_IN_WORD, true); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b08d4a2a74392b1d59b1eeeab3108103d83ad96c..7921caca236900b9d1d234d95db5a24cc403d9b2 100644 +index 73c2719a6f5410fec8511ba53362f87bb74c9a1a..17af7e23cba6d99fecde12f954c832de71f42947 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -265,7 +265,7 @@ import javax.annotation.Nullable; // Paper import javax.annotation.Nonnull; // Paper - public final class CraftServer implements Server { + public final class CraftServer implements Server { - private final String serverName = "Purpur"; // Paper // Pufferfish // Purpur + private final String serverName = "DivineMC"; // Paper // Pufferfish // Purpur // DivineMC - private final String serverVersion; - private final String bukkitVersion = Versioning.getBukkitVersion(); - private final Logger logger = Logger.getLogger("Minecraft"); + private final String serverVersion; + private final String bukkitVersion = Versioning.getBukkitVersion(); + private final Logger logger = Logger.getLogger("Minecraft"); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java -index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..627ceea9fa0fccd3e466eb34d59e760be30a69a8 100644 +index 8cb10fa24bea1ffd3ea3a5f3d471c118a5713257..3a42575a50cf59def579fd7dcfc3cd3865a2ace1 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java @@ -11,7 +11,7 @@ public final class Versioning { - public static String getBukkitVersion() { - String result = "Unknown-Version"; - + public static String getBukkitVersion() { + String result = "Unknown-Version"; + - InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.purpurmc.purpur/purpur-api/pom.properties"); // Pufferfish // Purpur + InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/gq.bxteam.divinemc/divinemc-api/pom.properties"); // Pufferfish // DivineMC - Properties properties = new Properties(); - - if (stream != null) { + Properties properties = new Properties(); + + if (stream != null) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 3029f38cff6755b31427efb7fae3b6886ee8e4ee..6e5ccafddd7af250d319431f5d4433b152d1efe4 100644 +index 3633574e112f217b412217dd243a631dc4e9c40c..1f54e2ec6d73853001642bcf4b355c4a0dd10f6d 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -231,7 +231,7 @@ public class PurpurConfig { @@ -177,7 +177,7 @@ index 3029f38cff6755b31427efb7fae3b6886ee8e4ee..6e5ccafddd7af250d319431f5d4433b1 serverModName = getString("settings.server-mod-name", serverModName); } diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 0801dea155048ac5383295f4fef9bd597b678535..fb9bb334924ff2456862b47693b595594dcfe806 100644 +index 8b1a446c986c4fae8c0ad810f34e231f0e360dbe..f11529ff35eeff916b84010d02c987779f480cf0 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -185,7 +185,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa @@ -190,14 +190,14 @@ index 0801dea155048ac5383295f4fef9bd597b678535..fb9bb334924ff2456862b47693b59559 } // Paper end - Different message for short timeout @@ -206,7 +206,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa - WatchdogThread.dumpThread( thread, log ); - } + WatchdogThread.dumpThread( thread, log ); + } } else { - log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH ---"); // Purpur + log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO DIVINEMC - THIS IS NOT A BUG OR A CRASH ---"); // Purpur // DivineMC } - log.log( Level.SEVERE, "------------------------------" ); + log.log( Level.SEVERE, "------------------------------" ); diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png index 518591dd83289e041a16e2c2e7d7e7640d4b2e1b..f54753531b3bf2e8b5377f342465e727c7da98f2 100644 GIT binary patch diff --git a/patches/server/0002-Divine-Configuration.patch b/patches/server/0002-Divine-Configuration.patch index bebf485..23353f4 100644 --- a/patches/server/0002-Divine-Configuration.patch +++ b/patches/server/0002-Divine-Configuration.patch @@ -327,13 +327,13 @@ index 0000000000000000000000000000000000000000..5d16d2250bae9c982a0af9ad2580a635 +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 12124d6fbc0406bb62bd95a0f7bab68afa43377c..6b4b687b114818cdd8bd2c6256d1d9cf1343bb83 100644 +index 0da72241f940bd81a5d122d9d6ac2871f4d834e6..af53310d196020682dd981da98261fb3a72a6690 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -235,6 +235,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish - + + // DivineMC start + try { + gq.bxteam.divinemc.configuration.DivineConfig.init((java.io.File) options.valueOf("divinemc-settings")); @@ -344,74 +344,74 @@ index 12124d6fbc0406bb62bd95a0f7bab68afa43377c..6b4b687b114818cdd8bd2c6256d1d9cf + gq.bxteam.divinemc.configuration.DivineConfig.registerCommands(); + // DivineMC end + - this.setPvpAllowed(dedicatedserverproperties.pvp); - this.setFlightAllowed(dedicatedserverproperties.allowFlight); - this.setMotd(dedicatedserverproperties.motd); + this.setPvpAllowed(dedicatedserverproperties.pvp); + this.setFlightAllowed(dedicatedserverproperties.allowFlight); + this.setMotd(dedicatedserverproperties.motd); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index bdb32964524cb2a4398b8d3bedfb03b0cb805b6d..0eb08e6fe7079f2e76bc76d503395971d958ea9b 100644 +index 2fa984bef4335f6042a4a0ab0af9af81e52984b7..af556d9355e327fcbe50cb08f99026e7255f485f 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; - import java.util.function.Predicate; - import java.util.function.Supplier; - import javax.annotation.Nullable; + import java.util.function.Predicate; + import java.util.function.Supplier; + import javax.annotation.Nullable; + +import gq.bxteam.divinemc.configuration.DivineWorldConfig; - import net.minecraft.CrashReport; - import net.minecraft.CrashReportCategory; - import net.minecraft.ReportedException; + import net.minecraft.CrashReport; + import net.minecraft.CrashReportCategory; + import net.minecraft.ReportedException; @@ -177,6 +179,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - + public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur + public final gq.bxteam.divinemc.configuration.DivineWorldConfig divinemcConfig; // DivineMC public final co.aikar.timings.WorldTimingsHandler timings; // Paper - public static BlockPos lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; + public static BlockPos lastPhysicsProblem; // Spigot + private org.spigotmc.TickLimiter entityLimiter; @@ -332,6 +335,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur + this.divinemcConfig = new DivineWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // DivineMC this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur - this.generator = gen; - this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); + this.generator = gen; + this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7921caca236900b9d1d234d95db5a24cc403d9b2..a8aed082ea5b10792380dc36d9920409edb5dfce 100644 +index 17af7e23cba6d99fecde12f954c832de71f42947..e08d2d94ca6332bfee1b186eae0e728aee60eb37 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -15,6 +15,7 @@ import com.mojang.brigadier.tree.LiteralCommandNode; - import com.mojang.datafixers.util.Pair; - import com.mojang.serialization.DynamicOps; - import com.mojang.serialization.Lifecycle; + import com.mojang.datafixers.util.Pair; + import com.mojang.serialization.DynamicOps; + import com.mojang.serialization.Lifecycle; +import gq.bxteam.divinemc.configuration.DivineConfig; - import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; - import java.awt.image.BufferedImage; - import java.io.ByteArrayOutputStream; + import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.awt.image.BufferedImage; + import java.io.ByteArrayOutputStream; @@ -1072,6 +1073,7 @@ public final class CraftServer implements Server { - org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot + org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur + gq.bxteam.divinemc.configuration.DivineConfig.init((File) console.options.valueOf("divinemc-settings")); // DivineMC - for (ServerLevel world : this.console.getAllLevels()) { + for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) @@ -1088,6 +1090,7 @@ public final class CraftServer implements Server { - } - world.spigotConfig.init(); // Spigot + } + world.spigotConfig.init(); // Spigot world.purpurConfig.init(); // Purpur + world.divinemcConfig.init(); // DivineMC - } - + } + Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper @@ -1104,6 +1107,7 @@ public final class CraftServer implements Server { - org.spigotmc.SpigotConfig.registerCommands(); // Spigot + org.spigotmc.SpigotConfig.registerCommands(); // Spigot io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper org.purpurmc.purpur.PurpurConfig.registerCommands(); // Purpur + gq.bxteam.divinemc.configuration.DivineConfig.registerCommands(); // DivineMC - this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); - this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); - + this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); + this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); + @@ -3016,6 +3020,13 @@ public final class CraftServer implements Server { } // Purpur end @@ -423,11 +423,11 @@ index 7921caca236900b9d1d234d95db5a24cc403d9b2..a8aed082ea5b10792380dc36d9920409 + } + // DivineMC end + - @Override - public void restart() { - org.spigotmc.RestartCommand.restart(); + @Override + public void restart() { + org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 9a3374a1236164194ef0df43ed639296cbe1c731..0373c0a343e990c1aa993b00b8254b09b3c5f0e3 100644 +index 898e9c968c12b2dc62ee4da11202e5a633ee2203..ff09eef761ca7c0d6a09ce8fcfbdf1ac14ca5956 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -187,6 +187,14 @@ public class Main { diff --git a/patches/server/0004-Optimize-default-values-for-configs.patch b/patches/server/0004-Optimize-default-values-for-configs.patch index 182cd0a..8149498 100644 --- a/patches/server/0004-Optimize-default-values-for-configs.patch +++ b/patches/server/0004-Optimize-default-values-for-configs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize default values for configs diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java -index bff1b41501c040487583a5a279fc7800fc6aedca..f115e59e7bcba491290239775eb2849c11874d2f 100644 +index 3e36958365bc136516bafbaad0c168f7956406f1..b3594f563489e210544cc573cbe1c13d1effe52b 100644 --- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java @@ -211,7 +211,7 @@ public class PufferfishConfig { @@ -219,45 +219,45 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 public float maxLeashDistance = 10f; public boolean disableSprintInterruptionOnAttack = false; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 5b5109e942b18418b3a3a0e2109fe4ef15045fe5..389bcb5e01d66f8e3915e09a49aace5176012191 100644 +index c19d2bad1d80102543f3cd2718a22cd1942ffbd2..391b756455b536d1fbc4f0701f6e879800d6f05a 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -150,14 +150,14 @@ public class SpigotWorldConfig - public double itemMerge; - private void itemMerge() - { -- this.itemMerge = this.getDouble("merge-radius.item", 2.5 ); + public double itemMerge; + private void itemMerge() + { +- this.itemMerge = this.getDouble("merge-radius.item", 2.5 ); + this.itemMerge = this.getDouble("merge-radius.item", 3.5 ); // DivineMC - optimize default values for configs - this.log( "Item Merge Radius: " + this.itemMerge ); - } - - public double expMerge; - private void expMerge() - { -- this.expMerge = this.getDouble("merge-radius.exp", 3.0 ); + this.log( "Item Merge Radius: " + this.itemMerge ); + } + + public double expMerge; + private void expMerge() + { +- this.expMerge = this.getDouble("merge-radius.exp", 3.0 ); + this.expMerge = this.getDouble("merge-radius.exp", 4.0 ); // DivineMC - optimize default values for configs - this.log( "Experience Merge Radius: " + this.expMerge ); - } - + this.log( "Experience Merge Radius: " + this.expMerge ); + } + @@ -196,7 +196,7 @@ public class SpigotWorldConfig - public byte mobSpawnRange; - private void mobSpawnRange() - { + public byte mobSpawnRange; + private void mobSpawnRange() + { - this.mobSpawnRange = (byte) getInt( "mob-spawn-range", 8 ); // Paper - Vanilla + this.mobSpawnRange = (byte) getInt( "mob-spawn-range", 2 ); // Paper - Vanilla // DivineMC - optimize default values for configs - this.log( "Mob Spawn Range: " + this.mobSpawnRange ); - } - + this.log( "Mob Spawn Range: " + this.mobSpawnRange ); + } + @@ -207,14 +207,14 @@ public class SpigotWorldConfig - this.log( "Item Despawn Rate: " + this.itemDespawnRate ); - } - -- public int animalActivationRange = 32; -- public int monsterActivationRange = 32; + this.log( "Item Despawn Rate: " + this.itemDespawnRate ); + } + +- public int animalActivationRange = 32; +- public int monsterActivationRange = 32; + public int animalActivationRange = 16; // DivineMC - optimize default values for configs + public int monsterActivationRange = 24; // DivineMC - optimize default values for configs - public int raiderActivationRange = 48; -- public int miscActivationRange = 16; + public int raiderActivationRange = 48; +- public int miscActivationRange = 16; + public int miscActivationRange = 8; // DivineMC - optimize default values for configs // Paper start public int flyingMonsterActivationRange = 32; @@ -272,55 +272,55 @@ index 5b5109e942b18418b3a3a0e2109fe4ef15045fe5..389bcb5e01d66f8e3915e09a49aace51 public int villagersWorkImmunityFor = 20; public boolean villagersActiveForPanic = true; // Paper end -- public boolean tickInactiveVillagers = true; +- public boolean tickInactiveVillagers = true; + public boolean tickInactiveVillagers = false; // DivineMC - optimize default values for configs - public boolean ignoreSpectatorActivation = false; - private void activationRange() - { + public boolean ignoreSpectatorActivation = false; + private void activationRange() + { @@ -299,7 +299,7 @@ public class SpigotWorldConfig - { - this.set( "ticks-per.hopper-check", 1 ); - } -- this.hopperCheck = this.getInt( "ticks-per.hopper-check", 1 ); + { + this.set( "ticks-per.hopper-check", 1 ); + } +- this.hopperCheck = this.getInt( "ticks-per.hopper-check", 1 ); + this.hopperCheck = this.getInt( "ticks-per.hopper-check", 8 ); // DivineMC - optimize default values for configs - this.hopperAmount = this.getInt( "hopper-amount", 1 ); - this.hopperCanLoadChunks = this.getBoolean( "hopper-can-load-chunks", false ); - this.log( "Hopper Transfer: " + this.hopperTransfer + " Hopper Check: " + this.hopperCheck + " Hopper Amount: " + this.hopperAmount + " Hopper Can Load Chunks: " + this.hopperCanLoadChunks ); + this.hopperAmount = this.getInt( "hopper-amount", 1 ); + this.hopperCanLoadChunks = this.getBoolean( "hopper-can-load-chunks", false ); + this.log( "Hopper Transfer: " + this.hopperTransfer + " Hopper Check: " + this.hopperCheck + " Hopper Amount: " + this.hopperAmount + " Hopper Can Load Chunks: " + this.hopperCanLoadChunks ); @@ -309,7 +309,7 @@ public class SpigotWorldConfig - public int tridentDespawnRate; - private void arrowDespawnRate() - { -- this.arrowDespawnRate = this.getInt( "arrow-despawn-rate", 1200 ); + public int tridentDespawnRate; + private void arrowDespawnRate() + { +- this.arrowDespawnRate = this.getInt( "arrow-despawn-rate", 1200 ); + this.arrowDespawnRate = this.getInt( "arrow-despawn-rate", 300 ); // DivineMC - optimize default values for configs - this.tridentDespawnRate = this.getInt( "trident-despawn-rate", this.arrowDespawnRate ); - this.log( "Arrow Despawn Rate: " + this.arrowDespawnRate + " Trident Respawn Rate:" + this.tridentDespawnRate ); - } + this.tridentDespawnRate = this.getInt( "trident-despawn-rate", this.arrowDespawnRate ); + this.log( "Arrow Despawn Rate: " + this.arrowDespawnRate + " Trident Respawn Rate:" + this.tridentDespawnRate ); + } @@ -324,14 +324,14 @@ public class SpigotWorldConfig - public boolean nerfSpawnerMobs; - private void nerfSpawnerMobs() - { -- this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", false ); + public boolean nerfSpawnerMobs; + private void nerfSpawnerMobs() + { +- this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", false ); + this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", true ); // DivineMC - optimize default values for configs - this.log( "Nerfing mobs spawned from spawners: " + this.nerfSpawnerMobs ); - } - - public boolean enableZombiePigmenPortalSpawns; - private void enableZombiePigmenPortalSpawns() - { -- this.enableZombiePigmenPortalSpawns = this.getBoolean( "enable-zombie-pigmen-portal-spawns", true ); + this.log( "Nerfing mobs spawned from spawners: " + this.nerfSpawnerMobs ); + } + + public boolean enableZombiePigmenPortalSpawns; + private void enableZombiePigmenPortalSpawns() + { +- this.enableZombiePigmenPortalSpawns = this.getBoolean( "enable-zombie-pigmen-portal-spawns", true ); + this.enableZombiePigmenPortalSpawns = this.getBoolean( "enable-zombie-pigmen-portal-spawns", false ); // DivineMC - optimize default values for configs - this.log( "Allow Zombie Pigmen to spawn from portal blocks: " + this.enableZombiePigmenPortalSpawns ); - } - + this.log( "Allow Zombie Pigmen to spawn from portal blocks: " + this.enableZombiePigmenPortalSpawns ); + } + @@ -447,7 +447,7 @@ public class SpigotWorldConfig - public int hangingTickFrequency; - private void hangingTickFrequency() - { -- this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 100 ); + public int hangingTickFrequency; + private void hangingTickFrequency() + { +- this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 100 ); + this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 200 ); // DivineMC - optimize default values for configs - } - - public int tileMaxTickTime; + } + + public int tileMaxTickTime; diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml index eef7c125b2689f29cae5464659eacdf33f5695b2..8dbcf5f20dd99dba5d21ec6cd293a7534652c328 100644 --- a/src/main/resources/configurations/bukkit.yml diff --git a/patches/server/0007-Fix-entity-serialization.patch b/patches/server/0007-Fix-entity-serialization.patch index 7222ce7..347e297 100644 --- a/patches/server/0007-Fix-entity-serialization.patch +++ b/patches/server/0007-Fix-entity-serialization.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Fix entity serialization diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index cf0d8da4c4b5f4aa4e4ef15897ca252a2b52ec8d..95b6639d0075c2b86f83718b3093f972d2e89b83 100644 +index c50f9133f043b78cfabcd9569dfd1bdd62b952a1..7709077f8a9f8d724b4d3cc97a3660d13cfbb970 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2336,15 +2336,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - } - } - + } + } + - // Paper start - Entity serialization api - public boolean serializeEntity(CompoundTag compound) { - List pass = new java.util.ArrayList<>(this.getPassengers()); @@ -21,9 +21,9 @@ index cf0d8da4c4b5f4aa4e4ef15897ca252a2b52ec8d..95b6639d0075c2b86f83718b3093f972 - return result; - } - // Paper end - public boolean save(CompoundTag nbt) { - return this.isPassenger() ? false : this.saveAsPassenger(nbt); - } + public boolean save(CompoundTag nbt) { + return this.isPassenger() ? false : this.saveAsPassenger(nbt); + } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java index ffca5970a6259b024c9aa935e22cf72ed8cd8e9f..7c31515d1c0f199e8139d4c20651685b77edfcef 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/patches/server/0008-Don-t-save-Fireworks.patch b/patches/server/0008-Don-t-save-Fireworks.patch index 40ef579..f109739 100644 --- a/patches/server/0008-Don-t-save-Fireworks.patch +++ b/patches/server/0008-Don-t-save-Fireworks.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Don't save Fireworks diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 288910fb168ddc5d3a61971778b8038a56772fa8..f0b208b90f15ffd55572dbe94e2a1cc7a448aa0c 100644 +index 13f4cc12dcd6524713ce0715d08ef34d1a61e233..f0e14e0a7b93a82cc985946e49897ff936e06c5d 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -357,4 +357,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { - public boolean isAttackable() { - return false; - } + public boolean isAttackable() { + return false; + } + + // DivineMC start - Don't save Fireworks + @Override @@ -19,4 +19,4 @@ index 288910fb168ddc5d3a61971778b8038a56772fa8..f0b208b90f15ffd55572dbe94e2a1cc7 + return false; + } + // DivineMC end - } + } diff --git a/patches/server/0010-Remove-Spigot-tick-limiter.patch b/patches/server/0010-Remove-Spigot-tick-limiter.patch index c93a686..76cc48b 100644 --- a/patches/server/0010-Remove-Spigot-tick-limiter.patch +++ b/patches/server/0010-Remove-Spigot-tick-limiter.patch @@ -7,70 +7,70 @@ Original code by Titaniumtown, modified by NONPLAYT You can find the original code on https://gitlab.com/Titaniumtown/JettPack diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index de4a7223c672953c5d02d222638af7f9dcd602aa..7700383d188835f6ac47c75e084abc3524f1f221 100644 +index af556d9355e327fcbe50cb08f99026e7255f485f..237712e7c7727296ab7b499c4805fb51b7c1937f 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -182,8 +182,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final gq.bxteam.divinemc.configuration.DivineWorldConfig divinemcConfig; // DivineMC public final co.aikar.timings.WorldTimingsHandler timings; // Paper - public static BlockPos lastPhysicsProblem; // Spigot -- private org.spigotmc.TickLimiter entityLimiter; -- private org.spigotmc.TickLimiter tileLimiter; - private int tileTickPosition; + public static BlockPos lastPhysicsProblem; // Spigot +- private org.spigotmc.TickLimiter entityLimiter; +- private org.spigotmc.TickLimiter tileLimiter; + private int tileTickPosition; public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here @@ -425,8 +423,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - // CraftBukkit end + // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper -- this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); -- this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); +- this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); +- this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray - } - + } + diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 389bcb5e01d66f8e3915e09a49aace5176012191..d5271bc912632e694a10897717460893a1badf04 100644 +index 391b756455b536d1fbc4f0701f6e879800d6f05a..c68fbb101add3f156a3d855966c1de68a9ce4d81 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -450,6 +450,7 @@ public class SpigotWorldConfig this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 200 ); // DivineMC - optimize default values for configs - } - + } + + /* DivineMC - remove tick limiter - public int tileMaxTickTime; - public int entityMaxTickTime; - private void maxTickTimes() + public int tileMaxTickTime; + public int entityMaxTickTime; + private void maxTickTimes() @@ -458,6 +459,7 @@ public class SpigotWorldConfig - this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50); - this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms"); - } + this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50); + this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms"); + } + */ - - public int thunderChance; - private void thunderChance() + + public int thunderChance; + private void thunderChance() diff --git a/src/main/java/org/spigotmc/TickLimiter.java b/src/main/java/org/spigotmc/TickLimiter.java deleted file mode 100644 -index 4074538ea6090bf99d8ab04b1e98c2832a0e9a98..0000000000000000000000000000000000000000 +index 4b97e3e7d54ab699c407013b0d14c946419b5b72..0000000000000000000000000000000000000000 --- a/src/main/java/org/spigotmc/TickLimiter.java +++ /dev/null @@ -1,20 +0,0 @@ --package org.spigotmc; -- --public class TickLimiter { -- -- private final int maxTime; -- private long startTime; -- -- public TickLimiter(int maxtime) { -- this.maxTime = maxtime; -- } -- -- public void initTick() { -- this.startTime = System.currentTimeMillis(); -- } -- -- public boolean shouldContinue() { -- long remaining = System.currentTimeMillis() - this.startTime; -- return remaining < this.maxTime; -- } --} +-package org.spigotmc; +- +-public class TickLimiter { +- +- private final int maxTime; +- private long startTime; +- +- public TickLimiter(int maxtime) { +- this.maxTime = maxtime; +- } +- +- public void initTick() { +- this.startTime = System.currentTimeMillis(); +- } +- +- public boolean shouldContinue() { +- long remaining = System.currentTimeMillis() - this.startTime; +- return remaining < this.maxTime; +- } +-} diff --git a/patches/server/0012-Fallback-to-Dimension-if-World-UUID-is-unknown.patch b/patches/server/0012-Fallback-to-Dimension-if-World-UUID-is-unknown.patch index 789f5fb..062547b 100644 --- a/patches/server/0012-Fallback-to-Dimension-if-World-UUID-is-unknown.patch +++ b/patches/server/0012-Fallback-to-Dimension-if-World-UUID-is-unknown.patch @@ -20,17 +20,17 @@ index 9e802fbe8e5f1a3c24cb6bc9254c72a2a0c3fde1..cdf83dc33915632e29291c59eb184199 } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 725149019d69f3350b7235391092b1fbe2cd9dfb..fc67dc67664a207b761ff4d8df0a206bd4a41547 100644 +index e74c12c0421ba03e686804228b574c8dd8bc902c..575eef33d1f9715d55d3e7b46a43a2788ddbe884 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -102,6 +102,7 @@ import net.minecraft.world.scores.PlayerTeam; import net.minecraft.world.scores.Scoreboard; // Paper - import net.minecraft.world.scores.Team; - import org.slf4j.Logger; + import net.minecraft.world.scores.Team; + import org.slf4j.Logger; +import gq.bxteam.divinemc.configuration.DivineConfig; - - // CraftBukkit start - import java.util.stream.Collectors; + + // CraftBukkit start + import java.util.stream.Collectors; @@ -220,7 +221,14 @@ public abstract class PlayerList { if (bWorld != null) { resourcekey = ((CraftWorld) bWorld).getHandle().dimension(); diff --git a/patches/server/0013-Allow-any-username.patch b/patches/server/0013-Allow-any-username.patch index cd9764e..0135e70 100644 --- a/patches/server/0013-Allow-any-username.patch +++ b/patches/server/0013-Allow-any-username.patch @@ -20,23 +20,23 @@ index cdf83dc33915632e29291c59eb1841991c03e8a0..512afaa97e89e3beb92cf2ebc46248ed } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 01d5fa265fb2818465b5a71a2e2efeec751a7a05..85d0fbcc74500ccdd66e28c5ddcfc11a500dfab9 100644 +index f6b29b1e9e59a2f7d55bf4e20310c13809c53fdd..9eeba98dbeace0b8f73875c6df9f9b1ef3e0e17c 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -14,6 +14,8 @@ import java.util.concurrent.atomic.AtomicInteger; - import javax.annotation.Nullable; - import javax.crypto.Cipher; - import javax.crypto.SecretKey; + import javax.annotation.Nullable; + import javax.crypto.Cipher; + import javax.crypto.SecretKey; + +import gq.bxteam.divinemc.configuration.DivineConfig; - import net.minecraft.DefaultUncaughtExceptionHandler; - import net.minecraft.core.UUIDUtil; - import net.minecraft.network.Connection; + import net.minecraft.DefaultUncaughtExceptionHandler; + import net.minecraft.core.UUIDUtil; + import net.minecraft.network.Connection; @@ -240,7 +242,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - @Override - public void handleHello(ServerboundHelloPacket packet) { - Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]); -- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); + @Override + public void handleHello(ServerboundHelloPacket packet) { + Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]); +- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); + if (!DivineConfig.allowAnyUsername) Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); // DivineMC - Allow any username // Paper start - validate usernames if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) { diff --git a/patches/server/0016-Fix-MC-31819.patch b/patches/server/0016-Fix-MC-31819.patch index 1683225..73783a3 100644 --- a/patches/server/0016-Fix-MC-31819.patch +++ b/patches/server/0016-Fix-MC-31819.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Fix MC-31819 diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index d00035e31cf4773a418d1cc6a6018d08e6b558f0..9f5153580f96f643240a8817a74a47b22e2a85cc 100644 +index 9d0959169e2113847abe188ad20ba964fef30b5a..50d74f6cef9940d2890898ce42d762bf0697db1f 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -1968,6 +1968,11 @@ public abstract class Player extends LivingEntity { - } - - public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) { + } + + public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) { + // DivineMC start - Fix MC-31819 + if (this.level().getDifficulty() == Difficulty.PEACEFUL) { + return; + } + // DivineMC end - // CraftBukkit end - if (!this.abilities.invulnerable) { - if (!this.level().isClientSide) { + // CraftBukkit end + if (!this.abilities.invulnerable) { + if (!this.level().isClientSide) { diff --git a/patches/server/0018-Reduce-sensor-work.patch b/patches/server/0018-Reduce-sensor-work.patch index 0c6f4a4..0fd4eb8 100644 --- a/patches/server/0018-Reduce-sensor-work.patch +++ b/patches/server/0018-Reduce-sensor-work.patch @@ -7,16 +7,16 @@ Original project: Bloom-host/Petal Link: https://github.com/Bloom-host/Petal diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 0b08cf7b26731ffd6f3909342f4e3a92fe0c813e..c99ee6cd14b2d83ed1106d199b7f1a68a5165c8d 100644 +index ed5d5c86368de7885c57ebc8bc69e3fa9123b768..4b531ed118912b207391d66d1c028a3eb7b3f81f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1037,20 +1037,19 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - if (entity != null) { -- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); - EntityType entitytypes = entity.getType(); - + } + + if (entity != null) { +- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); + EntityType entitytypes = entity.getType(); + // Purpur start - if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL)) { + if (entitytypes == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL)) { // DivineMC - Reduce sensor work @@ -29,7 +29,7 @@ index 0b08cf7b26731ffd6f3909342f4e3a92fe0c813e..c99ee6cd14b2d83ed1106d199b7f1a68 - else if (entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) { + else if (entitytypes == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { // DivineMC - Reduce sensor work d0 *= entity.level().purpurConfig.creeperHeadVisibilityPercent; - } + } - else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && itemstack.is(Items.PIGLIN_HEAD)) { + else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD)) { // DivineMC - Reduce sensor work d0 *= entity.level().purpurConfig.piglinHeadVisibilityPercent; diff --git a/patches/server/0021-Do-not-process-chat-commands-before-player-has-joine.patch b/patches/server/0021-Do-not-process-chat-commands-before-player-has-joine.patch index 5b30a33..5a865dd 100644 --- a/patches/server/0021-Do-not-process-chat-commands-before-player-has-joine.patch +++ b/patches/server/0021-Do-not-process-chat-commands-before-player-has-joine.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Do not process chat/commands before player has joined diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9cc3ab8cd3f7ab7f8fbf4d9d14f25ea0bd757eec..8ba46e622a8be7d403f0f2e0bcda5b01c9c3fc62 100644 +index 0f18d5d1ba07ab2c377f94e4e65e0d0aa068c1a0..b4ff7b2c47db8498d41535795dbe9f7bbc5d29ed 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2484,6 +2484,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event ca }); // Paper - push to main - return Optional.empty(); + return Optional.empty(); + } else if (player.joining) { // DivineMC - EMC - do not handle chat messages before they joined + return Optional.empty(); - } else { - Optional optional = this.unpackAndApplyLastSeen(acknowledgment); - + } else { + Optional optional = this.unpackAndApplyLastSeen(acknowledgment); + diff --git a/patches/server/0022-Fix-MC-2025.patch b/patches/server/0022-Fix-MC-2025.patch index da42b67..84e3f54 100644 --- a/patches/server/0022-Fix-MC-2025.patch +++ b/patches/server/0022-Fix-MC-2025.patch @@ -7,7 +7,7 @@ Original post on Mojira: https://bugs.mojang.com/browse/MC-2025 Fix taken from Reddit: https://redd.it/8pgd4q diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 95b6639d0075c2b86f83718b3093f972d2e89b83..51b31ac8526a35e460c87ae467413db1f7c41752 100644 +index 7709077f8a9f8d724b4d3cc97a3660d13cfbb970..5a4742ada86f32a9e2d0735c62d3ec02bf76e9c5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2490,6 +2490,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -25,13 +25,13 @@ index 95b6639d0075c2b86f83718b3093f972d2e89b83..51b31ac8526a35e460c87ae467413db1 + nbt.put("DivineMC.BoundingBox", boundingBoxList); + // DivineMC end + - return nbt; - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); + return nbt; + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); @@ -2567,6 +2578,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - this.reapplyPosition(); - } - + this.reapplyPosition(); + } + + // DivineMC start - Fix MC-2025 + // This fix was taken from Reddit: https://redd.it/8pgd4q + if (nbt.contains("DivineMC.BoundingBox", net.minecraft.nbt.Tag.TAG_LIST)) { @@ -40,6 +40,6 @@ index 95b6639d0075c2b86f83718b3093f972d2e89b83..51b31ac8526a35e460c87ae467413db1 + } + // DivineMC end + - } else { - throw new IllegalStateException("Entity has invalid rotation"); - } + } else { + throw new IllegalStateException("Entity has invalid rotation"); + } diff --git a/patches/server/0023-Paper-PR-Optimize-Varints.patch b/patches/server/0023-Paper-PR-Optimize-Varints.patch index 4730129..789c291 100644 --- a/patches/server/0023-Paper-PR-Optimize-Varints.patch +++ b/patches/server/0023-Paper-PR-Optimize-Varints.patch @@ -23,22 +23,22 @@ index 512afaa97e89e3beb92cf2ebc46248eddd22cf5c..50878e4948df45bc2928edbe373be639 } \ No newline at end of file diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..2b1ae08ec33daedd0148f6731145a1d10a89277c 100644 +index 622421275a9408908be537f2263a4aa6233d4f88..ef6df345edc72e087cb8e4971d0648d110b58612 100644 --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java @@ -84,6 +84,8 @@ import org.joml.Vector3f; - - import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit - + + import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit + +import gq.bxteam.divinemc.configuration.DivineConfig; // DivineMC + - public class FriendlyByteBuf extends ByteBuf { - - private static final int MAX_VARINT_SIZE = 5; + public class FriendlyByteBuf extends ByteBuf { + + private static final int MAX_VARINT_SIZE = 5; @@ -104,7 +106,22 @@ public class FriendlyByteBuf extends ByteBuf { - this.source = parent; - } - + this.source = parent; + } + + // DivineMC start - Optimize varints + private static final int[] VARINT_EXACT_BYTE_LENGTHS = new int[33]; + static { @@ -49,19 +49,19 @@ index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..2b1ae08ec33daedd0148f6731145a1d1 + } + // DivineMC end + - public static int getVarIntSize(int value) { + public static int getVarIntSize(int value) { + // DivineMC start - Optimize varints + if (DivineConfig.doOptimizeVarints) { + return VARINT_EXACT_BYTE_LENGTHS[Integer.numberOfLeadingZeros(value)]; + } + // DivineMC end - for (int j = 1; j < 5; ++j) { - if ((value & -1 << j * 7) == 0) { - return j; + for (int j = 1; j < 5; ++j) { + if ((value & -1 << j * 7) == 0) { + return j; @@ -615,6 +632,23 @@ public class FriendlyByteBuf extends ByteBuf { - } - - public FriendlyByteBuf writeVarInt(int value) { + } + + public FriendlyByteBuf writeVarInt(int value) { + // DivineMC start - Optimize varints + if (DivineConfig.doOptimizeVarints) { + if ((value & (0xFFFFFFFF << 7)) == 0) { @@ -79,6 +79,6 @@ index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..2b1ae08ec33daedd0148f6731145a1d1 + return this; + } + // DivineMC end - while ((value & -128) != 0) { - this.writeByte(value & 127 | 128); - value >>>= 7; + while ((value & -128) != 0) { + this.writeByte(value & 127 | 128); + value >>>= 7; diff --git a/patches/server/0029-Fix-MC-7569.patch b/patches/server/0029-Fix-MC-7569.patch index 4cab46a..da9151e 100644 --- a/patches/server/0029-Fix-MC-7569.patch +++ b/patches/server/0029-Fix-MC-7569.patch @@ -6,15 +6,15 @@ Subject: [PATCH] Fix MC-7569 Original post on Mojira: https://bugs.mojang.com/browse/MC-7569 diff --git a/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java b/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java -index a04cf04cb694237ec77b38fc576f0dfc9264a25a..138a4394756ccfe5e9918420527dae70600a9e7b 100644 +index e040eeb4a100b36ab8ed26d33f0989561e8517d0..af66c1aa0f60bfc10b046bd0f441f3ac4aa7a921 100644 --- a/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java +++ b/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java @@ -55,7 +55,7 @@ public class RconConsoleSource implements CommandSource { - - @Override - public void sendSystemMessage(Component message) { -- this.buffer.append(message.getString()); + + @Override + public void sendSystemMessage(Component message) { +- this.buffer.append(message.getString()); + this.buffer.append(System.lineSeparator()); - } - - @Override + } + + @Override