diff --git a/patches/server/0006-Leaves-Server-Config-And-Command.patch b/patches/server/0006-Leaves-Server-Config-And-Command.patch index ff4d5e14..eb7784f6 100644 --- a/patches/server/0006-Leaves-Server-Config-And-Command.patch +++ b/patches/server/0006-Leaves-Server-Config-And-Command.patch @@ -97,7 +97,7 @@ index 459f47244bdfeab63b5f16d780b0291d36310de8..a872421bc3e67fdcc929f104f4b085fb .withRequiredArg() diff --git a/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/src/main/java/org/leavesmc/leaves/LeavesConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..9676585f170ffdde3ab96382efd9a1de078536a2 +index 0000000000000000000000000000000000000000..2a7f9d9fdb72786b08b3cb216f5aa5e5eac3c967 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java @@ -0,0 +1,922 @@ @@ -956,7 +956,7 @@ index 0000000000000000000000000000000000000000..9676585f170ffdde3ab96382efd9a1de + public static boolean bstatsPrivacyMode = false; + + @GlobalConfig(name = "force-minecraft-command", category = "misc") -+ public static boolean forceMinecraftCommand = true; ++ public static boolean forceMinecraftCommand = false; + + @GlobalConfig(name = "leaves-packet-event", category = "misc") + public static boolean leavesPacketEvent = true; @@ -1190,7 +1190,7 @@ index 0000000000000000000000000000000000000000..dccd32714b86d1fa3e0a9b10a23f765f +} diff --git a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..b9e2bdb034dcd5119680ddea44a1eda11a0189b2 +index 0000000000000000000000000000000000000000..ebd62b1d3a60d3e22e3849047293e1f62533eae7 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java @@ -0,0 +1,118 @@ @@ -1206,9 +1206,9 @@ index 0000000000000000000000000000000000000000..b9e2bdb034dcd5119680ddea44a1eda1 +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; +import org.bukkit.plugin.PluginManager; -+import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.NotNull; -+import org.leavesmc.leaves.command.subcommands.ConfigCommand; ++import org.jetbrains.annotations.Nullable; ++import org.leavesmc.leaves.command.subcommands.*; + +import java.util.ArrayList; +import java.util.Arrays; diff --git a/patches/server/0095-Leaves-update-command.patch b/patches/server/0095-Leaves-Updater.patch similarity index 77% rename from patches/server/0095-Leaves-update-command.patch rename to patches/server/0095-Leaves-Updater.patch index f09f924b..7fb397cb 100644 --- a/patches/server/0095-Leaves-update-command.patch +++ b/patches/server/0095-Leaves-Updater.patch @@ -1,22 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Mon, 31 Jul 2023 17:42:25 +0800 -Subject: [PATCH] Leaves update command +Subject: [PATCH] Leaves Updater +--------- + +Co-authored-by: MC_XiaoHei diff --git a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java -index b9e2bdb034dcd5119680ddea44a1eda11a0189b2..facd180da9b7025cf7ae192cbe91317ff4b70472 100644 +index ebd62b1d3a60d3e22e3849047293e1f62533eae7..e964f05c5c0f2d1d9b4c0a3459076e4b95f0f4e8 100644 --- a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java +++ b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java -@@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginManager; - import org.checkerframework.checker.nullness.qual.Nullable; - import org.jetbrains.annotations.NotNull; - import org.leavesmc.leaves.command.subcommands.ConfigCommand; -+import org.leavesmc.leaves.command.subcommands.UpdateCommand; - - import java.util.ArrayList; - import java.util.Arrays; -@@ -33,6 +34,7 @@ public final class LeavesCommand extends Command { +@@ -33,6 +33,7 @@ public final class LeavesCommand extends Command { private static final Map SUBCOMMANDS = Util.make(() -> { final Map, LeavesSubcommand> commands = new HashMap<>(); commands.put(Set.of("config"), new ConfigCommand()); @@ -53,10 +48,10 @@ index 0000000000000000000000000000000000000000..7f94df607e8ffd48ab2cb7c90d520c2b +} diff --git a/src/main/java/org/leavesmc/leaves/util/LeavesUpdateHelper.java b/src/main/java/org/leavesmc/leaves/util/LeavesUpdateHelper.java new file mode 100644 -index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5ca151beea +index 0000000000000000000000000000000000000000..8620305f3330a856ad7445259f565bf8e281ea52 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/util/LeavesUpdateHelper.java -@@ -0,0 +1,240 @@ +@@ -0,0 +1,268 @@ +package org.leavesmc.leaves.util; + +import com.google.common.base.Charsets; @@ -68,6 +63,7 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c +import net.minecraft.Util; +import org.bukkit.Bukkit; +import org.jetbrains.annotations.NotNull; ++import org.leavesmc.leaves.LeavesConfig; +import org.leavesmc.leaves.LeavesLogger; + +import java.io.BufferedReader; @@ -78,6 +74,8 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; ++import java.net.URI; ++import java.net.URISyntaxException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.FileChannel; @@ -85,6 +83,11 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.MessageDigest; ++import java.time.Duration; ++import java.time.LocalTime; ++import java.util.concurrent.Executors; ++import java.util.concurrent.ScheduledExecutorService; ++import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.ReentrantLock; + +import static java.nio.file.StandardOpenOption.CREATE; @@ -99,24 +102,50 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + private final static ReentrantLock updateLock = new ReentrantLock(); + private static boolean updateTaskStarted = false; + -+ public static void initAutoUpdate() { ++ private static final ScheduledExecutorService autoUpdateExecutor = Executors.newScheduledThreadPool(1); ++ ++ public static void init() { + File workingDirFile = new File(autoUpdateDir); + if (!workingDirFile.exists()) { -+ workingDirFile.mkdir(); ++ if (!workingDirFile.mkdir()) { ++ LeavesLogger.LOGGER.warning("Failed to create working directory: " + autoUpdateDir); ++ } + } + + File corePathFile = new File(corePathFileName); + if (!corePathFile.exists()) { + try { -+ corePathFile.createNewFile(); ++ if (!corePathFile.createNewFile()) { ++ throw new IOException(); ++ } + } catch (IOException e) { -+ e.printStackTrace(); ++ LeavesLogger.LOGGER.severe("Failed to create core path file: " + corePathFileName, e); + } + } + + File leavesUpdateDir = new File(autoUpdateDir + File.separator + "leaves"); + if (!leavesUpdateDir.exists()) { -+ leavesUpdateDir.mkdir(); ++ if (!leavesUpdateDir.mkdir()) { ++ LeavesLogger.LOGGER.warning("Failed to create leaves update directory: " + leavesUpdateDir); ++ } ++ } ++ ++ if (LeavesConfig.autoUpdate) { ++ LocalTime currentTime = LocalTime.now(); ++ long dailyTaskPeriod = 24 * 60 * 60 * 1000; ++ ++ for (String time : LeavesConfig.autoUpdateTime) { ++ try { ++ LocalTime taskTime = LocalTime.of(Integer.parseInt(time.split(":")[0]), Integer.parseInt(time.split(":")[1])); ++ Duration task = Duration.between(currentTime, taskTime); ++ if (task.isNegative()) { ++ task = task.plusDays(1); ++ } ++ autoUpdateExecutor.scheduleAtFixedRate(LeavesUpdateHelper::tryUpdateLeaves, task.toMillis(), dailyTaskPeriod, TimeUnit.MILLISECONDS); ++ } catch (Exception ignored) { ++ LeavesLogger.LOGGER.warning("Illegal auto-update time ignored: " + time); ++ } ++ } + } + } + @@ -125,12 +154,7 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + try { + if (!updateTaskStarted) { + updateTaskStarted = true; -+ new Thread(new Runnable() { -+ @Override -+ public void run() { -+ downloadLeaves(); -+ } -+ }).start(); ++ new Thread(LeavesUpdateHelper::downloadLeaves).start(); + } + } finally { + updateLock.unlock(); @@ -142,7 +166,7 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + String version = Bukkit.getVersion(); + + if (version.startsWith("null")) { -+ LeavesLogger.LOGGER.info("IDE?"); ++ LeavesLogger.LOGGER.info("IDE? Can not update!"); + updateTaskStarted = false; + return; + } @@ -165,7 +189,7 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + Files.deleteIfExists(outFile); + + boolean downloadFlag = false; -+ URL cdnUrl = new URL(buildInfo.cdnUrl); ++ URL cdnUrl = new URI(buildInfo.cdnUrl).toURL(); + try ( + final ReadableByteChannel source = Channels.newChannel(cdnUrl.openStream()); + final FileChannel fileChannel = FileChannel.open(outFile, CREATE, WRITE, TRUNCATE_EXISTING) @@ -177,17 +201,16 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + } + + if (!downloadFlag) { -+ URL githubUrl = new URL(buildInfo.githubUrl); ++ URL githubUrl = new URI(buildInfo.githubUrl).toURL(); + try ( + final ReadableByteChannel source = Channels.newChannel(githubUrl.openStream()); + final FileChannel fileChannel = FileChannel.open(outFile, CREATE, WRITE, TRUNCATE_EXISTING) + ) { + fileChannel.transferFrom(source, 0, Long.MAX_VALUE); + } catch (final IOException e) { -+ LeavesLogger.LOGGER.warning("Download " + buildInfo.fileName + " failed."); ++ LeavesLogger.LOGGER.warning("Download " + buildInfo.fileName + " failed.", e); + Files.deleteIfExists(outFile); + updateTaskStarted = false; -+ e.printStackTrace(); + return; + } + } @@ -207,14 +230,14 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(corePathFileName))) { + bufferedWriter.write(autoUpdateDir + File.separator + "leaves" + File.separator + buildInfo.fileName); + } catch (IOException e) { -+ e.printStackTrace(); ++ LeavesLogger.LOGGER.warning("Fail to download leaves core", e); + updateTaskStarted = false; + return; + } + + LeavesLogger.LOGGER.info("Leaves update completed, please restart your server."); + } catch (Exception e) { -+ e.printStackTrace(); ++ LeavesLogger.LOGGER.severe("Leaves update failed", e); + } + } else { + LeavesLogger.LOGGER.warning("Can't get build info, stopping update."); @@ -233,7 +256,7 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + + return toHexString(md5.digest()).equals(hash); + } catch (Exception e) { -+ e.printStackTrace(); ++ LeavesLogger.LOGGER.warning("Fail to validate file " + file, e); + } + return false; + } @@ -249,14 +272,14 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + + private static LeavesBuildInfo getLatestBuildInfo(String mcVersion, String gitHash) { + try { -+ HttpURLConnection connection = (HttpURLConnection) new URL("https://api.leavesmc.org/projects/leaves/versions/" + mcVersion + "/builds/latest").openConnection(); ++ HttpURLConnection connection = (HttpURLConnection) new URI("https://api.leavesmc.org/projects/leaves/versions/" + mcVersion + "/builds/latest").toURL().openConnection(); + connection.connect(); + boolean useApiV2 = false; -+ if (connection.getResponseCode() / 100 != 2){ -+ connection = (HttpURLConnection) new URL("https://api.leavesmc.org/v2/projects/leaves/versions/" + mcVersion + "/builds/latest").openConnection(); ++ if (connection.getResponseCode() / 100 != 2) { ++ connection = (HttpURLConnection) new URI("https://api.leavesmc.org/v2/projects/leaves/versions/" + mcVersion + "/builds/latest").toURL().openConnection(); + connection.connect(); + useApiV2 = true; -+ }; ++ } + if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) return LeavesBuildInfo.NULL; + try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), Charsets.UTF_8))) { + JsonObject obj = new Gson().fromJson(reader, JsonObject.class); @@ -265,7 +288,7 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + if (channel.equals("default")) { + int build = obj.get("build").getAsInt(); + -+ JsonArray changes = obj.get("changes").getAsJsonArray(); ++ JsonArray changes = obj.get("changes").getAsJsonArray(); + boolean needUpdate = true; + for (JsonElement change : changes) { + if (change.getAsJsonObject().get("commit").getAsString().startsWith(gitHash)) { @@ -284,11 +307,11 @@ index 0000000000000000000000000000000000000000..06ca57f0cb319a254ca1511e60f05e5c + return LeavesBuildInfo.NULL; + } + } catch (JsonSyntaxException | NumberFormatException e) { -+ e.printStackTrace(); ++ LeavesLogger.LOGGER.warning("Fail to get latest build info", e); + return LeavesBuildInfo.NULL; + } -+ } catch (IOException e) { -+ e.printStackTrace(); ++ } catch (IOException | URISyntaxException e) { ++ LeavesLogger.LOGGER.warning("Fail to get latest build info", e); + return LeavesBuildInfo.NULL; + } + } diff --git a/patches/server/0096-Force-peaceful-mode-switch.patch b/patches/server/0096-Force-peaceful-mode-switch.patch index b02e5221..f72888b0 100644 --- a/patches/server/0096-Force-peaceful-mode-switch.patch +++ b/patches/server/0096-Force-peaceful-mode-switch.patch @@ -121,18 +121,10 @@ index 8045d6c9398d1c88595da6e41aa1ed27fb6fbad0..2f7de6dc538d147fd80885c1428112b7 if (!this.persistentDataContainer.isEmpty()) { c.put("BukkitValues", this.persistentDataContainer.toTagCompound()); diff --git a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java -index facd180da9b7025cf7ae192cbe91317ff4b70472..2d871fafff90e2dbc8c4141f92cdb1544ccdce43 100644 +index e964f05c5c0f2d1d9b4c0a3459076e4b95f0f4e8..b28ca267a841f33ba18fff5587a6b0e677dc1ea1 100644 --- a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java +++ b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java -@@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginManager; - import org.checkerframework.checker.nullness.qual.Nullable; - import org.jetbrains.annotations.NotNull; - import org.leavesmc.leaves.command.subcommands.ConfigCommand; -+import org.leavesmc.leaves.command.subcommands.PeacefulModeSwitchCommand; - import org.leavesmc.leaves.command.subcommands.UpdateCommand; - - import java.util.ArrayList; -@@ -35,6 +36,7 @@ public final class LeavesCommand extends Command { +@@ -34,6 +34,7 @@ public final class LeavesCommand extends Command { final Map, LeavesSubcommand> commands = new HashMap<>(); commands.put(Set.of("config"), new ConfigCommand()); commands.put(Set.of("update"), new UpdateCommand()); diff --git a/patches/server/0097-Add-Leaves-Auto-Update.patch b/patches/server/0097-Add-Leaves-Auto-Update.patch deleted file mode 100644 index 47f0dadf..00000000 --- a/patches/server/0097-Add-Leaves-Auto-Update.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MC_XiaoHei -Date: Sun, 6 Aug 2023 09:57:53 +0800 -Subject: [PATCH] Add Leaves Auto Update - - -diff --git a/src/main/java/org/leavesmc/leaves/util/LeavesUpdateHelper.java b/src/main/java/org/leavesmc/leaves/util/LeavesUpdateHelper.java -index 06ca57f0cb319a254ca1511e60f05e5ca151beea..061869a93704e9605378468af8343c64fa009580 100644 ---- a/src/main/java/org/leavesmc/leaves/util/LeavesUpdateHelper.java -+++ b/src/main/java/org/leavesmc/leaves/util/LeavesUpdateHelper.java -@@ -7,8 +7,11 @@ import com.google.gson.JsonElement; - import com.google.gson.JsonObject; - import com.google.gson.JsonSyntaxException; - import net.minecraft.Util; -+import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; - import org.bukkit.Bukkit; -+import org.checkerframework.checker.units.qual.C; - import org.jetbrains.annotations.NotNull; -+import org.leavesmc.leaves.LeavesConfig; - import org.leavesmc.leaves.LeavesLogger; - - import java.io.BufferedReader; -@@ -26,6 +29,12 @@ import java.nio.channels.ReadableByteChannel; - import java.nio.file.Files; - import java.nio.file.Path; - import java.security.MessageDigest; -+import java.time.Duration; -+import java.time.LocalTime; -+import java.util.*; -+import java.util.concurrent.Executors; -+import java.util.concurrent.ScheduledExecutorService; -+import java.util.concurrent.TimeUnit; - import java.util.concurrent.locks.ReentrantLock; - - import static java.nio.file.StandardOpenOption.CREATE; -@@ -40,7 +49,9 @@ public class LeavesUpdateHelper { - private final static ReentrantLock updateLock = new ReentrantLock(); - private static boolean updateTaskStarted = false; - -- public static void initAutoUpdate() { -+ private static final ScheduledExecutorService autoUpdateExecutor = Executors.newScheduledThreadPool(1); -+ -+ public static void init() { - File workingDirFile = new File(autoUpdateDir); - if (!workingDirFile.exists()) { - workingDirFile.mkdir(); -@@ -59,6 +70,24 @@ public class LeavesUpdateHelper { - if (!leavesUpdateDir.exists()) { - leavesUpdateDir.mkdir(); - } -+ -+ if (LeavesConfig.autoUpdate) { -+ LocalTime currentTime = LocalTime.now(); -+ long dailyTaskPeriod = 24 * 60 * 60 * 1000; -+ -+ for (String time : LeavesConfig.autoUpdateTime) { -+ try { -+ LocalTime taskTime = LocalTime.of(Integer.parseInt(time.split(":")[0]), Integer.parseInt(time.split(":")[1])); -+ Duration task = Duration.between(currentTime, taskTime); -+ if (task.isNegative()) { -+ task = task.plusDays(1); -+ } -+ autoUpdateExecutor.scheduleAtFixedRate(LeavesUpdateHelper::tryUpdateLeaves, task.toMillis(), dailyTaskPeriod, TimeUnit.MILLISECONDS); -+ } catch (Exception ignored){ -+ LeavesLogger.LOGGER.warning("Illegal auto-update time ignored: " + time); -+ } -+ } -+ } - } - - public static void tryUpdateLeaves() { -@@ -66,12 +95,7 @@ public class LeavesUpdateHelper { - try { - if (!updateTaskStarted) { - updateTaskStarted = true; -- new Thread(new Runnable() { -- @Override -- public void run() { -- downloadLeaves(); -- } -- }).start(); -+ new Thread(LeavesUpdateHelper::downloadLeaves).start(); - } - } finally { - updateLock.unlock(); -@@ -83,7 +107,7 @@ public class LeavesUpdateHelper { - String version = Bukkit.getVersion(); - - if (version.startsWith("null")) { -- LeavesLogger.LOGGER.info("IDE?"); -+ LeavesLogger.LOGGER.info("IDE? Can not update!"); - updateTaskStarted = false; - return; - } diff --git a/patches/server/0098-Replay-Mod-API.patch b/patches/server/0097-Replay-Mod-API.patch similarity index 98% rename from patches/server/0098-Replay-Mod-API.patch rename to patches/server/0097-Replay-Mod-API.patch index 71a869f0..d94f4dee 100644 --- a/patches/server/0098-Replay-Mod-API.patch +++ b/patches/server/0097-Replay-Mod-API.patch @@ -5,6 +5,19 @@ Subject: [PATCH] Replay Mod API This patch is Powered by ReplayMod(https://github.com/ReplayMod) +diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +index 0724bd95143cb5dc69b5f1eb2e67ecd679e09a99..e1d66ac593c6da954ef02def16601dc401421b9f 100644 +--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java ++++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +@@ -42,7 +42,7 @@ class PaperEventManager { + } + + // Leaves start - skip bot +- if (event instanceof org.bukkit.event.player.PlayerEvent playerEvent && playerEvent.getPlayer() instanceof org.leavesmc.leaves.entity.Bot) { ++ if (event instanceof org.bukkit.event.player.PlayerEvent playerEvent && (playerEvent.getPlayer() instanceof org.leavesmc.leaves.entity.Bot || playerEvent.getPlayer() instanceof org.leavesmc.leaves.entity.Photographer)) { // Leaves - and photographer + return; + } + // Leaves end - skip bot diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java index 7976885b902a6ce7d80f31e49448c99452eb9765..6bed90ec5effafbad4aaf82878fe24633891e4e5 100644 --- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java diff --git a/patches/server/0099-Leaves-I18n.patch b/patches/server/0098-Leaves-I18n.patch similarity index 100% rename from patches/server/0099-Leaves-I18n.patch rename to patches/server/0098-Leaves-I18n.patch diff --git a/patches/server/0100-Fix-minecraft-hopper-not-work-without-player.patch b/patches/server/0099-Fix-minecraft-hopper-not-work-without-player.patch similarity index 100% rename from patches/server/0100-Fix-minecraft-hopper-not-work-without-player.patch rename to patches/server/0099-Fix-minecraft-hopper-not-work-without-player.patch diff --git a/patches/server/0101-RNG-Fishing.patch b/patches/server/0100-RNG-Fishing.patch similarity index 70% rename from patches/server/0101-RNG-Fishing.patch rename to patches/server/0100-RNG-Fishing.patch index c86a1ec9..2d4155d5 100644 --- a/patches/server/0101-RNG-Fishing.patch +++ b/patches/server/0100-RNG-Fishing.patch @@ -17,15 +17,3 @@ index 0e00f59a8962dd6356d483ef5be3209a3a410008..1c556f9cca2d21c3bdb49cb22263a597 CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer) entityhuman, usedItem, this, list); Iterator iterator = list.iterator(); -diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java -index 0613e71e13a7298c857fdef5a4e229a2ff63781e..00329eada98cf2d12d0d112a5068feac509dfa6a 100644 ---- a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java -+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java -@@ -96,6 +96,7 @@ public class LootContext { - this.params = parameters; - } - -+ - public LootContext.Builder withOptionalRandomSeed(long seed) { - if (seed != 0L) { - this.random = RandomSource.create(seed); diff --git a/patches/server/0102-Wool-Hopper-Counter.patch b/patches/server/0101-Wool-Hopper-Counter.patch similarity index 89% rename from patches/server/0102-Wool-Hopper-Counter.patch rename to patches/server/0101-Wool-Hopper-Counter.patch index b36c77d5..de492dc2 100644 --- a/patches/server/0102-Wool-Hopper-Counter.patch +++ b/patches/server/0101-Wool-Hopper-Counter.patch @@ -18,32 +18,10 @@ index e314f36951e9ac15c57137e24fce8c410373130a..dd232d9e86c5bf03cfb4597d3291a172 @Nullable public ItemStack[] itemStacks; @Nullable -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index de7c77c1b25680ecc65f0f43f2391aff269a974f..3ee6ee42a2bed5c211577f6cc47a5f7bab7c32ed 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -45,7 +45,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - private static final Logger LOGGER = LogUtils.getLogger(); - private final HolderLookup.Provider registries; - public Multimap, RecipeHolder> byType = ImmutableMultimap.of(); -- public Map> byName = ImmutableMap.of(); -+ public Map> byName = ImmutableMap.of(); // Leaves - hopper counter - private boolean hasErrors; - - public RecipeManager(HolderLookup.Provider registryLookup) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index b08b7ffbcfbc6a12d74cadf878fd069f7a1345cb..741ab2ffc8e4f40f43e24fed3b6d55580a3fdaca 100644 +index b08b7ffbcfbc6a12d74cadf878fd069f7a1345cb..c096c9f8fc7a7e42b250306c8c35bc2c206b68ac 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -202,7 +202,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen - - final int fullState = getFullState(blockEntity); // Paper - Perf: Optimize Hoppers - if (fullState != HOPPER_EMPTY) { // Paper - Perf: Optimize Hoppers -- flag = HopperBlockEntity.ejectItems(world, pos, blockEntity); -+ flag = HopperBlockEntity.ejectItems(world, pos, blockEntity); // Leaves - hopper counter - } - - if (fullState != HOPPER_IS_FULL || flag) { // Paper - Perf: Optimize Hoppers @@ -432,7 +432,14 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen private static final java.util.function.BiPredicate IS_EMPTY_TEST = (itemstack, i) -> itemstack.isEmpty(); // Paper end - Perf: Optimize Hoppers @@ -84,18 +62,10 @@ index b08b7ffbcfbc6a12d74cadf878fd069f7a1345cb..741ab2ffc8e4f40f43e24fed3b6d5558 if (inventory instanceof WorldlyContainer iworldinventory) { return iworldinventory.getSlotsForFace(side); diff --git a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java -index 2d871fafff90e2dbc8c4141f92cdb1544ccdce43..31473e5a257276d1feb37e98cf52477cd9523712 100644 +index b28ca267a841f33ba18fff5587a6b0e677dc1ea1..f9a1f2d7f319c22178c2254347bcdc15f19badd9 100644 --- a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java +++ b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java -@@ -13,6 +13,7 @@ import org.bukkit.plugin.PluginManager; - import org.checkerframework.checker.nullness.qual.Nullable; - import org.jetbrains.annotations.NotNull; - import org.leavesmc.leaves.command.subcommands.ConfigCommand; -+import org.leavesmc.leaves.command.subcommands.CounterCommand; - import org.leavesmc.leaves.command.subcommands.PeacefulModeSwitchCommand; - import org.leavesmc.leaves.command.subcommands.UpdateCommand; - -@@ -37,6 +38,7 @@ public final class LeavesCommand extends Command { +@@ -35,6 +35,7 @@ public final class LeavesCommand extends Command { commands.put(Set.of("config"), new ConfigCommand()); commands.put(Set.of("update"), new UpdateCommand()); commands.put(Set.of("peaceful"), new PeacefulModeSwitchCommand()); @@ -232,10 +202,10 @@ index 0000000000000000000000000000000000000000..358780d37600220d132ae8e2e6c594fc +} diff --git a/src/main/java/org/leavesmc/leaves/util/HopperCounter.java b/src/main/java/org/leavesmc/leaves/util/HopperCounter.java new file mode 100644 -index 0000000000000000000000000000000000000000..1551feb2e2787ccf15dbe6a027e7fff21f762c7a +index 0000000000000000000000000000000000000000..1a83b3918bc040ab32e648b54b498e9a556c17a3 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/util/HopperCounter.java -@@ -0,0 +1,334 @@ +@@ -0,0 +1,338 @@ +package org.leavesmc.leaves.util; + +import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap; @@ -269,6 +239,7 @@ index 0000000000000000000000000000000000000000..1551feb2e2787ccf15dbe6a027e7fff2 +import net.minecraft.world.level.material.MapColor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; ++import org.leavesmc.leaves.LeavesConfig; + +import java.util.ArrayList; +import java.util.Arrays; @@ -277,8 +248,6 @@ index 0000000000000000000000000000000000000000..1551feb2e2787ccf15dbe6a027e7fff2 +import java.util.EnumMap; +import java.util.List; +import java.util.Map; -+import java.util.Objects; -+import java.util.stream.Collectors; + +import static java.util.Map.entry; + @@ -418,6 +387,7 @@ index 0000000000000000000000000000000000000000..1551feb2e2787ccf15dbe6a027e7fff2 + entry(Items.SPIDER_EYE, Blocks.NETHERRACK), + entry(Items.GUNPOWDER, Blocks.GRAY_WOOL), + entry(Items.TURTLE_SCUTE, Blocks.LIME_WOOL), ++ entry(Items.ARMADILLO_SCUTE, Blocks.ANCIENT_DEBRIS), + entry(Items.FEATHER, Blocks.WHITE_WOOL), + entry(Items.FLINT, Blocks.BLACK_WOOL), + entry(Items.LEATHER, Blocks.SPRUCE_PLANKS), @@ -515,17 +485,21 @@ index 0000000000000000000000000000000000000000..1551feb2e2787ccf15dbe6a027e7fff2 + } + + public static List> getAllMatching(@NotNull RecipeManager manager, RecipeType type, ResourceLocation output, final RegistryAccess registryAccess) { -+ Map> typeRecipes = manager.byName; // Leaves - hopper counter -+ if (typeRecipes == null) { -+ return Collections.emptyList(); ++ RecipeHolder recipe = manager.byName.get(output); ++ if (recipe != null && recipe.value().getType().equals(type)) { ++ return List.of(recipe.value()); + } -+ if (typeRecipes.containsKey(output)) { -+ return Collections.singletonList(typeRecipes.get(output).value()); ++ if (!manager.byType.containsKey(type)) { ++ return List.of(); + } -+ final Registry regs = registryAccess.registryOrThrow(Registries.ITEM); -+ return typeRecipes.values().stream() -+ .filter(r -> Objects.equals(regs.getKey(r.value().getResultItem(registryAccess).getItem()), output)) -+ .map(RecipeHolder::value).collect(Collectors.toList()); ++ ++ Collection> typeRecipes = manager.byType.get(type); ++ Registry regs = registryAccess.registryOrThrow(Registries.ITEM); ++ Item item = regs.get(output); ++ return typeRecipes.stream() ++ .>map(RecipeHolder::value) ++ .filter(r -> r.getResultItem(registryAccess).getItem() == item) ++ .toList(); + } + + public static List> getRecipeStacks(@NotNull Ingredient ingredient) { @@ -567,7 +541,7 @@ index 0000000000000000000000000000000000000000..1551feb2e2787ccf15dbe6a027e7fff2 + } + + public static boolean isEnabled() { -+ return enabled; ++ return LeavesConfig.hopperCounter && enabled; + } +} diff --git a/src/main/java/org/leavesmc/leaves/util/WoolUtils.java b/src/main/java/org/leavesmc/leaves/util/WoolUtils.java diff --git a/patches/server/0103-Leaves-Reload-Command.patch b/patches/server/0102-Leaves-Reload-Command.patch similarity index 78% rename from patches/server/0103-Leaves-Reload-Command.patch rename to patches/server/0102-Leaves-Reload-Command.patch index 61d441a5..6c383b40 100644 --- a/patches/server/0103-Leaves-Reload-Command.patch +++ b/patches/server/0102-Leaves-Reload-Command.patch @@ -5,18 +5,10 @@ Subject: [PATCH] Leaves Reload Command diff --git a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java -index 31473e5a257276d1feb37e98cf52477cd9523712..0f958ccafda1490f1acfc8089c47f6b7de7d4722 100644 +index f9a1f2d7f319c22178c2254347bcdc15f19badd9..139c807916ec1be7bf993b34f52343f12eea888a 100644 --- a/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java +++ b/src/main/java/org/leavesmc/leaves/command/LeavesCommand.java -@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull; - import org.leavesmc.leaves.command.subcommands.ConfigCommand; - import org.leavesmc.leaves.command.subcommands.CounterCommand; - import org.leavesmc.leaves.command.subcommands.PeacefulModeSwitchCommand; -+import org.leavesmc.leaves.command.subcommands.ReloadCommand; - import org.leavesmc.leaves.command.subcommands.UpdateCommand; - - import java.util.ArrayList; -@@ -39,6 +40,7 @@ public final class LeavesCommand extends Command { +@@ -36,6 +36,7 @@ public final class LeavesCommand extends Command { commands.put(Set.of("update"), new UpdateCommand()); commands.put(Set.of("peaceful"), new PeacefulModeSwitchCommand()); commands.put(Set.of("counter"), new CounterCommand()); diff --git a/patches/server/0104-Spider-jockeys-drop-gapples.patch b/patches/server/0103-Spider-jockeys-drop-gapples.patch similarity index 100% rename from patches/server/0104-Spider-jockeys-drop-gapples.patch rename to patches/server/0103-Spider-jockeys-drop-gapples.patch diff --git a/patches/server/0105-Force-Void-Trade.patch b/patches/server/0104-Force-Void-Trade.patch similarity index 100% rename from patches/server/0105-Force-Void-Trade.patch rename to patches/server/0104-Force-Void-Trade.patch diff --git a/patches/server/0106-Placeholder-for-Servux-Protocol.patch b/patches/server/0105-Placeholder-for-Servux-Protocol.patch similarity index 100% rename from patches/server/0106-Placeholder-for-Servux-Protocol.patch rename to patches/server/0105-Placeholder-for-Servux-Protocol.patch diff --git a/patches/server/0107-Villager-infinite-discounts.patch b/patches/server/0106-Villager-infinite-discounts.patch similarity index 100% rename from patches/server/0107-Villager-infinite-discounts.patch rename to patches/server/0106-Villager-infinite-discounts.patch diff --git a/patches/server/0108-CCE-update-suppression.patch b/patches/server/0107-CCE-update-suppression.patch similarity index 100% rename from patches/server/0108-CCE-update-suppression.patch rename to patches/server/0107-CCE-update-suppression.patch diff --git a/patches/server/0109-Disable-offline-warn-if-use-proxy.patch b/patches/server/0108-Disable-offline-warn-if-use-proxy.patch similarity index 100% rename from patches/server/0109-Disable-offline-warn-if-use-proxy.patch rename to patches/server/0108-Disable-offline-warn-if-use-proxy.patch diff --git a/patches/server/0110-Disable-moved-wrongly-threshold.patch b/patches/server/0109-Disable-moved-wrongly-threshold.patch similarity index 100% rename from patches/server/0110-Disable-moved-wrongly-threshold.patch rename to patches/server/0109-Disable-moved-wrongly-threshold.patch diff --git a/patches/server/0111-Armor-stand-cant-kill-by-mob-projectile.patch b/patches/server/0110-Armor-stand-cant-kill-by-mob-projectile.patch similarity index 100% rename from patches/server/0111-Armor-stand-cant-kill-by-mob-projectile.patch rename to patches/server/0110-Armor-stand-cant-kill-by-mob-projectile.patch diff --git a/patches/server/0112-Make-Item-tick-vanilla.patch b/patches/server/0111-Make-Item-tick-vanilla.patch similarity index 100% rename from patches/server/0112-Make-Item-tick-vanilla.patch rename to patches/server/0111-Make-Item-tick-vanilla.patch diff --git a/patches/server/0113-Copper-Bulb-1-gt-delay.patch b/patches/server/0112-Copper-Bulb-1-gt-delay.patch similarity index 100% rename from patches/server/0113-Copper-Bulb-1-gt-delay.patch rename to patches/server/0112-Copper-Bulb-1-gt-delay.patch diff --git a/patches/server/0114-Crafter-1-gt-delay.patch b/patches/server/0113-Crafter-1-gt-delay.patch similarity index 100% rename from patches/server/0114-Crafter-1-gt-delay.patch rename to patches/server/0113-Crafter-1-gt-delay.patch diff --git a/patches/server/0115-Linear-region-file-format.patch b/patches/server/0114-Linear-region-file-format.patch similarity index 100% rename from patches/server/0115-Linear-region-file-format.patch rename to patches/server/0114-Linear-region-file-format.patch diff --git a/patches/server/0117-No-TNT-place-update.patch b/patches/server/0115-No-TNT-place-update.patch similarity index 100% rename from patches/server/0117-No-TNT-place-update.patch rename to patches/server/0115-No-TNT-place-update.patch diff --git a/patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch b/patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch new file mode 100644 index 00000000..9e725eba --- /dev/null +++ b/patches/server/0116-Placing-locked-hopper-no-longer-send-NC-updates.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fortern +Date: Sat, 20 Jan 2024 02:50:56 +0800 +Subject: [PATCH] Placing locked hopper no longer send NC updates + + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index e90269a8dbf974c3d37cbf2ce8576af94cf2ce04..c128b44706ec681da25119c2d47362e0323ef576 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -698,7 +698,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + } + + if ((i & 1) != 0) { +- this.blockUpdated(blockposition, iblockdata1.getBlock()); ++ // Leaves start - Placing locked hopper doesn't send NC updates. ++ if (!(iblockdata.getBlock() instanceof net.minecraft.world.level.block.HopperBlock) || iblockdata.getValue(net.minecraft.world.level.block.HopperBlock.ENABLED)) { ++ this.blockUpdated(blockposition, iblockdata1.getBlock()); ++ } ++ // Leaves end - Placing locked hopper doesn't send NC updates. + if (!this.isClientSide && iblockdata.hasAnalogOutputSignal()) { + this.updateNeighbourForOutputSignal(blockposition, newBlock.getBlock()); + } diff --git a/patches/server/0116-Protection-stacking.patch b/patches/server/0116-Protection-stacking.patch deleted file mode 100644 index 6f0b142d..00000000 --- a/patches/server/0116-Protection-stacking.patch +++ /dev/null @@ -1,9 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: violetc <58360096+s-yh-china@users.noreply.github.com> -Date: Mon, 15 Jan 2024 20:47:05 +0800 -Subject: [PATCH] Protection stacking - - -diff --git a/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/patches/server/0119-Renewable-deepslate.patch b/patches/server/0117-Renewable-deepslate.patch similarity index 100% rename from patches/server/0119-Renewable-deepslate.patch rename to patches/server/0117-Renewable-deepslate.patch diff --git a/patches/server/0118-Placing-locked-hopper-no-longer-send-NC-updates.patch b/patches/server/0118-Placing-locked-hopper-no-longer-send-NC-updates.patch deleted file mode 100644 index 27469487..00000000 --- a/patches/server/0118-Placing-locked-hopper-no-longer-send-NC-updates.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Fortern -Date: Sat, 20 Jan 2024 02:50:56 +0800 -Subject: [PATCH] Placing locked hopper no longer send NC updates - - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e90269a8dbf974c3d37cbf2ce8576af94cf2ce04..6eba9dac1d8280226e25ad62456fbaa79fd5f4be 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -55,6 +55,7 @@ import net.minecraft.world.level.biome.BiomeManager; - import net.minecraft.world.level.block.BaseFireBlock; - import net.minecraft.world.level.block.Block; - import net.minecraft.world.level.block.Blocks; -+import net.minecraft.world.level.block.HopperBlock; - import net.minecraft.world.level.block.entity.BlockEntity; - import net.minecraft.world.level.block.entity.TickingBlockEntity; - import net.minecraft.world.level.block.state.BlockState; -@@ -698,7 +699,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - } - - if ((i & 1) != 0) { -- this.blockUpdated(blockposition, iblockdata1.getBlock()); -+ if (!(iblockdata.getBlock() instanceof HopperBlock) || iblockdata.getValue(HopperBlock.ENABLED)) { // Leaves - Placing locked hopper doesn't send NC updates. -+ this.blockUpdated(blockposition, iblockdata1.getBlock()); -+ } // Leaves - if (!this.isClientSide && iblockdata.hasAnalogOutputSignal()) { - this.updateNeighbourForOutputSignal(blockposition, newBlock.getBlock()); - } diff --git a/patches/server/0120-Renewable-sponges.patch b/patches/server/0118-Renewable-sponges.patch similarity index 91% rename from patches/server/0120-Renewable-sponges.patch rename to patches/server/0118-Renewable-sponges.patch index a7b6c28f..3a54b7bf 100644 --- a/patches/server/0120-Renewable-sponges.patch +++ b/patches/server/0118-Renewable-sponges.patch @@ -5,15 +5,14 @@ Subject: [PATCH] Renewable sponges diff --git a/src/main/java/net/minecraft/world/entity/monster/Guardian.java b/src/main/java/net/minecraft/world/entity/monster/Guardian.java -index 5df07b59ff6e39687e361d89d7764381ca3ce9ca..f91a350af54e893d6c1d53f2e385d53e0ccf121a 100644 +index 5df07b59ff6e39687e361d89d7764381ca3ce9ca..465a46f497d726303859ca31688a848699441234 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Guardian.java +++ b/src/main/java/net/minecraft/world/entity/monster/Guardian.java -@@ -345,6 +345,30 @@ public class Guardian extends Monster { +@@ -345,6 +345,28 @@ public class Guardian extends Monster { } + // Leaves start - renewable sponges -+ + @Override + public void thunderHit(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.LightningBolt lightning) { + if (org.leavesmc.leaves.LeavesConfig.renewableSponges && !this.isRemoved() && !(this instanceof ElderGuardian)) { @@ -33,7 +32,6 @@ index 5df07b59ff6e39687e361d89d7764381ca3ce9ca..f91a350af54e893d6c1d53f2e385d53e + super.thunderHit(world, lightning); + } + } -+ + // Leaves end - renewable sponges + private static class GuardianMoveControl extends MoveControl { diff --git a/patches/server/0121-Renewable-coral.patch b/patches/server/0119-Renewable-coral.patch similarity index 91% rename from patches/server/0121-Renewable-coral.patch rename to patches/server/0119-Renewable-coral.patch index be0351d9..2e8940a3 100644 --- a/patches/server/0121-Renewable-coral.patch +++ b/patches/server/0119-Renewable-coral.patch @@ -56,25 +56,21 @@ index 4c4aa2a63be84ff614a3dc0db2864266755545a2..208685f28509f92483f1efc89302e7a9 + // Leaves end - renewable coral } diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/CoralFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/CoralFeature.java -index 7bc5ff8eb1174834dcc27363af4a5cef19017b3d..e2fc5f9c5cc4ce6b5c1a0d0c43b753c1ca87bf72 100644 +index 7bc5ff8eb1174834dcc27363af4a5cef19017b3d..790686428b01127d0f94e044f0ec4bff4127f79e 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/CoralFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/CoralFeature.java -@@ -31,6 +31,12 @@ public abstract class CoralFeature extends Feature { +@@ -31,7 +31,7 @@ public abstract class CoralFeature extends Feature { return !optional.isEmpty() && this.placeFeature(worldGenLevel, randomSource, blockPos, optional.get().defaultBlockState()); } -+ // Leaves start - renewable coral -+ public boolean growSpecific(LevelAccessor world, RandomSource random, BlockPos pos, BlockState state) { -+ return placeFeature(world, random, pos, state); -+ } -+ // Leaves end - renewable coral -+ - protected abstract boolean placeFeature(LevelAccessor world, RandomSource random, BlockPos pos, BlockState state); +- protected abstract boolean placeFeature(LevelAccessor world, RandomSource random, BlockPos pos, BlockState state); ++ public abstract boolean placeFeature(LevelAccessor world, RandomSource random, BlockPos pos, BlockState state); // Leaves - protected -> public protected boolean placeCoralBlock(LevelAccessor world, RandomSource random, BlockPos pos, BlockState state) { + BlockPos blockPos = pos.above(); diff --git a/src/main/java/org/leavesmc/leaves/util/FertilizableCoral.java b/src/main/java/org/leavesmc/leaves/util/FertilizableCoral.java new file mode 100644 -index 0000000000000000000000000000000000000000..d7110e2def699626939f6fdeb0e8c614e51346d2 +index 0000000000000000000000000000000000000000..f1cad30bd4c937b137305e790e1d372a123170a6 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/util/FertilizableCoral.java @@ -0,0 +1,72 @@ @@ -138,7 +134,7 @@ index 0000000000000000000000000000000000000000..d7110e2def699626939f6fdeb0e8c614 + } + worldIn.setBlock(pos, Blocks.WATER.defaultBlockState(), Block.UPDATE_NONE); + -+ if (!coral.growSpecific(worldIn, random, pos, properBlock)) { ++ if (!coral.placeFeature(worldIn, random, pos, properBlock)) { + worldIn.setBlock(pos, blockUnder, 3); + } else { + if (worldIn.random.nextInt(10) == 0) { diff --git a/patches/server/0122-Fast-resume.patch b/patches/server/0120-Fast-resume.patch similarity index 100% rename from patches/server/0122-Fast-resume.patch rename to patches/server/0120-Fast-resume.patch diff --git a/patches/server/0123-Vanilla-hopper.patch b/patches/server/0121-Vanilla-hopper.patch similarity index 97% rename from patches/server/0123-Vanilla-hopper.patch rename to patches/server/0121-Vanilla-hopper.patch index 46cfb419..5523bf63 100644 --- a/patches/server/0123-Vanilla-hopper.patch +++ b/patches/server/0121-Vanilla-hopper.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Vanilla hopper This is a temporary solution designed to attempt to restore the vanilla behavior of the funnel while preserving optimizations as much as possible. It should ultimately be replaced by the optimization solution provided by lithium. diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 741ab2ffc8e4f40f43e24fed3b6d55580a3fdaca..1e5d41e6d0cb6af15d6a7771d9ee1bc9dc8dffac 100644 +index c096c9f8fc7a7e42b250306c8c35bc2c206b68ac..e98c27651dd7e73f7ff9302e61a8e7a570ba58c7 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -290,36 +290,49 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen diff --git a/patches/server/0124-Force-minecraft-command.patch b/patches/server/0122-Force-minecraft-command.patch similarity index 64% rename from patches/server/0124-Force-minecraft-command.patch rename to patches/server/0122-Force-minecraft-command.patch index dde98c15..1b7ed0ec 100644 --- a/patches/server/0124-Force-minecraft-command.patch +++ b/patches/server/0122-Force-minecraft-command.patch @@ -27,16 +27,3 @@ index 90ed57a7fbcd0625b64084347460e9864216f610..1dadec002e620b3e4906ab3381944cc9 + } + // Leaves end - force minecraft command } -diff --git a/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/src/main/java/org/leavesmc/leaves/LeavesConfig.java -index 9676585f170ffdde3ab96382efd9a1de078536a2..2a7f9d9fdb72786b08b3cb216f5aa5e5eac3c967 100644 ---- a/src/main/java/org/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java -@@ -853,7 +853,7 @@ public final class LeavesConfig { - public static boolean bstatsPrivacyMode = false; - - @GlobalConfig(name = "force-minecraft-command", category = "misc") -- public static boolean forceMinecraftCommand = true; -+ public static boolean forceMinecraftCommand = false; - - @GlobalConfig(name = "leaves-packet-event", category = "misc") - public static boolean leavesPacketEvent = true; diff --git a/patches/server/0125-Fix-falling-block-s-block-location.patch b/patches/server/0123-Fix-falling-block-s-block-location.patch similarity index 100% rename from patches/server/0125-Fix-falling-block-s-block-location.patch rename to patches/server/0123-Fix-falling-block-s-block-location.patch diff --git a/patches/server/0126-Fix-NPE-during-creating-GUI-graph.patch b/patches/server/0124-Fix-NPE-during-creating-GUI-graph.patch similarity index 100% rename from patches/server/0126-Fix-NPE-during-creating-GUI-graph.patch rename to patches/server/0124-Fix-NPE-during-creating-GUI-graph.patch diff --git a/patches/server/0127-Bytebuf-API.patch b/patches/server/0125-Bytebuf-API.patch similarity index 99% rename from patches/server/0127-Bytebuf-API.patch rename to patches/server/0125-Bytebuf-API.patch index 779105d3..d2c337f4 100644 --- a/patches/server/0127-Bytebuf-API.patch +++ b/patches/server/0125-Bytebuf-API.patch @@ -18,7 +18,7 @@ index 2de8da4dbe2f7b9da740a90829f18bff0b3d5b8c..a8af45393b4733ea3b6639ad7d890896 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 2ea690d26eacc4d5d5cceae71511be04de748a5d..cd56f9c00e3d5b72247588c797ee345d84db8f8c 100644 +index 2ea690d26eacc4d5d5cceae71511be04de748a5d..91791d087fb24e177ee2b508a0b753247e3c122a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -468,6 +468,12 @@ public abstract class PlayerList { @@ -26,7 +26,7 @@ index 2ea690d26eacc4d5d5cceae71511be04de748a5d..cd56f9c00e3d5b72247588c797ee345d } + // Leaves start - Bytebuf API -+ if (!(player instanceof ServerBot)) { ++ if (!(player instanceof ServerBot) && !(player instanceof ServerPhotographer)) { + this.cserver.getBytebufHandler().injectPlayer(player); + } + // Leaves end - Bytebuf API