diff --git a/gradle.properties b/gradle.properties index 9bd17cf..031a7a1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group = gq.bxteam.divinemc version = 1.20.1-R0.1-SNAPSHOT -purpurRef = 07b13f287c8c63e5b2f23c32c52e5d8012ff2eb7 +purpurRef = b0a7353a701d864b98296f9ccee79d39008860c4 org.gradle.caching = true org.gradle.parallel = true diff --git a/patches/server/0001-Divine-Branding.patch b/patches/server/0001-Divine-Branding.patch index 8ac94a4..1a7f86c 100644 --- a/patches/server/0001-Divine-Branding.patch +++ b/patches/server/0001-Divine-Branding.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Divine Branding diff --git a/build.gradle.kts b/build.gradle.kts -index 139e2b17b899da6f0147bb8b4412e2e54e817be4..43a14a0d0e545861c7625bc50704a062717c5fde 100644 +index 92118ece03afbe49bbe4dbe8a54c6d434434bd0c..8b450ebbb67416bbb395ed25114e8121b028fd6a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,7 +14,7 @@ val alsoShade: Configuration by configurations.creating @@ -138,31 +138,31 @@ 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 73c2719a6f5410fec8511ba53362f87bb74c9a1a..17af7e23cba6d99fecde12f954c832de71f42947 100644 +index a1a3b66e53e7be6b913302a5da15271f6fdc1639..380cc144d4889917298bdc2ebd691f6478a47470 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 8cb10fa24bea1ffd3ea3a5f3d471c118a5713257..3a42575a50cf59def579fd7dcfc3cd3865a2ace1 100644 +index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..627ceea9fa0fccd3e466eb34d59e760be30a69a8 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 3633574e112f217b412217dd243a631dc4e9c40c..1f54e2ec6d73853001642bcf4b355c4a0dd10f6d 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -177,7 +177,7 @@ index 3633574e112f217b412217dd243a631dc4e9c40c..1f54e2ec6d73853001642bcf4b355c4a 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 8b1a446c986c4fae8c0ad810f34e231f0e360dbe..f11529ff35eeff916b84010d02c987779f480cf0 100644 +index dbd502761ff6e6efb252bb41376a7ff028c73895..33a6b34564bbf15b82ae81a3321f05388c72950f 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 8b1a446c986c4fae8c0ad810f34e231f0e360dbe..f11529ff35eeff916b84010d02c98777 } // 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 23353f4..088d9a8 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 0da72241f940bd81a5d122d9d6ac2871f4d834e6..af53310d196020682dd981da98261fb3a72a6690 100644 +index 3adc2b50d08bb27fed95c948cff9905e069a033c..bd86f0468b825e568060894f1a4233d43bb56fc5 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,75 +344,75 @@ index 0da72241f940bd81a5d122d9d6ac2871f4d834e6..af53310d196020682dd981da98261fb3 + 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 2fa984bef4335f6042a4a0ab0af9af81e52984b7..af556d9355e327fcbe50cb08f99026e7255f485f 100644 +index 713a091b8083e46b395311889c2a1482279c27ec..bddbc39bb6f82e90b25ef6b101ef7124db63660c 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 17af7e23cba6d99fecde12f954c832de71f42947..e08d2d94ca6332bfee1b186eae0e728aee60eb37 100644 +index 380cc144d4889917298bdc2ebd691f6478a47470..3ab4e225e926b960f6cd84dad6c697283e45a25f 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; -@@ -1072,6 +1073,7 @@ public final class CraftServer implements Server { - org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot + import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.awt.image.BufferedImage; + import java.io.ByteArrayOutputStream; +@@ -1050,6 +1051,7 @@ public final class CraftServer implements Server { + 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 +@@ -1066,6 +1068,7 @@ public final class CraftServer implements Server { + } + 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 +@@ -1082,6 +1085,7 @@ public final class CraftServer implements Server { + 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"); - -@@ -3016,6 +3020,13 @@ public final class CraftServer implements Server { + this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); + this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); + +@@ -2994,6 +2998,13 @@ public final class CraftServer implements Server { } // Purpur end @@ -423,11 +423,11 @@ index 17af7e23cba6d99fecde12f954c832de71f42947..e08d2d94ca6332bfee1b186eae0e728a + } + // 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 898e9c968c12b2dc62ee4da11202e5a633ee2203..ff09eef761ca7c0d6a09ce8fcfbdf1ac14ca5956 100644 +index 4bc0a370c7aec06d30b4ebf7fa7d73263d0543bc..e133dfa306a824bdb41e523dd778fba318087ec7 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 07618e0..c766ffd 100644 --- a/patches/server/0004-Optimize-default-values-for-configs.patch +++ b/patches/server/0004-Optimize-default-values-for-configs.patch @@ -49,7 +49,7 @@ index 3bc7230ca62ebe3426da293e436a962bb0134f85..fd93efca790b75e8300202342c45b845 public boolean strictAdvancementDimensionCheck = false; public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT; diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543b08af197 100644 +index f45afb7e2607617d1239abeca13a9002dd9a3a18..2c544d5c37df05ff609eb07f709c67b751115ef0 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java @@ -119,9 +119,9 @@ public class WorldConfiguration extends ConfigurationPart { @@ -94,7 +94,7 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 public PillagerPatrols pillagerPatrols; public class PillagerPatrols extends ConfigurationPart { -@@ -371,7 +371,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -372,7 +372,7 @@ public class WorldConfiguration extends ConfigurationPart { public class Environment extends ConfigurationPart { public boolean disableThunder = false; public boolean disableIceAndSnow = false; @@ -103,7 +103,7 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 public boolean disableExplosionKnockback = false; public boolean generateFlatBedrock = false; public FrostedIce frostedIce; -@@ -417,7 +417,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -418,7 +418,7 @@ public class WorldConfiguration extends ConfigurationPart { public class Maps extends ConfigurationPart { public int itemFrameCursorLimit = 128; @@ -112,7 +112,7 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 } public Fixes fixes; -@@ -443,7 +443,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -444,7 +444,7 @@ public class WorldConfiguration extends ConfigurationPart { public class Hopper extends ConfigurationPart { public boolean cooldownWhenFull = true; public boolean disableMoveEvent = false; @@ -121,7 +121,7 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 } public Collisions collisions; -@@ -451,9 +451,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -452,9 +452,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Collisions extends ConfigurationPart { public boolean onlyPlayersCollide = false; public boolean allowVehicleCollisions = true; @@ -133,7 +133,7 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 public boolean allowPlayerCrammingDamage = false; } -@@ -461,18 +461,31 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -462,18 +462,31 @@ public class WorldConfiguration extends ConfigurationPart { public class Chunks extends ConfigurationPart { public AutosavePeriod autoSaveInterval = AutosavePeriod.def(); @@ -175,7 +175,7 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 }); public boolean flushRegionsOnSave = false; } -@@ -487,11 +500,22 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -488,11 +501,22 @@ public class WorldConfiguration extends ConfigurationPart { public TickRates tickRates; public class TickRates extends ConfigurationPart { @@ -203,7 +203,7 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 } @Setting(FeatureSeedsGeneration.FEATURE_SEEDS_KEY) -@@ -499,7 +523,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -500,7 +524,7 @@ public class WorldConfiguration extends ConfigurationPart { public class FeatureSeeds extends ConfigurationPart.Post { @Setting(FeatureSeedsGeneration.GENERATE_KEY) @@ -212,7 +212,7 @@ index da7c899fbab162ee197a0593f455ebd9c5286d3c..8f972b42bc952255b5ca03d7dad2e543 @Setting(FeatureSeedsGeneration.FEATURES_KEY) public Reference2LongMap>> features = new Reference2LongOpenHashMap<>(); -@@ -513,9 +537,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -514,9 +538,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Misc extends ConfigurationPart { public int lightQueueSize = 20; @@ -238,71 +238,71 @@ index 1f54e2ec6d73853001642bcf4b355c4a0dd10f6d..d8d19567cf49b41d730a936d46c8e37e useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive); } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 455caa1ded6383e62d7010280d39d6febeac00d7..c0b55ece770e7231b2d90d3e17036b7d579b8b50 100644 +index 612c3169c3463d702b85975e1db79ae6e47d60d0..2138104c5612aac9bdddd7a4feed0f21d08c8d04 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -335,7 +335,7 @@ public class SpigotConfig - public static boolean saveUserCacheOnStopOnly; - private static void saveUserCacheOnStopOnly() - { -- SpigotConfig.saveUserCacheOnStopOnly = SpigotConfig.getBoolean( "settings.save-user-cache-on-stop-only", false ); + public static boolean saveUserCacheOnStopOnly; + private static void saveUserCacheOnStopOnly() + { +- SpigotConfig.saveUserCacheOnStopOnly = SpigotConfig.getBoolean( "settings.save-user-cache-on-stop-only", false ); + SpigotConfig.saveUserCacheOnStopOnly = SpigotConfig.getBoolean( "settings.save-user-cache-on-stop-only", true ); // DivineMC - optimize default values for configs - } - - public static double movedWronglyThreshold; + } + + public static double movedWronglyThreshold; @@ -396,8 +396,10 @@ public class SpigotConfig - public static boolean logVillagerDeaths; - public static boolean logNamedDeaths; - private static void logDeaths() { -- SpigotConfig.logVillagerDeaths = SpigotConfig.getBoolean("settings.log-villager-deaths", true); -- SpigotConfig.logNamedDeaths = SpigotConfig.getBoolean("settings.log-named-deaths", true); + public static boolean logVillagerDeaths; + public static boolean logNamedDeaths; + private static void logDeaths() { +- SpigotConfig.logVillagerDeaths = SpigotConfig.getBoolean("settings.log-villager-deaths", true); +- SpigotConfig.logNamedDeaths = SpigotConfig.getBoolean("settings.log-named-deaths", true); + // DivineMC start - optimize default values for configs + SpigotConfig.logVillagerDeaths = SpigotConfig.getBoolean("settings.log-villager-deaths", false); + SpigotConfig.logNamedDeaths = SpigotConfig.getBoolean("settings.log-named-deaths", false); + // DivineMC end - } - - public static boolean disablePlayerDataSaving; + } + + public static boolean disablePlayerDataSaving; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index c19d2bad1d80102543f3cd2718a22cd1942ffbd2..391b756455b536d1fbc4f0701f6e879800d6f05a 100644 +index 5b5109e942b18418b3a3a0e2109fe4ef15045fe5..389bcb5e01d66f8e3915e09a49aace5176012191 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; @@ -317,55 +317,55 @@ index c19d2bad1d80102543f3cd2718a22cd1942ffbd2..391b756455b536d1fbc4f0701f6e8798 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 347e297..7222ce7 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 c50f9133f043b78cfabcd9569dfd1bdd62b952a1..7709077f8a9f8d724b4d3cc97a3660d13cfbb970 100644 +index cf0d8da4c4b5f4aa4e4ef15897ca252a2b52ec8d..95b6639d0075c2b86f83718b3093f972d2e89b83 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 c50f9133f043b78cfabcd9569dfd1bdd62b952a1..7709077f8a9f8d724b4d3cc97a3660d1 - 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 f109739..40ef579 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 13f4cc12dcd6524713ce0715d08ef34d1a61e233..f0e14e0a7b93a82cc985946e49897ff936e06c5d 100644 +index 288910fb168ddc5d3a61971778b8038a56772fa8..f0b208b90f15ffd55572dbe94e2a1cc7a448aa0c 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 13f4cc12dcd6524713ce0715d08ef34d1a61e233..f0e14e0a7b93a82cc985946e49897ff9 + 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 76cc48b..67d3fa5 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 af556d9355e327fcbe50cb08f99026e7255f485f..237712e7c7727296ab7b499c4805fb51b7c1937f 100644 +index bddbc39bb6f82e90b25ef6b101ef7124db63660c..41d1bc0d3cf8502d48f2f957248d382fe58dedf3 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 391b756455b536d1fbc4f0701f6e879800d6f05a..c68fbb101add3f156a3d855966c1de68a9ce4d81 100644 +index 389bcb5e01d66f8e3915e09a49aace5176012191..d5271bc912632e694a10897717460893a1badf04 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 4b97e3e7d54ab699c407013b0d14c946419b5b72..0000000000000000000000000000000000000000 +index 4074538ea6090bf99d8ab04b1e98c2832a0e9a98..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 062547b..35c6e3a 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 e74c12c0421ba03e686804228b574c8dd8bc902c..575eef33d1f9715d55d3e7b46a43a2788ddbe884 100644 +index 824f31b68b38f2f8642fb9d59a123cfdaffbb7b2..cff386bef828950dd4e509da80283a51a423dd97 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 0135e70..cd9764e 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 f6b29b1e9e59a2f7d55bf4e20310c13809c53fdd..9eeba98dbeace0b8f73875c6df9f9b1ef3e0e17c 100644 +index 01d5fa265fb2818465b5a71a2e2efeec751a7a05..85d0fbcc74500ccdd66e28c5ddcfc11a500dfab9 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 73783a3..1683225 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 9d0959169e2113847abe188ad20ba964fef30b5a..50d74f6cef9940d2890898ce42d762bf0697db1f 100644 +index d00035e31cf4773a418d1cc6a6018d08e6b558f0..9f5153580f96f643240a8817a74a47b22e2a85cc 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 0fd4eb8..04c8961 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 ed5d5c86368de7885c57ebc8bc69e3fa9123b768..4b531ed118912b207391d66d1c028a3eb7b3f81f 100644 +index 49906b4dc8392eee592215d0b4cba85267a875fc..e8cf6062fa427a2efdaca1e354805aa4cd58a2e0 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 ed5d5c86368de7885c57ebc8bc69e3fa9123b768..4b531ed118912b207391d66d1c028a3e - 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 deleted file mode 100644 index 5a865dd..0000000 --- a/patches/server/0021-Do-not-process-chat-commands-before-player-has-joine.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 11 Jun 2023 23:43:00 +0300 -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 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(); -+ } else if (player.joining) { // DivineMC - EMC - do not handle chat messages before they joined -+ return Optional.empty(); - } else { - Optional optional = this.unpackAndApplyLastSeen(acknowledgment); - diff --git a/patches/server/0022-Fix-MC-2025.patch b/patches/server/0021-Fix-MC-2025.patch similarity index 95% rename from patches/server/0022-Fix-MC-2025.patch rename to patches/server/0021-Fix-MC-2025.patch index 84e3f54..da42b67 100644 --- a/patches/server/0022-Fix-MC-2025.patch +++ b/patches/server/0021-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 7709077f8a9f8d724b4d3cc97a3660d13cfbb970..5a4742ada86f32a9e2d0735c62d3ec02bf76e9c5 100644 +index 95b6639d0075c2b86f83718b3093f972d2e89b83..51b31ac8526a35e460c87ae467413db1f7c41752 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 7709077f8a9f8d724b4d3cc97a3660d13cfbb970..5a4742ada86f32a9e2d0735c62d3ec02 + 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 7709077f8a9f8d724b4d3cc97a3660d13cfbb970..5a4742ada86f32a9e2d0735c62d3ec02 + } + // 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/0022-Paper-PR-Optimize-Varints.patch similarity index 96% rename from patches/server/0023-Paper-PR-Optimize-Varints.patch rename to patches/server/0022-Paper-PR-Optimize-Varints.patch index 789c291..4730129 100644 --- a/patches/server/0023-Paper-PR-Optimize-Varints.patch +++ b/patches/server/0022-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 622421275a9408908be537f2263a4aa6233d4f88..ef6df345edc72e087cb8e4971d0648d110b58612 100644 +index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..2b1ae08ec33daedd0148f6731145a1d10a89277c 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 622421275a9408908be537f2263a4aa6233d4f88..ef6df345edc72e087cb8e4971d0648d1 + } + // 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 622421275a9408908be537f2263a4aa6233d4f88..ef6df345edc72e087cb8e4971d0648d1 + 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/0024-Bump-Dependencies.patch b/patches/server/0023-Bump-Dependencies.patch similarity index 95% rename from patches/server/0024-Bump-Dependencies.patch rename to patches/server/0023-Bump-Dependencies.patch index fa35b26..b181d62 100644 --- a/patches/server/0024-Bump-Dependencies.patch +++ b/patches/server/0023-Bump-Dependencies.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Bump Dependencies diff --git a/build.gradle.kts b/build.gradle.kts -index 6f39b026ab819e05e544a4049bd766a5aa73b16a..6455172a5cd3bf9a7b27831c67249022e535cdba 100644 +index 8b450ebbb67416bbb395ed25114e8121b028fd6a..8e3360b7b4606955803d12585dccb5197165575b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,8 +37,8 @@ dependencies { diff --git a/patches/server/0025-lithium-collections.gamerules.patch b/patches/server/0024-lithium-collections.gamerules.patch similarity index 100% rename from patches/server/0025-lithium-collections.gamerules.patch rename to patches/server/0024-lithium-collections.gamerules.patch diff --git a/patches/server/0026-Optimize-Paper-Event-Manager.patch b/patches/server/0025-Optimize-Paper-Event-Manager.patch similarity index 100% rename from patches/server/0026-Optimize-Paper-Event-Manager.patch rename to patches/server/0025-Optimize-Paper-Event-Manager.patch diff --git a/patches/server/0027-Fix-MC-65198.patch b/patches/server/0026-Fix-MC-65198.patch similarity index 97% rename from patches/server/0027-Fix-MC-65198.patch rename to patches/server/0026-Fix-MC-65198.patch index a5c7519..3259abd 100644 --- a/patches/server/0027-Fix-MC-65198.patch +++ b/patches/server/0026-Fix-MC-65198.patch @@ -27,7 +27,7 @@ index 102739c0089ff3f6b3432f954304d43a3dfebc35..d925153b39ac4ddd273f84fb3d6cb071 } diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java -index ddf87ef1979c4ae4f14cd6aa220f9146d5e20909..1ce8f9a84d321a79bdca574feeb8b061f79e46f5 100644 +index 46d1f768e4dcc2942ee7af81ee2713df10251731..311c3054c4a44043ddc32b1560b9a4d65d494402 100644 --- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java +++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java @@ -45,7 +45,7 @@ public class ResultSlot extends Slot { diff --git a/patches/server/0028-Make-entity-goals-public.patch b/patches/server/0027-Make-entity-goals-public.patch similarity index 100% rename from patches/server/0028-Make-entity-goals-public.patch rename to patches/server/0027-Make-entity-goals-public.patch diff --git a/patches/server/0029-Fix-MC-7569.patch b/patches/server/0028-Fix-MC-7569.patch similarity index 88% rename from patches/server/0029-Fix-MC-7569.patch rename to patches/server/0028-Fix-MC-7569.patch index da9151e..03411a7 100644 --- a/patches/server/0029-Fix-MC-7569.patch +++ b/patches/server/0028-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 e040eeb4a100b36ab8ed26d33f0989561e8517d0..af66c1aa0f60bfc10b046bd0f441f3ac4aa7a921 100644 +index c323245efdd711ec4299dd0be66d5dad1fbf2b3e..da11b58b1e5e77a3c527f5778cfe10c79bdd88b0 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 diff --git a/patches/server/0030-Fix-MC-93018.patch b/patches/server/0029-Fix-MC-93018.patch similarity index 100% rename from patches/server/0030-Fix-MC-93018.patch rename to patches/server/0029-Fix-MC-93018.patch diff --git a/patches/server/0030-Do-not-process-chat-commands-before-player-has-joine.patch b/patches/server/0030-Do-not-process-chat-commands-before-player-has-joine.patch new file mode 100644 index 0000000..bea2fac --- /dev/null +++ b/patches/server/0030-Do-not-process-chat-commands-before-player-has-joine.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Mon, 18 Sep 2023 00:35:27 +0300 +Subject: [PATCH] Do not process chat/commands before player has joined + + +diff --git a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java +index 50878e4948df45bc2928edbe373be639d133060f..429efd08e218a780d181d24f0522b0e499fadbf3 100644 +--- a/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java ++++ b/src/main/java/gq/bxteam/divinemc/configuration/DivineConfig.java +@@ -167,4 +167,9 @@ public class DivineConfig { + private static void doOptimizeVarints() { + doOptimizeVarints = getBoolean("settings.optimization.optimize-varints", doOptimizeVarints); + } ++ ++ public static boolean doNotProcessChatCommands = true; ++ private static void doNotProcessChatCommands() { ++ doNotProcessChatCommands = getBoolean("settings.do-not-process-chat-commands", doNotProcessChatCommands); ++ } + } +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 255b422078880b46dfa6f5140f6c92fef057d09e..0b2b8d6417d72860763aa6f2872280229a89464e 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -5,6 +5,7 @@ import com.google.common.primitives.Floats; + import com.mojang.brigadier.ParseResults; + import com.mojang.brigadier.StringReader; + import com.mojang.logging.LogUtils; ++import gq.bxteam.divinemc.configuration.DivineConfig; + import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; + import it.unimi.dsi.fastutil.ints.Int2ObjectMaps; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +@@ -2484,6 +2485,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 causes + }); // Paper - push to main + return Optional.empty(); ++ } else if (player.joining && DivineConfig.doNotProcessChatCommands) { // DivineMC - EMC - do not handle chat messages before they joined ++ return Optional.empty(); + } else { + Optional optional = this.unpackAndApplyLastSeen(acknowledgment); +