diff --git a/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch b/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch index 18e92af..fa5a05d 100644 --- a/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch +++ b/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Multithreaded Tracker diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index c06784f401dbdc8c215876aa86cd1a7289bd4332..f81cc357618c70f2fcf0bc24b0b25be566ffffcc 100644 +index 8ffe79b81777015ff807538e461ec68463225557..b28083be4384d6c5efbdce898a0e9d7a2f5bd3d3 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java @@ -342,7 +342,11 @@ public final class RegionizedPlayerChunkLoader { @@ -243,10 +243,10 @@ index d9bd09b52db10cad5ad5c392649379ab1e5dab8c..95d24f500e919f1deae1b7b1ce6e67fa } diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 032d298dadb64ceb5f110a62402a08f78fc99c34..a854dbd0610fad8322985bf71afdc952fc25dcf2 100644 +index 420c9993df062466b85d60fe3fcc915e24d3da2a..19c7802969aa9d1e15b4c67ee5c97e73daf0a460 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1816,7 +1816,7 @@ public class ServerGamePacketListenerImpl +@@ -1822,7 +1822,7 @@ public class ServerGamePacketListenerImpl } public void internalTeleport(PositionMoveRotation posMoveRotation, Set relatives) { diff --git a/divinemc-server/minecraft-patches/features/0014-Some-optimizations.patch b/divinemc-server/minecraft-patches/features/0014-Some-optimizations.patch index 57d83c9..acc40aa 100644 --- a/divinemc-server/minecraft-patches/features/0014-Some-optimizations.patch +++ b/divinemc-server/minecraft-patches/features/0014-Some-optimizations.patch @@ -75,7 +75,7 @@ index 2a708ae0d5bb209650b525e3c56051f8b5655074..762cba15597623f95a242bdd44742d9b @Override diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index 70ee86993d381445855ac7e7290da384d6675987..532d71cc1eaee799c193eb43085beb8c5892eac7 100644 +index bc22d67bba9b1ebb6bef84f5326375100d24461d..4aa5ecf3e7a7f58505de583dba7738dc1a596d72 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java @@ -841,7 +841,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -108,10 +108,38 @@ index 70ee86993d381445855ac7e7290da384d6675987..532d71cc1eaee799c193eb43085beb8c protected final void serverAiStep() { this.noActionTime++; diff --git a/net/minecraft/world/level/LocalMobCapCalculator.java b/net/minecraft/world/level/LocalMobCapCalculator.java -index 9641219c190261dea0db5f95f040a705ba0a3ff9..7ba64e71cfed16f07a9e1283145653745adb6388 100644 +index 9641219c190261dea0db5f95f040a705ba0a3ff9..91966607f8f48b56e2c7e9389bd7d8acda99a48d 100644 --- a/net/minecraft/world/level/LocalMobCapCalculator.java +++ b/net/minecraft/world/level/LocalMobCapCalculator.java -@@ -42,14 +42,14 @@ public class LocalMobCapCalculator { +@@ -13,16 +13,24 @@ import net.minecraft.world.entity.MobCategory; + + public class LocalMobCapCalculator { + private final Long2ObjectMap> playersNearChunk = new Long2ObjectOpenHashMap<>(); +- private final Map playerMobCounts = Maps.newHashMap(); ++ private final Map playerMobCounts = Maps.newConcurrentMap(); // DivineMC - Some optimizations + private final ChunkMap chunkMap; + + public LocalMobCapCalculator(ChunkMap chunkMap) { + this.chunkMap = chunkMap; + } + +- private List getPlayersNear(ChunkPos pos) { +- return this.playersNearChunk.computeIfAbsent(pos.toLong(), key -> this.chunkMap.getPlayersCloseForSpawning(pos)); ++ // DivineMC start - Some optimizations ++ private synchronized @org.jetbrains.annotations.NotNull List getPlayersNear(ChunkPos pos) { ++ List retVal = this.playersNearChunk.get(pos.toLong()); ++ if (retVal == null) { ++ List newVal = this.chunkMap.getPlayersCloseForSpawning(pos); ++ this.playersNearChunk.put(pos.toLong(), newVal); ++ return newVal; ++ } ++ return retVal; + } ++ // DivineMC end - Some optimizations + + public void addMob(ChunkPos pos, MobCategory category) { + for (ServerPlayer serverPlayer : this.getPlayersNear(pos)) { +@@ -42,14 +50,14 @@ public class LocalMobCapCalculator { } static class MobCounts { diff --git a/divinemc-server/minecraft-patches/features/0018-Option-to-allow-weird-movement-and-disable-teleporti.patch b/divinemc-server/minecraft-patches/features/0018-Option-to-allow-weird-movement-and-disable-teleporti.patch index 9b43319..8d692e9 100644 --- a/divinemc-server/minecraft-patches/features/0018-Option-to-allow-weird-movement-and-disable-teleporti.patch +++ b/divinemc-server/minecraft-patches/features/0018-Option-to-allow-weird-movement-and-disable-teleporti.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Option to allow weird movement and disable teleporting diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a854dbd0610fad8322985bf71afdc952fc25dcf2..e91232064a5024859954a04f549cb3b6e78da6bd 100644 +index 19c7802969aa9d1e15b4c67ee5c97e73daf0a460..b2881d1b0cc2bc172dd21349e07b7e6f89bd996c 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -574,7 +574,7 @@ public class ServerGamePacketListenerImpl @@ -27,7 +27,7 @@ index a854dbd0610fad8322985bf71afdc952fc25dcf2..e91232064a5024859954a04f549cb3b6 flag2 = true; // Paper - diff on change, this should be moved wrongly LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getName().getString(), this.player.getName().getString(), Math.sqrt(d7)); } -@@ -1447,18 +1447,22 @@ public class ServerGamePacketListenerImpl +@@ -1453,18 +1453,22 @@ public class ServerGamePacketListenerImpl if (this.shouldCheckPlayerMovement(isFallFlying)) { float f2 = isFallFlying ? 300.0F : 100.0F; if (d7 - d6 > Math.max(f2, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed))) { @@ -60,7 +60,7 @@ index a854dbd0610fad8322985bf71afdc952fc25dcf2..e91232064a5024859954a04f549cb3b6 } } } -@@ -1519,6 +1523,7 @@ public class ServerGamePacketListenerImpl +@@ -1525,6 +1529,7 @@ public class ServerGamePacketListenerImpl d7 = d3 * d3 + d4 * d4 + d5 * d5; boolean movedWrongly = false; // Paper - Add fail move event; rename if (!this.player.isChangingDimension() diff --git a/divinemc-server/minecraft-patches/features/0024-Block-Log4Shell-exploit.patch b/divinemc-server/minecraft-patches/features/0024-Block-Log4Shell-exploit.patch index 80b3238..dba6bf5 100644 --- a/divinemc-server/minecraft-patches/features/0024-Block-Log4Shell-exploit.patch +++ b/divinemc-server/minecraft-patches/features/0024-Block-Log4Shell-exploit.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block Log4Shell exploit diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e91232064a5024859954a04f549cb3b6e78da6bd..2dc21a17ece24dc3f6ab7002fb4a8379c82da787 100644 +index b2881d1b0cc2bc172dd21349e07b7e6f89bd996c..c96c13ff7e2f0f62166e429dcb66ff5217604c32 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2419,6 +2419,7 @@ public class ServerGamePacketListenerImpl +@@ -2425,6 +2425,7 @@ public class ServerGamePacketListenerImpl } private void tryHandleChat(String message, Runnable handler, boolean sync) { // CraftBukkit @@ -16,7 +16,7 @@ index e91232064a5024859954a04f549cb3b6e78da6bd..2dc21a17ece24dc3f6ab7002fb4a8379 if (isChatMessageIllegal(message)) { this.disconnectAsync(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add proper async disconnect } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales -@@ -2447,6 +2448,15 @@ public class ServerGamePacketListenerImpl +@@ -2453,6 +2454,15 @@ public class ServerGamePacketListenerImpl } } diff --git a/divinemc-server/minecraft-patches/features/0035-Virtual-Threads.patch b/divinemc-server/minecraft-patches/features/0035-Virtual-Threads.patch index e4faa35..e51f471 100644 --- a/divinemc-server/minecraft-patches/features/0035-Virtual-Threads.patch +++ b/divinemc-server/minecraft-patches/features/0035-Virtual-Threads.patch @@ -54,10 +54,10 @@ index 8c6c7f2296e4dca882c9f349772aec02e9d92ee1..3bb5f956c2763007a83bc209d339c015 public ChatDecorator getChatDecorator() { diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2dc21a17ece24dc3f6ab7002fb4a8379c82da787..474642146a1b9c665b92368d8a9cffa3a75b9fd3 100644 +index c96c13ff7e2f0f62166e429dcb66ff5217604c32..6bcf21bd3210c161c67d6301585ac8b1f79a325e 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -802,8 +802,11 @@ public class ServerGamePacketListenerImpl +@@ -808,8 +808,11 @@ public class ServerGamePacketListenerImpl } // Paper start - AsyncTabCompleteEvent diff --git a/divinemc-server/minecraft-patches/features/0039-Option-to-disable-disconnect.spam.patch b/divinemc-server/minecraft-patches/features/0039-Option-to-disable-disconnect.spam.patch index f8dd15a..c0630f4 100644 --- a/divinemc-server/minecraft-patches/features/0039-Option-to-disable-disconnect.spam.patch +++ b/divinemc-server/minecraft-patches/features/0039-Option-to-disable-disconnect.spam.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable disconnect.spam diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 474642146a1b9c665b92368d8a9cffa3a75b9fd3..4b0471c1df6f6533211ecbbbc53b013fdb2e36b1 100644 +index 6bcf21bd3210c161c67d6301585ac8b1f79a325e..be7d6eab61787e34fc585af2851548a68b7eacc2 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -813,7 +813,7 @@ public class ServerGamePacketListenerImpl +@@ -819,7 +819,7 @@ public class ServerGamePacketListenerImpl public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start @@ -17,7 +17,7 @@ index 474642146a1b9c665b92368d8a9cffa3a75b9fd3..4b0471c1df6f6533211ecbbbc53b013f this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect return; } -@@ -825,7 +825,7 @@ public class ServerGamePacketListenerImpl +@@ -831,7 +831,7 @@ public class ServerGamePacketListenerImpl // Paper end - Don't suggest if tab-complete is disabled // Paper start final int index; @@ -26,7 +26,7 @@ index 474642146a1b9c665b92368d8a9cffa3a75b9fd3..4b0471c1df6f6533211ecbbbc53b013f this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - add proper async disconnect return; } -@@ -885,6 +885,7 @@ public class ServerGamePacketListenerImpl +@@ -891,6 +891,7 @@ public class ServerGamePacketListenerImpl ParseResults parseResults = this.server.getCommands().getDispatcher().parse(stringReader, this.player.createCommandSourceStack()); // Paper start - Handle non-recoverable exceptions if (!parseResults.getExceptions().isEmpty() @@ -34,7 +34,7 @@ index 474642146a1b9c665b92368d8a9cffa3a75b9fd3..4b0471c1df6f6533211ecbbbc53b013f && parseResults.getExceptions().values().stream().anyMatch(e -> e instanceof io.papermc.paper.brigadier.TagParseCommandSyntaxException)) { this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); return; -@@ -2616,6 +2617,7 @@ public class ServerGamePacketListenerImpl +@@ -2622,6 +2623,7 @@ public class ServerGamePacketListenerImpl // this.chatSpamThrottler.increment(); if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() // CraftBukkit end @@ -42,7 +42,7 @@ index 474642146a1b9c665b92368d8a9cffa3a75b9fd3..4b0471c1df6f6533211ecbbbc53b013f && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause & add proper async disconnect -@@ -3394,7 +3396,7 @@ public class ServerGamePacketListenerImpl +@@ -3400,7 +3402,7 @@ public class ServerGamePacketListenerImpl public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { diff --git a/divinemc-server/minecraft-patches/features/0043-Command-block-parse-results-caching.patch b/divinemc-server/minecraft-patches/features/0043-Command-block-parse-results-caching.patch new file mode 100644 index 0000000..3c5abb6 --- /dev/null +++ b/divinemc-server/minecraft-patches/features/0043-Command-block-parse-results-caching.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sat, 15 Mar 2025 22:01:08 +0300 +Subject: [PATCH] Command block parse results caching + + +diff --git a/net/minecraft/world/level/BaseCommandBlock.java b/net/minecraft/world/level/BaseCommandBlock.java +index 8c883ff13866d6416bd70cc61ab1e37dd1a5b33c..7bd3507837862b8afb8227a85a44c879692a9631 100644 +--- a/net/minecraft/world/level/BaseCommandBlock.java ++++ b/net/minecraft/world/level/BaseCommandBlock.java +@@ -32,6 +32,10 @@ public abstract class BaseCommandBlock implements CommandSource { + private String command = ""; + @Nullable + private Component customName; ++ // DivineMC start - Caching command block parse results ++ private String lastExecutedCommand; ++ private com.mojang.brigadier.ParseResults parseResultsCache; ++ // DivineMC end - Caching command block parse results + // CraftBukkit start + @Override + public abstract org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper); +@@ -131,7 +135,35 @@ public abstract class BaseCommandBlock implements CommandSource { + this.successCount++; + } + }); +- server.getCommands().dispatchServerCommand(commandSourceStack, this.command); // CraftBukkit ++ // DivineMC start - Command block parse results caching ++ if (org.bxteam.divinemc.DivineConfig.commandBlockParseResultsCaching) { ++ String commandCache = this.command; ++ // noinspection DuplicatedCode ++ com.google.common.base.Joiner joiner = com.google.common.base.Joiner.on(" "); ++ ++ if (commandCache.startsWith("/")) { ++ commandCache = commandCache.substring(1); ++ } ++ ++ org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(commandSourceStack.getBukkitSender(), commandCache); ++ org.bukkit.Bukkit.getPluginManager().callEvent(event); ++ if (!event.isCancelled()) { ++ commandCache = event.getCommand(); ++ String[] args = commandCache.split(" "); ++ ++ if (args.length != 0) { ++ String newCommand = joiner.join(args); ++ if (!newCommand.equals(lastExecutedCommand) || parseResultsCache == null) { ++ MinecraftServer.LOGGER.info("Recompiling parse results cache for command block at ({}, {}, {})", this.getPosition().x, this.getPosition().y, this.getPosition().z); ++ this.cache(server.getCommands().getDispatcher(), commandSourceStack, newCommand); ++ } ++ server.getCommands().performCommand(parseResultsCache, newCommand); ++ } ++ } ++ } else { ++ server.getCommands().dispatchServerCommand(commandSourceStack, this.command); // CraftBukkit ++ } ++ // DivineMC end - Command block parse results caching + } catch (Throwable var6) { + CrashReport crashReport = CrashReport.forThrowable(var6, "Executing command block"); + CrashReportCategory crashReportCategory = crashReport.addCategory("Command to be executed"); +@@ -151,6 +183,13 @@ public abstract class BaseCommandBlock implements CommandSource { + } + } + ++ // DivineMC start - Command block parse results caching ++ private void cache(com.mojang.brigadier.CommandDispatcher dispatcher, CommandSourceStack commandSourceStack, String commandCache) { ++ this.parseResultsCache = dispatcher.parse(commandCache, commandSourceStack); ++ this.lastExecutedCommand = commandCache; ++ } ++ // DivineMC end - Command block parse results caching ++ + public Component getName() { + return this.customName != null ? this.customName : DEFAULT_NAME; + } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch new file mode 100644 index 0000000..91384eb --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -733,8 +_,14 @@ + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); + if (packet.getId() == this.awaitingTeleport) { + if (this.awaitingPositionFromClient == null) { +- ServerGamePacketListenerImpl.LOGGER.warn("Disconnected on accept teleport packet. Was not expecting position data from client at this time"); // Purpur - Add more logger output for invalid movement kicks +- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause ++ // DivineMC start - Graceful teleport handling ++ if (org.bxteam.divinemc.DivineConfig.gracefulTeleportHandling ) { ++ LOGGER.info("Was not expecting position data from client at this time, gracefully returning instead of disconnect."); ++ } else { ++ ServerGamePacketListenerImpl.LOGGER.warn("Disconnected on accept teleport packet. Was not expecting position data from client at this time"); // Purpur - Add more logger output for invalid movement kicks ++ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause ++ } ++ // DivineMC end - Graceful teleport handling + return; + } + diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch new file mode 100644 index 0000000..7058426 --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/level/BaseCommandBlock.java ++++ b/net/minecraft/world/level/BaseCommandBlock.java +@@ -21,7 +_,7 @@ + import net.minecraft.world.phys.Vec3; + + public abstract class BaseCommandBlock implements CommandSource { +- private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss"); ++ private static final ThreadLocal TIME_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat("HH:mm:ss")); // DivineMC - Make it thread safe + private static final Component DEFAULT_NAME = Component.literal("@"); + private long lastExecution = -1L; + private boolean updateLastExecution = true; +@@ -168,7 +_,7 @@ + public void sendSystemMessage(Component component) { + if (this.trackOutput) { + org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks +- this.lastOutput = Component.literal("[" + TIME_FORMAT.format(new Date()) + "] ").append(component); ++ this.lastOutput = Component.literal("[" + TIME_FORMAT.get().format(new Date()) + "] ").append(component); // DivineMC - Make it thread safe + this.onUpdated(); + } + } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch index adeb412..f9306ac 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch @@ -1,11 +1,18 @@ --- a/net/minecraft/world/level/block/LeavesBlock.java +++ b/net/minecraft/world/level/block/LeavesBlock.java -@@ -82,7 +_,23 @@ +@@ -77,12 +_,29 @@ + } + + protected boolean decaying(BlockState state) { +- return !state.getValue(PERSISTENT) && state.getValue(DISTANCE) == 7; ++ return !org.bxteam.divinemc.DivineConfig.disableLeafDecay && !state.getValue(PERSISTENT) && state.getValue(DISTANCE) == 7; // DivineMC - Disable leaf decay + } @Override protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { - level.setBlock(pos, updateDistance(state, level, pos), 3); + // DivineMC start - Make leaves not suffocate the server ++ if (org.bxteam.divinemc.DivineConfig.disableLeafDecay) return; // DivineMC - Disable leaf decay + int newValue = 7; + int oldValue = state.getValue(DISTANCE); + BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos(); diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java index b9b664f..229becf 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java @@ -283,6 +283,8 @@ public class DivineConfig { public static boolean useCompactBitStorage = false; public static boolean fixIncorrectBounceLogic = false; public static boolean forceMinecraftCommand = false; + public static boolean disableLeafDecay = false; + public static boolean commandBlockParseResultsCaching = true; private static void miscSettings() { skipUselessSecondaryPoiSensor = getBoolean("settings.misc.skip-useless-secondary-poi-sensor", skipUselessSecondaryPoiSensor); clumpOrbs = getBoolean("settings.misc.clump-orbs", clumpOrbs, @@ -298,10 +300,15 @@ public class DivineConfig { "Fixes incorrect bounce logic in SlimeBlock."); forceMinecraftCommand = getBoolean("settings.misc.force-minecraft-command", forceMinecraftCommand, "Whether to force the use of vanilla commands over plugin commands."); + disableLeafDecay = getBoolean("settings.misc.disable-leaf-decay", disableLeafDecay, + "Disables leaf block decay."); + commandBlockParseResultsCaching = getBoolean("settings.misc.command-block-parse-results-caching", commandBlockParseResultsCaching, + "Caches the parse results of command blocks, can significantly reduce performance impact."); } public static boolean disableDisconnectSpam = false; public static boolean connectionFlushQueueRewrite = false; + public static boolean gracefulTeleportHandling = false; private static void networkSettings() { disableDisconnectSpam = getBoolean("settings.network.disable-disconnect-spam", disableDisconnectSpam, "Prevents players being disconnected by 'disconnect.spam' when sending too many chat packets"); @@ -310,6 +317,8 @@ public class DivineConfig { "and also uses the Netty event loop to ensure thread safety.", "", "Note: May increase the Netty thread usage"); + gracefulTeleportHandling = getBoolean("settings.network.graceful-teleport-handling", gracefulTeleportHandling , + "Disables being disconnected from 'multiplayer.disconnect.invalid_player_movement' (also declines the packet handling)."); } public static boolean enableFasterTntOptimization = true;