From 3c991d16cb3f5279654f0641f834116f7d5a219a Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Tue, 25 Jun 2024 22:58:46 +0800 Subject: [PATCH] Fix crash, and rebase some patch --- patches/server/0003-Delete-Timings.patch | 10 +- patches/server/0004-Leaves-Server-Utils.patch | 106 ++++++++++ ...006-Leaves-Server-Config-And-Command.patch | 27 ++- ...nowball-and-egg-can-knockback-player.patch | 30 +-- patches/server/0010-Fakeplayer-support.patch | 192 ++---------------- .../server/0012-Redstone-Shears-Wrench.patch | 37 ++-- ...check-for-spooky-season-once-an-hour.patch | 14 +- ...turn-optimization-for-target-finding.patch | 4 +- ...oal-selector-during-inactive-ticking.patch | 4 +- ...ve-iterators-from-inventory-contains.patch | 104 +++++++--- ...036-InstantBlockUpdater-Reintroduced.patch | 14 +- ...Alternative-block-placement-Protocol.patch | 34 ---- .../0040-Player-operation-limiter.patch | 40 +--- patches/server/0041-Renewable-Elytra.patch | 15 +- .../server/0042-Stackable-ShulkerBoxes.patch | 8 +- ...0043-Improve-fluid-direction-caching.patch | 43 ++-- .../0044-MC-Technical-Survival-Mode.patch | 9 +- .../0045-Return-nether-portal-fix.patch | 13 +- .../server/0061-Creative-fly-no-clip.patch | 4 +- .../0062-Optimized-dragon-respawn.patch | 16 +- ...tment-mending-compatibility-infinity.patch | 9 - ...ers.patch => 0063-Shave-snow-layers.patch} | 0 ...re-lc.patch => 0064-Spawn-ignore-lc.patch} | 16 +- ...65-Elytra-aeronautics-no-chunk-load.patch} | 7 +- ...dds.patch => 0066-Cache-ignite-odds.patch} | 0 ...-riptide.patch => 0067-Lava-riptide.patch} | 0 ...tch => 0068-No-block-update-command.patch} | 4 +- ...069-Raider-die-skip-self-raid-check.patch} | 0 ... => 0070-Container-open-passthrough.patch} | 0 ...1-Placeholder-for-Bladeren-Protocol.patch} | 0 ...der-for-Bladeren-mspt-sync-protocol.patch} | 0 ...-support.patch => 0073-SIMD-support.patch} | 2 +- ...ont-respond-ping-before-start-fully.patch} | 0 ... => 0075-Faster-chunk-serialization.patch} | 0 ...076-Cache-world-generator-sea-level.patch} | 0 ...Skip-secondary-POI-sensor-if-absent.patch} | 0 ...> 0078-Store-mob-counts-in-an-array.patch} | 0 ...> 0079-Cache-BlockStatePairKey-hash.patch} | 0 ...h => 0080-Optimize-noise-generation.patch} | 0 ....patch => 0081-Disable-packet-limit.patch} | 0 ...ch => 0082-Reduce-array-allocations.patch} | 8 +- ...atch => 0083-Optimize-sun-burn-tick.patch} | 4 +- ...-Optional-allocation-in-EntityBased.patch} | 0 ...ignableFrom-call-in-ClassInstanceMu.patch} | 0 ...ch => 0086-Optimized-CubePointRange.patch} | 0 ...k-frozen-ticks-before-landing-block.patch} | 0 ...kip-entity-move-if-movement-is-zero.patch} | 0 ...9-Skip-cloning-advancement-criteria.patch} | 0 ...ible-planar-movement-multiplication.patch} | 2 +- ...1-Fix-villagers-dont-release-memory.patch} | 0 ...h => 0092-Avoid-anvil-too-expensive.patch} | 0 ...-fix.patch => 0093-Bow-infinity-fix.patch} | 0 ...ants.patch => 0094-Zero-tick-plants.patch} | 0 ...patch => 0095-Leaves-update-command.patch} | 0 ... => 0096-Force-peaceful-mode-switch.patch} | 6 +- ...atch => 0097-Add-Leaves-Auto-Update.patch} | 0 ...od-API.patch => 0098-Replay-Mod-API.patch} | 17 +- ...aves-I18n.patch => 0099-Leaves-I18n.patch} | 0 ...raft-hopper-not-work-without-player.patch} | 0 ...G-Fishing.patch => 0101-RNG-Fishing.patch} | 0 ...r.patch => 0102-Wool-Hopper-Counter.patch} | 0 ...patch => 0103-Leaves-Reload-Command.patch} | 0 ...=> 0104-Spider-jockeys-drop-gapples.patch} | 0 ...rade.patch => 0105-Force-Void-Trade.patch} | 0 ...106-Placeholder-for-Servux-Protocol.patch} | 0 ...=> 0107-Villager-infinite-discounts.patch} | 0 ...atch => 0108-CCE-update-suppression.patch} | 0 ...9-Disable-offline-warn-if-use-proxy.patch} | 0 ...110-Disable-moved-wrongly-threshold.patch} | 0 ...r-stand-cant-kill-by-mob-projectile.patch} | 0 ...atch => 0112-Make-Item-tick-vanilla.patch} | 0 ...atch => 0113-Copper-Bulb-1-gt-delay.patch} | 0 ...ay.patch => 0114-Crafter-1-gt-delay.patch} | 0 ...h => 0115-Linear-region-file-format.patch} | 0 ...g.patch => 0116-Protection-stacking.patch} | 0 ...e.patch => 0117-No-TNT-place-update.patch} | 0 ...ed-hopper-no-longer-send-NC-updates.patch} | 4 +- ...e.patch => 0119-Renewable-deepslate.patch} | 0 ...ges.patch => 0120-Renewable-sponges.patch} | 0 ...coral.patch => 0121-Renewable-coral.patch} | 0 ...st-resume.patch => 0122-Fast-resume.patch} | 0 ...hopper.patch => 0123-Vanilla-hopper.patch} | 0 ...tch => 0124-Force-minecraft-command.patch} | 0 ...-Fix-falling-block-s-block-location.patch} | 0 ...6-Fix-NPE-during-creating-GUI-graph.patch} | 0 ...tebuf-API.patch => 0127-Bytebuf-API.patch} | 0 ...78-Cache-CubeVoxelShape-shape-array.patch} | 0 87 files changed, 337 insertions(+), 466 deletions(-) delete mode 100644 patches/server/0063-Enchantment-mending-compatibility-infinity.patch rename patches/server/{0064-Shave-snow-layers.patch => 0063-Shave-snow-layers.patch} (100%) rename patches/server/{0065-Spawn-ignore-lc.patch => 0064-Spawn-ignore-lc.patch} (74%) rename patches/server/{0066-Elytra-aeronautics-no-chunk-load.patch => 0065-Elytra-aeronautics-no-chunk-load.patch} (97%) rename patches/server/{0067-Cache-ignite-odds.patch => 0066-Cache-ignite-odds.patch} (100%) rename patches/server/{0068-Lava-riptide.patch => 0067-Lava-riptide.patch} (100%) rename patches/server/{0069-No-block-update-command.patch => 0068-No-block-update-command.patch} (98%) rename patches/server/{0070-Raider-die-skip-self-raid-check.patch => 0069-Raider-die-skip-self-raid-check.patch} (100%) rename patches/server/{0071-Container-open-passthrough.patch => 0070-Container-open-passthrough.patch} (100%) rename patches/server/{0072-Placeholder-for-Bladeren-Protocol.patch => 0071-Placeholder-for-Bladeren-Protocol.patch} (100%) rename patches/server/{0073-Placeholder-for-Bladeren-mspt-sync-protocol.patch => 0072-Placeholder-for-Bladeren-mspt-sync-protocol.patch} (100%) rename patches/server/{0074-SIMD-support.patch => 0073-SIMD-support.patch} (90%) rename patches/server/{0075-Dont-respond-ping-before-start-fully.patch => 0074-Dont-respond-ping-before-start-fully.patch} (100%) rename patches/server/{0076-Faster-chunk-serialization.patch => 0075-Faster-chunk-serialization.patch} (100%) rename patches/server/{0077-Cache-world-generator-sea-level.patch => 0076-Cache-world-generator-sea-level.patch} (100%) rename patches/server/{0078-Skip-secondary-POI-sensor-if-absent.patch => 0077-Skip-secondary-POI-sensor-if-absent.patch} (100%) rename patches/server/{0080-Store-mob-counts-in-an-array.patch => 0078-Store-mob-counts-in-an-array.patch} (100%) rename patches/server/{0081-Cache-BlockStatePairKey-hash.patch => 0079-Cache-BlockStatePairKey-hash.patch} (100%) rename patches/server/{0082-Optimize-noise-generation.patch => 0080-Optimize-noise-generation.patch} (100%) rename patches/server/{0083-Disable-packet-limit.patch => 0081-Disable-packet-limit.patch} (100%) rename patches/server/{0084-Reduce-array-allocations.patch => 0082-Reduce-array-allocations.patch} (98%) rename patches/server/{0085-Optimize-sun-burn-tick.patch => 0083-Optimize-sun-burn-tick.patch} (96%) rename patches/server/{0086-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch => 0084-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch} (100%) rename patches/server/{0087-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch => 0085-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch} (100%) rename patches/server/{0088-Optimized-CubePointRange.patch => 0086-Optimized-CubePointRange.patch} (100%) rename patches/server/{0089-Check-frozen-ticks-before-landing-block.patch => 0087-Check-frozen-ticks-before-landing-block.patch} (100%) rename patches/server/{0090-Skip-entity-move-if-movement-is-zero.patch => 0088-Skip-entity-move-if-movement-is-zero.patch} (100%) rename patches/server/{0091-Skip-cloning-advancement-criteria.patch => 0089-Skip-cloning-advancement-criteria.patch} (100%) rename patches/server/{0092-Skip-negligible-planar-movement-multiplication.patch => 0090-Skip-negligible-planar-movement-multiplication.patch} (95%) rename patches/server/{0093-Fix-villagers-dont-release-memory.patch => 0091-Fix-villagers-dont-release-memory.patch} (100%) rename patches/server/{0094-Avoid-anvil-too-expensive.patch => 0092-Avoid-anvil-too-expensive.patch} (100%) rename patches/server/{0095-Bow-infinity-fix.patch => 0093-Bow-infinity-fix.patch} (100%) rename patches/server/{0096-Zero-tick-plants.patch => 0094-Zero-tick-plants.patch} (100%) rename patches/server/{0097-Leaves-update-command.patch => 0095-Leaves-update-command.patch} (100%) rename patches/server/{0098-Force-peaceful-mode-switch.patch => 0096-Force-peaceful-mode-switch.patch} (98%) rename patches/server/{0099-Add-Leaves-Auto-Update.patch => 0097-Add-Leaves-Auto-Update.patch} (100%) rename patches/server/{0100-Replay-Mod-API.patch => 0098-Replay-Mod-API.patch} (98%) rename patches/server/{0101-Leaves-I18n.patch => 0099-Leaves-I18n.patch} (100%) rename patches/server/{0102-Fix-minecraft-hopper-not-work-without-player.patch => 0100-Fix-minecraft-hopper-not-work-without-player.patch} (100%) rename patches/server/{0103-RNG-Fishing.patch => 0101-RNG-Fishing.patch} (100%) rename patches/server/{0104-Wool-Hopper-Counter.patch => 0102-Wool-Hopper-Counter.patch} (100%) rename patches/server/{0105-Leaves-Reload-Command.patch => 0103-Leaves-Reload-Command.patch} (100%) rename patches/server/{0106-Spider-jockeys-drop-gapples.patch => 0104-Spider-jockeys-drop-gapples.patch} (100%) rename patches/server/{0107-Force-Void-Trade.patch => 0105-Force-Void-Trade.patch} (100%) rename patches/server/{0108-Placeholder-for-Servux-Protocol.patch => 0106-Placeholder-for-Servux-Protocol.patch} (100%) rename patches/server/{0109-Villager-infinite-discounts.patch => 0107-Villager-infinite-discounts.patch} (100%) rename patches/server/{0110-CCE-update-suppression.patch => 0108-CCE-update-suppression.patch} (100%) rename patches/server/{0111-Disable-offline-warn-if-use-proxy.patch => 0109-Disable-offline-warn-if-use-proxy.patch} (100%) rename patches/server/{0112-Disable-moved-wrongly-threshold.patch => 0110-Disable-moved-wrongly-threshold.patch} (100%) rename patches/server/{0113-Armor-stand-cant-kill-by-mob-projectile.patch => 0111-Armor-stand-cant-kill-by-mob-projectile.patch} (100%) rename patches/server/{0114-Make-Item-tick-vanilla.patch => 0112-Make-Item-tick-vanilla.patch} (100%) rename patches/server/{0115-Copper-Bulb-1-gt-delay.patch => 0113-Copper-Bulb-1-gt-delay.patch} (100%) rename patches/server/{0116-Crafter-1-gt-delay.patch => 0114-Crafter-1-gt-delay.patch} (100%) rename patches/server/{0117-Linear-region-file-format.patch => 0115-Linear-region-file-format.patch} (100%) rename patches/server/{0118-Protection-stacking.patch => 0116-Protection-stacking.patch} (100%) rename patches/server/{0119-No-TNT-place-update.patch => 0117-No-TNT-place-update.patch} (100%) rename patches/server/{0120-Placing-locked-hopper-no-longer-send-NC-updates.patch => 0118-Placing-locked-hopper-no-longer-send-NC-updates.patch} (90%) rename patches/server/{0121-Renewable-deepslate.patch => 0119-Renewable-deepslate.patch} (100%) rename patches/server/{0122-Renewable-sponges.patch => 0120-Renewable-sponges.patch} (100%) rename patches/server/{0123-Renewable-coral.patch => 0121-Renewable-coral.patch} (100%) rename patches/server/{0124-Fast-resume.patch => 0122-Fast-resume.patch} (100%) rename patches/server/{0125-Vanilla-hopper.patch => 0123-Vanilla-hopper.patch} (100%) rename patches/server/{0126-Force-minecraft-command.patch => 0124-Force-minecraft-command.patch} (100%) rename patches/server/{0127-Fix-falling-block-s-block-location.patch => 0125-Fix-falling-block-s-block-location.patch} (100%) rename patches/server/{0128-Fix-NPE-during-creating-GUI-graph.patch => 0126-Fix-NPE-during-creating-GUI-graph.patch} (100%) rename patches/server/{0129-Bytebuf-API.patch => 0127-Bytebuf-API.patch} (100%) rename patches/{server/0079-Cache-CubeVoxelShape-shape-array.patch => unapplied/server/0078-Cache-CubeVoxelShape-shape-array.patch} (100%) diff --git a/patches/server/0003-Delete-Timings.patch b/patches/server/0003-Delete-Timings.patch index 2d4d1e0a..4749aea6 100644 --- a/patches/server/0003-Delete-Timings.patch +++ b/patches/server/0003-Delete-Timings.patch @@ -5,9 +5,10 @@ Subject: [PATCH] Delete Timings diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java -index 6b3cde6d4d1e63bec01f502f2027ee9fddac08aa..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 +deleted file mode 100644 +index 6b3cde6d4d1e63bec01f502f2027ee9fddac08aa..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/MinecraftTimings.java -+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java ++++ /dev/null @@ -1,178 +0,0 @@ -package co.aikar.timings; - @@ -582,9 +583,10 @@ index 7620c72a4c243cbeea245203ce03a97cbfa7d922..00000000000000000000000000000000 - } -} diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index 2f0d9b953802dee821cfde82d22b0567cce8ee91..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 +deleted file mode 100644 +index 2f0d9b953802dee821cfde82d22b0567cce8ee91..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java -+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java ++++ /dev/null @@ -1,120 +0,0 @@ -package co.aikar.timings; - diff --git a/patches/server/0004-Leaves-Server-Utils.patch b/patches/server/0004-Leaves-Server-Utils.patch index eda11779..b21215c2 100644 --- a/patches/server/0004-Leaves-Server-Utils.patch +++ b/patches/server/0004-Leaves-Server-Utils.patch @@ -297,3 +297,109 @@ index 0000000000000000000000000000000000000000..440c4d903e145229bc54eb5b6f3578fd + return backingMap.size(); + } +} +diff --git a/src/main/java/org/leavesmc/leaves/util/MathUtils.java b/src/main/java/org/leavesmc/leaves/util/MathUtils.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a6a4fd61644815a7fb01ab1a5844a34f39e57e6d +--- /dev/null ++++ b/src/main/java/org/leavesmc/leaves/util/MathUtils.java +@@ -0,0 +1,100 @@ ++package org.leavesmc.leaves.util; ++ ++import org.bukkit.util.NumberConversions; ++import org.bukkit.util.Vector; ++ ++import java.util.regex.Pattern; ++ ++public class MathUtils { ++ // Lag ? ++ public static void clean(Vector vector) { ++ if (!NumberConversions.isFinite(vector.getX())) vector.setX(0); ++ if (!NumberConversions.isFinite(vector.getY())) vector.setY(0); ++ if (!NumberConversions.isFinite(vector.getZ())) vector.setZ(0); ++ } ++ ++ private static final Pattern numericPattern = Pattern.compile("^-?[1-9]\\d*$|^0$"); ++ ++ public static boolean isNumeric(String str) { ++ return numericPattern.matcher(str).matches(); ++ } ++ ++ public static float[] fetchYawPitch(Vector dir) { ++ double x = dir.getX(); ++ double z = dir.getZ(); ++ ++ float[] out = new float[2]; ++ ++ if (x == 0.0D && z == 0.0D) { ++ out[1] = (float) (dir.getY() > 0.0D ? -90 : 90); ++ } else { ++ double theta = Math.atan2(-x, z); ++ out[0] = (float) Math.toDegrees((theta + 6.283185307179586D) % 6.283185307179586D); ++ ++ double x2 = NumberConversions.square(x); ++ double z2 = NumberConversions.square(z); ++ double xz = Math.sqrt(x2 + z2); ++ out[1] = (float) Math.toDegrees(Math.atan(-dir.getY() / xz)); ++ } ++ ++ return out; ++ } ++ ++ public static float fetchPitch(Vector dir) { ++ double x = dir.getX(); ++ double z = dir.getZ(); ++ ++ float result; ++ ++ if (x == 0.0D && z == 0.0D) { ++ result = (float) (dir.getY() > 0.0D ? -90 : 90); ++ } else { ++ double x2 = NumberConversions.square(x); ++ double z2 = NumberConversions.square(z); ++ double xz = Math.sqrt(x2 + z2); ++ result = (float) Math.toDegrees(Math.atan(-dir.getY() / xz)); ++ } ++ ++ return result; ++ } ++ ++ public static Vector getDirection(double rotX, double rotY) { ++ Vector vector = new Vector(); ++ ++ rotX = Math.toRadians(rotX); ++ rotY = Math.toRadians(rotY); ++ ++ double xz = Math.abs(Math.cos(rotY)); ++ ++ vector.setX(-Math.sin(rotX) * xz); ++ vector.setZ(Math.cos(rotX) * xz); ++ vector.setY(-Math.sin(rotY)); ++ ++ return vector; ++ } ++ ++ private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION = new int[]{0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9}; ++ ++ public static int floorLog2(int value) { ++ return ceilLog2(value) - (isPowerOfTwo(value) ? 0 : 1); ++ } ++ ++ public static int ceilLog2(int value) { ++ value = isPowerOfTwo(value) ? value : smallestEncompassingPowerOfTwo(value); ++ return MULTIPLY_DE_BRUIJN_BIT_POSITION[(int) ((long) value * 125613361L >> 27) & 31]; ++ } ++ ++ public static boolean isPowerOfTwo(int value) { ++ return value != 0 && (value & value - 1) == 0; ++ } ++ ++ public static int smallestEncompassingPowerOfTwo(int value) { ++ int i = value - 1; ++ i |= i >> 1; ++ i |= i >> 2; ++ i |= i >> 4; ++ i |= i >> 8; ++ i |= i >> 16; ++ return i + 1; ++ } ++} diff --git a/patches/server/0006-Leaves-Server-Config-And-Command.patch b/patches/server/0006-Leaves-Server-Config-And-Command.patch index 88d289aa..ff4d5e14 100644 --- a/patches/server/0006-Leaves-Server-Config-And-Command.patch +++ b/patches/server/0006-Leaves-Server-Config-And-Command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Leaves Server Config And Command diff --git a/build.gradle.kts b/build.gradle.kts -index c46b46d10b37e60d1565273f7ca2560165165088..dcaeee69130a58f17ad59dd6e353a96e5875e89c 100644 +index 5025c5df3ee6ed84106782e3f9228874bebe63ca..268193499b9f1fae0c01963e8004a3e7422f77ca 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -212,6 +212,14 @@ tasks.registerRunTask("runDevServer") { @@ -97,10 +97,10 @@ 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..b6f1b823be544662c5cb6e42acde9e39a219b55e +index 0000000000000000000000000000000000000000..9676585f170ffdde3ab96382efd9a1de078536a2 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java -@@ -0,0 +1,916 @@ +@@ -0,0 +1,922 @@ +package org.leavesmc.leaves; + +import com.destroystokyo.paper.util.SneakyThrow; @@ -307,6 +307,12 @@ index 0000000000000000000000000000000000000000..b6f1b823be544662c5cb6e42acde9e39 + } + } + ++ @GlobalConfig(name = "use-action", category = {"modify", "fakeplayer"}) ++ public static boolean fakeplayerUseAction = true; ++ ++ @GlobalConfig(name = "modify-config", category = {"modify", "fakeplayer"}) ++ public static boolean fakeplayerModifyConfig = false; ++ + // Leaves end - modify - fakeplayer + + // Leaves start - modify - minecraft-old @@ -1019,10 +1025,10 @@ index 0000000000000000000000000000000000000000..b6f1b823be544662c5cb6e42acde9e39 +} diff --git a/src/main/java/org/leavesmc/leaves/command/CommandArgument.java b/src/main/java/org/leavesmc/leaves/command/CommandArgument.java new file mode 100644 -index 0000000000000000000000000000000000000000..381cd8b33137a5b7dc688306b56805f35c57012a +index 0000000000000000000000000000000000000000..2f0e6671dd8bfe4f320eab92c5f5bbc10abc3b05 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/command/CommandArgument.java -@@ -0,0 +1,43 @@ +@@ -0,0 +1,49 @@ +package org.leavesmc.leaves.command; + +import org.jetbrains.annotations.NotNull; @@ -1057,6 +1063,12 @@ index 0000000000000000000000000000000000000000..381cd8b33137a5b7dc688306b56805f3 + return this; + } + ++ public CommandArgument setAllTabComplete(List> tabComplete) { ++ this.tabComplete.clear(); ++ this.tabComplete.addAll(tabComplete); ++ return this; ++ } ++ + public CommandArgumentResult parse(int index, String @NotNull [] args) { + Object[] result = new Object[argumentTypes.size()]; + Arrays.fill(result, null); @@ -1068,10 +1080,10 @@ index 0000000000000000000000000000000000000000..381cd8b33137a5b7dc688306b56805f3 +} diff --git a/src/main/java/org/leavesmc/leaves/command/CommandArgumentResult.java b/src/main/java/org/leavesmc/leaves/command/CommandArgumentResult.java new file mode 100644 -index 0000000000000000000000000000000000000000..e50ca0473ab4d40e2623ab15f8566276cc14f4e7 +index 0000000000000000000000000000000000000000..6549037cf0bb8460fef8bef41d2335be079b9e9b --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/command/CommandArgumentResult.java -@@ -0,0 +1,62 @@ +@@ -0,0 +1,61 @@ +package org.leavesmc.leaves.command; + +import net.minecraft.core.BlockPos; @@ -1132,7 +1144,6 @@ index 0000000000000000000000000000000000000000..e50ca0473ab4d40e2623ab15f8566276 + return null; + } + } -+ +} diff --git a/src/main/java/org/leavesmc/leaves/command/CommandArgumentType.java b/src/main/java/org/leavesmc/leaves/command/CommandArgumentType.java new file mode 100644 diff --git a/patches/server/0009-Make-snowball-and-egg-can-knockback-player.patch b/patches/server/0009-Make-snowball-and-egg-can-knockback-player.patch index 4bb4e211..d3d09765 100644 --- a/patches/server/0009-Make-snowball-and-egg-can-knockback-player.patch +++ b/patches/server/0009-Make-snowball-and-egg-can-knockback-player.patch @@ -5,45 +5,35 @@ Subject: [PATCH] Make snowball and egg can knockback player diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java -index 2b4d206c0d31ba38d7b2af654bd420e85145d441..9711279772d1617395c6fc34ae0b4bea6a215fae 100644 +index 2b4d206c0d31ba38d7b2af654bd420e85145d441..f1070a44cd51b8d611f64e7e30691de372d9567f 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java -@@ -3,6 +3,7 @@ package net.minecraft.world.entity.projectile; - import net.minecraft.core.particles.ItemParticleOption; - import net.minecraft.core.particles.ParticleOptions; - import net.minecraft.core.particles.ParticleTypes; -+import net.minecraft.server.level.ServerPlayer; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntityType; - import net.minecraft.world.entity.LivingEntity; -@@ -61,6 +62,13 @@ public class Snowball extends ThrowableItemProjectile { +@@ -61,6 +61,13 @@ public class Snowball extends ThrowableItemProjectile { int i = entity instanceof Blaze ? 3 : 0; entity.hurt(this.damageSources().thrown(this, this.getOwner()), (float) i); + + // Leaves start - make snowball can knockback player -+ if (org.leavesmc.leaves.LeavesConfig.snowballAndEggCanKnockback && entity instanceof ServerPlayer) { -+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F); -+ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE); ++ if (org.leavesmc.leaves.LeavesConfig.snowballAndEggCanKnockback && entity instanceof net.minecraft.server.level.ServerPlayer player) { ++ player.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F); ++ player.knockback(0.4000000059604645D, this.getX() - player.getX(), this.getZ() - player.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE); + } + // Leaves end - make snowball can knockback player } @Override diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java -index dbd60cc8c39f5d2d4c77e2de4f2567e7fa456cd2..01a381678a489b3965b0cc9f0de79e5c5d5394f5 100644 +index dbd60cc8c39f5d2d4c77e2de4f2567e7fa456cd2..2b8c8d0e813cd673f593dab49ecd4ee2d04dc6fa 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java -@@ -49,7 +49,14 @@ public class ThrownEgg extends ThrowableItemProjectile { - @Override +@@ -50,6 +50,12 @@ public class ThrownEgg extends ThrowableItemProjectile { protected void onHitEntity(EntityHitResult entityHitResult) { super.onHitEntity(entityHitResult); -+ Entity entity = entityHitResult.getEntity(); // Leaves - make egg can knockback player entityHitResult.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.0F); + // Leaves start - make egg can knockback player -+ if (org.leavesmc.leaves.LeavesConfig.snowballAndEggCanKnockback && entity instanceof ServerPlayer) { -+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F); -+ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE); ++ if (org.leavesmc.leaves.LeavesConfig.snowballAndEggCanKnockback && entityHitResult.getEntity() instanceof ServerPlayer player) { ++ player.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F); ++ player.knockback(0.4000000059604645D, this.getX() - player.getX(), this.getZ() - player.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE); + } + // Leaves end - make egg can knockback player } diff --git a/patches/server/0010-Fakeplayer-support.patch b/patches/server/0010-Fakeplayer-support.patch index b53127e2..e07fbbd2 100644 --- a/patches/server/0010-Fakeplayer-support.patch +++ b/patches/server/0010-Fakeplayer-support.patch @@ -33,25 +33,6 @@ index 35772110e9318df46a2729dbc0b5879b290011b7..f26989a44cdda9baabf337d573436c6c PlayerAdvancements playerAdvancements = player.getAdvancements(); Set> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak if (set != null && !set.isEmpty()) { -diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 90a2c61c42cba7e38f167eccdd7a951a947963c4..fa661b224eb658b444ab0e587f26dc91dc0d3ad7 100644 ---- a/src/main/java/net/minecraft/network/Connection.java -+++ b/src/main/java/net/minecraft/network/Connection.java -@@ -400,6 +400,14 @@ public class Connection extends SimpleChannelInboundHandler> { - } - } - -+ // Leaves start - fakeplayer -+ public void setListenerForce(PacketListener packetListener) { -+ Validate.notNull(packetListener, "packetListener"); -+ this.packetListener = packetListener; -+ this.disconnectListener = null; -+ } -+ // Leaves end - fakeplayer -+ - public void setListenerForServerboundHandshake(PacketListener packetListener) { - if (this.packetListener != null) { - throw new IllegalStateException("Listener already set"); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 307c5a0b4b7c68fe2c7d1cf77ff23c766335882d..803d0b817e5d0acb1e4c6601d4784cc5cbd5e612 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -108,18 +89,10 @@ index 85b76c5da9eea5bae0dd55f5b7ac1eb1a0211944..c6eeb3324fbf58eb7a6eb61aa7a8dfdc } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 89ed20e9c629cf39a24c7a0ce5c4fee41fc64fd5..ba8e8120313cd371065f471fcc49a79d46b55dff 100644 +index 89ed20e9c629cf39a24c7a0ce5c4fee41fc64fd5..5afef331ec117adae0c29f5c4b9f43b7be7cdd4c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -197,6 +197,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; - import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - import org.bukkit.event.player.PlayerToggleSneakEvent; - import org.bukkit.inventory.MainHand; -+import org.leavesmc.leaves.bot.ServerBot; - // CraftBukkit end - - public class ServerPlayer extends net.minecraft.world.entity.player.Player implements ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer { // Paper - rewrite chunk system -@@ -210,7 +211,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -210,7 +210,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple private static final AttributeModifier CREATIVE_ENTITY_INTERACTION_RANGE_MODIFIER = new AttributeModifier(ResourceLocation.withDefaultNamespace("creative_mode_entity_range"), 2.0D, AttributeModifier.Operation.ADD_VALUE); public ServerGamePacketListenerImpl connection; public final MinecraftServer server; @@ -128,7 +101,7 @@ index 89ed20e9c629cf39a24c7a0ce5c4fee41fc64fd5..ba8e8120313cd371065f471fcc49a79d private final PlayerAdvancements advancements; private final ServerStatsCounter stats; private float lastRecordedHealthAndAbsorption = Float.MIN_VALUE; -@@ -771,16 +772,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -771,16 +771,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple --this.invulnerableTime; } @@ -142,7 +115,7 @@ index 89ed20e9c629cf39a24c7a0ce5c4fee41fc64fd5..ba8e8120313cd371065f471fcc49a79d - this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - Inventory close reason - this.containerMenu = this.inventoryMenu; + // Leaves start - skip bot -+ if (!(this instanceof ServerBot)) { ++ if (!(this instanceof org.leavesmc.leaves.bot.ServerBot)) { + // Paper start - Configurable container update tick rate + if (--containerUpdateDelay <= 0) { + this.containerMenu.broadcastChanges(); @@ -158,31 +131,31 @@ index 89ed20e9c629cf39a24c7a0ce5c4fee41fc64fd5..ba8e8120313cd371065f471fcc49a79d Entity entity = this.getCamera(); -@@ -796,7 +801,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -796,7 +800,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple } } - CriteriaTriggers.TICK.trigger(this); -+ if (!(this instanceof ServerBot)) CriteriaTriggers.TICK.trigger(this); // Leaves - skip bot ++ if (!(this instanceof org.leavesmc.leaves.bot.ServerBot)) CriteriaTriggers.TICK.trigger(this); // Leaves - skip bot if (this.levitationStartPos != null) { CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime); } -@@ -1016,7 +1021,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1016,7 +1020,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple List loot = new java.util.ArrayList<>(this.getInventory().getContainerSize()); // Paper - Restore vanilla drops behavior boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator(); - if (!keepInventory) { -+ if (!keepInventory || this instanceof ServerBot) { // Leaves - skip bot ++ if (!keepInventory || this instanceof org.leavesmc.leaves.bot.ServerBot) { // Leaves - skip bot for (ItemStack item : this.getInventory().getContents()) { if (!item.isEmpty() && !EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) { loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false, false))); // Paper - Restore vanilla drops behavior; drop function taken from Inventory#dropAll (don't fire drop event) -@@ -1416,6 +1421,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1416,6 +1420,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple this.lastSentHealth = -1.0F; this.lastSentFood = -1; + // Leaves start - bot support + if (org.leavesmc.leaves.LeavesConfig.fakeplayerSupport) { -+ ServerBot.getBots().forEach(bot1 -> ++ org.leavesmc.leaves.bot.ServerBot.getBots().forEach(bot1 -> + bot1.sendFakeDataIfNeed(this, true)); // Leaves - render bot + } + // Leaves end - bot support @@ -275,7 +248,7 @@ index 9dcaa944134f21a86b3fe1ffa24048e273e23317..1500faf18c8b0eb2231d400aa560c306 + // Leaves end - fakeplayer support } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ba365cd594276b4876856799f793ed0b55cc9d2c..7405805d869dbfe239a9979aa4679cc4a071ad59 100644 +index bbfe8457119b76abb60653360fc272aa4580b349..9daadeeeb7bf1156fa8dc28136100f170a8e0f5c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1392,7 +1392,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -377,23 +350,14 @@ index cb4922442cb696e587d07022e152c4fd9a21ca6f..d7f373bae76e14ce20515ec22bf48c40 + // Leaves end - Bot API } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 2cde808bfa797256409879505ba205a71f381981..25761c04b17a1e3f2a48a04796f78c2811d44920 100644 +index 2cde808bfa797256409879505ba205a71f381981..a007beca6c00bce4514889935b1762a37826c75a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -57,6 +57,8 @@ import org.bukkit.plugin.Plugin; - import org.bukkit.util.BoundingBox; - import org.bukkit.util.NumberConversions; - import org.bukkit.util.Vector; -+import org.leavesmc.leaves.bot.ServerBot; -+import org.leavesmc.leaves.entity.CraftBot; - - import net.md_5.bungee.api.chat.BaseComponent; // Spigot - -@@ -94,6 +96,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -94,6 +94,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return new CraftHumanEntity(server, (net.minecraft.world.entity.player.Player) entity); } -+ if (entity instanceof ServerBot) { return new CraftBot(server, (ServerBot) entity); } ++ if (entity instanceof org.leavesmc.leaves.bot.ServerBot bot) { return new org.leavesmc.leaves.entity.CraftBot(server, bot); } + // Special case complex part, since there is no extra entity type for them if (entity instanceof EnderDragonPart complexPart) { @@ -411,23 +375,6 @@ index bb9383f1a457433f9db3e78d7913616280925200..55b41ca7630db143d70137324a9de871 /** * The start ID for the counter. */ -diff --git a/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/src/main/java/org/leavesmc/leaves/LeavesConfig.java -index 5809475f59efe62e18a0905532810e54d5a395d6..161870271e000effffe87c55c4d1d3e242e19c57 100644 ---- a/src/main/java/org/leavesmc/leaves/LeavesConfig.java -+++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java -@@ -204,6 +204,12 @@ public final class LeavesConfig { - } - } - -+ @GlobalConfig(name = "use-action", category = {"modify", "fakeplayer"}) -+ public static boolean fakeplayerUseAction = true; -+ -+ @GlobalConfig(name = "modify-config", category = {"modify", "fakeplayer"}) -+ public static boolean fakeplayerModifyConfig = false; -+ - // Leaves end - modify - fakeplayer - - // Leaves start - modify - minecraft-old diff --git a/src/main/java/org/leavesmc/leaves/bot/BotCommand.java b/src/main/java/org/leavesmc/leaves/bot/BotCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..4b31cd0407d46c3405506470f70568a1c6162262 @@ -3245,33 +3192,6 @@ index 0000000000000000000000000000000000000000..46c8dad4a6205e3e460b82f8ce5617f8 + return false; + } +} -diff --git a/src/main/java/org/leavesmc/leaves/command/CommandArgument.java b/src/main/java/org/leavesmc/leaves/command/CommandArgument.java -index 381cd8b33137a5b7dc688306b56805f35c57012a..2f0e6671dd8bfe4f320eab92c5f5bbc10abc3b05 100644 ---- a/src/main/java/org/leavesmc/leaves/command/CommandArgument.java -+++ b/src/main/java/org/leavesmc/leaves/command/CommandArgument.java -@@ -32,6 +32,12 @@ public class CommandArgument { - return this; - } - -+ public CommandArgument setAllTabComplete(List> tabComplete) { -+ this.tabComplete.clear(); -+ this.tabComplete.addAll(tabComplete); -+ return this; -+ } -+ - public CommandArgumentResult parse(int index, String @NotNull [] args) { - Object[] result = new Object[argumentTypes.size()]; - Arrays.fill(result, null); -diff --git a/src/main/java/org/leavesmc/leaves/command/CommandArgumentResult.java b/src/main/java/org/leavesmc/leaves/command/CommandArgumentResult.java -index e50ca0473ab4d40e2623ab15f8566276cc14f4e7..6549037cf0bb8460fef8bef41d2335be079b9e9b 100644 ---- a/src/main/java/org/leavesmc/leaves/command/CommandArgumentResult.java -+++ b/src/main/java/org/leavesmc/leaves/command/CommandArgumentResult.java -@@ -58,5 +58,4 @@ public class CommandArgumentResult { - return null; - } - } -- - } diff --git a/src/main/java/org/leavesmc/leaves/entity/CraftBot.java b/src/main/java/org/leavesmc/leaves/entity/CraftBot.java new file mode 100644 index 0000000000000000000000000000000000000000..fe1df01906f15e130cf947bbecb5df4bddf98c7c @@ -3444,87 +3364,3 @@ index 0000000000000000000000000000000000000000..3995912855a612f09567027138f855ec + return Actions.unregister(name); + } +} -diff --git a/src/main/java/org/leavesmc/leaves/util/MathUtils.java b/src/main/java/org/leavesmc/leaves/util/MathUtils.java -new file mode 100644 -index 0000000000000000000000000000000000000000..6c42b029d98ed293645f06dde6838761f87f20bb ---- /dev/null -+++ b/src/main/java/org/leavesmc/leaves/util/MathUtils.java -@@ -0,0 +1,78 @@ -+package org.leavesmc.leaves.util; -+ -+import org.bukkit.util.NumberConversions; -+import org.bukkit.util.Vector; -+ -+import java.util.regex.Pattern; -+ -+public class MathUtils { -+ // Lag ? -+ public static void clean(Vector vector) { -+ if (!NumberConversions.isFinite(vector.getX())) vector.setX(0); -+ if (!NumberConversions.isFinite(vector.getY())) vector.setY(0); -+ if (!NumberConversions.isFinite(vector.getZ())) vector.setZ(0); -+ } -+ -+ private static final Pattern numericPattern = Pattern.compile("^-?[1-9]\\d*$|^0$"); -+ public static boolean isNumeric(String str){ -+ return numericPattern.matcher(str).matches(); -+ } -+ -+ public static float[] fetchYawPitch(Vector dir) { -+ double x = dir.getX(); -+ double z = dir.getZ(); -+ -+ float[] out = new float[2]; -+ -+ if (x == 0.0D && z == 0.0D) { -+ out[1] = (float) (dir.getY() > 0.0D ? -90 : 90); -+ } -+ -+ else { -+ double theta = Math.atan2(-x, z); -+ out[0] = (float) Math.toDegrees((theta + 6.283185307179586D) % 6.283185307179586D); -+ -+ double x2 = NumberConversions.square(x); -+ double z2 = NumberConversions.square(z); -+ double xz = Math.sqrt(x2 + z2); -+ out[1] = (float) Math.toDegrees(Math.atan(-dir.getY() / xz)); -+ } -+ -+ return out; -+ } -+ -+ public static float fetchPitch(Vector dir) { -+ double x = dir.getX(); -+ double z = dir.getZ(); -+ -+ float result; -+ -+ if (x == 0.0D && z == 0.0D) { -+ result = (float) (dir.getY() > 0.0D ? -90 : 90); -+ } -+ -+ else { -+ double x2 = NumberConversions.square(x); -+ double z2 = NumberConversions.square(z); -+ double xz = Math.sqrt(x2 + z2); -+ result = (float) Math.toDegrees(Math.atan(-dir.getY() / xz)); -+ } -+ -+ return result; -+ } -+ -+ public static Vector getDirection(double rotX, double rotY) { -+ Vector vector = new Vector(); -+ -+ rotX = Math.toRadians(rotX); -+ rotY = Math.toRadians(rotY); -+ -+ double xz = Math.abs(Math.cos(rotY)); -+ -+ vector.setX(-Math.sin(rotX) * xz); -+ vector.setZ(Math.cos(rotX) * xz); -+ vector.setY(-Math.sin(rotY)); -+ -+ return vector; -+ } -+} diff --git a/patches/server/0012-Redstone-Shears-Wrench.patch b/patches/server/0012-Redstone-Shears-Wrench.patch index 69c2f0d2..8d65c308 100644 --- a/patches/server/0012-Redstone-Shears-Wrench.patch +++ b/patches/server/0012-Redstone-Shears-Wrench.patch @@ -5,40 +5,31 @@ Subject: [PATCH] Redstone Shears Wrench diff --git a/src/main/java/net/minecraft/world/item/ShearsItem.java b/src/main/java/net/minecraft/world/item/ShearsItem.java -index cb809796372a4658aa617404f9fddffff9b45cb7..accea918869275c76bef2dd8ce117e2119947fe2 100644 +index cb809796372a4658aa617404f9fddffff9b45cb7..f2fb88dd19b7d8e6dd3283266a80503502560fbf 100644 --- a/src/main/java/net/minecraft/world/item/ShearsItem.java +++ b/src/main/java/net/minecraft/world/item/ShearsItem.java -@@ -3,6 +3,7 @@ package net.minecraft.world.item; - import java.util.List; - import net.minecraft.advancements.CriteriaTriggers; - import net.minecraft.core.BlockPos; +@@ -19,6 +19,20 @@ import net.minecraft.world.level.block.GrowingPlantHeadBlock; + import net.minecraft.world.level.block.state.BlockState; + import net.minecraft.world.level.gameevent.GameEvent; + ++// Leaves start - shears wrench +import net.minecraft.network.chat.Component; - import net.minecraft.server.level.ServerPlayer; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; -@@ -15,9 +16,21 @@ import net.minecraft.world.item.component.Tool; - import net.minecraft.world.item.context.UseOnContext; - import net.minecraft.world.level.Level; - import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Block; +import net.minecraft.Util; +import net.minecraft.world.level.block.ComparatorBlock; +import net.minecraft.world.level.block.DispenserBlock; - import net.minecraft.world.level.block.GrowingPlantHeadBlock; +import net.minecraft.world.level.block.HopperBlock; +import net.minecraft.world.level.block.ObserverBlock; +import net.minecraft.world.level.block.RepeaterBlock; +import net.minecraft.world.level.block.piston.PistonBaseBlock; - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.Property; ++// Leaves end - shears wrench + -+import javax.annotation.Nullable; - public class ShearsItem extends Item { public ShearsItem(Item.Properties settings) { -@@ -77,6 +90,60 @@ public class ShearsItem extends Item { + super(settings); +@@ -77,6 +91,60 @@ public class ShearsItem extends Item { return InteractionResult.sidedSuccess(level.isClientSide); } @@ -55,17 +46,17 @@ index cb809796372a4658aa617404f9fddffff9b45cb7..accea918869275c76bef2dd8ce117e21 + } + + if (block instanceof PistonBaseBlock) { -+ if (getNameHelper(blockState, blockstatelist.getProperty("extended")).equals("true")) { ++ if (getNameHelper(blockState, PistonBaseBlock.EXTENDED).equals("true")) { + return InteractionResult.FAIL; + } + } + + if (block instanceof RepeaterBlock || block instanceof ComparatorBlock) { -+ if (getNameHelper(blockState, blockstatelist.getProperty("powered")).equals("true")) { ++ if (getNameHelper(blockState, ComparatorBlock.POWERED).equals("true")) { + return InteractionResult.FAIL; + } + if (block instanceof RepeaterBlock) { -+ if (getNameHelper(blockState, blockstatelist.getProperty("locked")).equals("true")) { ++ if (getNameHelper(blockState, RepeaterBlock.LOCKED).equals("true")) { + return InteractionResult.FAIL; + } + } @@ -83,10 +74,10 @@ index cb809796372a4658aa617404f9fddffff9b45cb7..accea918869275c76bef2dd8ce117e21 + + // Leaves start - shears wrench + private static > BlockState cycleState(BlockState state, Property property, boolean inverse) { -+ return (BlockState) state.setValue(property, ShearsItem.getRelative(property.getPossibleValues(), state.getValue(property), inverse)); // CraftBukkit - decompile error ++ return state.setValue(property, ShearsItem.getRelative(property.getPossibleValues(), state.getValue(property), inverse)); // CraftBukkit - decompile error + } + -+ private static T getRelative(Iterable elements, @Nullable T current, boolean inverse) { ++ private static T getRelative(Iterable elements, T current, boolean inverse) { + return inverse ? Util.findPreviousInIterable(elements, current) : Util.findNextInIterable(elements, current); + } + diff --git a/patches/server/0022-Only-check-for-spooky-season-once-an-hour.patch b/patches/server/0022-Only-check-for-spooky-season-once-an-hour.patch index 1252e93c..d52e630c 100644 --- a/patches/server/0022-Only-check-for-spooky-season-once-an-hour.patch +++ b/patches/server/0022-Only-check-for-spooky-season-once-an-hour.patch @@ -6,18 +6,10 @@ Subject: [PATCH] Only check for spooky season once an hour This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..8237f252cf60cb0ed85f6eb61e2bdb5f8e3cefef 100644 +index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..601072324b54d062bd4cceb821ae187d904ad49b 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java -@@ -215,6 +215,7 @@ public class Bat extends AmbientCreature { - super.readAdditionalSaveData(nbt); - this.entityData.set(Bat.DATA_ID_FLAGS, nbt.getByte("BatFlags")); - } -+ // Leaves end - only check for spooky season once an hour - - @Override - public void addAdditionalSaveData(CompoundTag nbt) { -@@ -239,12 +240,28 @@ public class Bat extends AmbientCreature { +@@ -239,13 +239,30 @@ public class Bat extends AmbientCreature { } } @@ -48,5 +40,7 @@ index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..8237f252cf60cb0ed85f6eb61e2bdb5f + return j == 10 && i >= 20 || j == 11 && i <= 3; + } } ++ // Leaves end - only check for spooky season once an hour private void setupAnimationStates() { + if (this.isResting()) { diff --git a/patches/server/0023-Early-return-optimization-for-target-finding.patch b/patches/server/0023-Early-return-optimization-for-target-finding.patch index 1c144691..2281acf7 100644 --- a/patches/server/0023-Early-return-optimization-for-target-finding.patch +++ b/patches/server/0023-Early-return-optimization-for-target-finding.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Early return optimization for target finding This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index aecb0ad814586bfc5e56755ee14379a69388b38c..c7218b2c8c61f288009d891ce0af3d3d7841f2bc 100644 +index aecb0ad814586bfc5e56755ee14379a69388b38c..c618d7c87a0b2e2ee55cbe64cae80178fd8bd651 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java @@ -76,9 +76,17 @@ public class TargetingConditions { @@ -21,10 +21,10 @@ index aecb0ad814586bfc5e56755ee14379a69388b38c..c7218b2c8c61f288009d891ce0af3d3d + return false; + } + } ++ // Leaves end - check range before getting visibility double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0; double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0); // Paper - Fix MC-145656 - double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); -+ // Leaves end - check range before getting visibility if (f > e * e) { return false; } diff --git a/patches/server/0025-Throttle-goal-selector-during-inactive-ticking.patch b/patches/server/0025-Throttle-goal-selector-during-inactive-ticking.patch index c89a69f6..fc1ae1d2 100644 --- a/patches/server/0025-Throttle-goal-selector-during-inactive-ticking.patch +++ b/patches/server/0025-Throttle-goal-selector-during-inactive-ticking.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Throttle goal selector during inactive ticking This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 7b93c6a04cca2ac31d137f06ef83bb08559b10bf..e4671d1e124d29ca510ad230ee832641fdcae7c8 100644 +index 7b93c6a04cca2ac31d137f06ef83bb08559b10bf..5c20fad61b81189ad45623346fa2b79ea8aa9b2a 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -232,11 +232,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -19,7 +19,7 @@ index 7b93c6a04cca2ac31d137f06ef83bb08559b10bf..e4671d1e124d29ca510ad230ee832641 public void inactiveTick() { super.inactiveTick(); - if (this.goalSelector.inactiveTick()) { -+ boolean isThrottled = org.leavesmc.leaves.LeavesConfig.throttleInactiveGoalSelectorTick && inactiveTickDisableCounter++ % 20 != 0; // Leaves - throttle inactive goal selector ticking ++ boolean isThrottled = org.leavesmc.leaves.LeavesConfig.throttleInactiveGoalSelectorTick && (inactiveTickDisableCounter++ % 20 != 0); // Leaves - throttle inactive goal selector ticking + if (this.goalSelector.inactiveTick() && !isThrottled) { // Leaves - throttle inactive goal selector ticking this.goalSelector.tick(); } diff --git a/patches/server/0028-Remove-iterators-from-inventory-contains.patch b/patches/server/0028-Remove-iterators-from-inventory-contains.patch index eba95c20..960d5fbf 100644 --- a/patches/server/0028-Remove-iterators-from-inventory-contains.patch +++ b/patches/server/0028-Remove-iterators-from-inventory-contains.patch @@ -6,30 +6,10 @@ Subject: [PATCH] Remove iterators from inventory contains This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java -index 6e66141dca61f777b354854b5d0bac2570b8bf3b..6c5c233583922a418f758dba919257a8e1e7405f 100644 +index 6e66141dca61f777b354854b5d0bac2570b8bf3b..eb11482f48c9f330b7fa62a278fd6f07d3a642e1 100644 --- a/src/main/java/net/minecraft/world/entity/player/Inventory.java +++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java -@@ -1,9 +1,11 @@ - package net.minecraft.world.entity.player; - - import com.google.common.collect.ImmutableList; -+ - import java.util.Iterator; - import java.util.List; - import java.util.function.Predicate; -+ - import net.minecraft.CrashReport; - import net.minecraft.CrashReportCategory; - import net.minecraft.ReportedException; -@@ -24,6 +26,7 @@ import net.minecraft.world.item.ItemStack; - import net.minecraft.world.level.block.state.BlockState; - // CraftBukkit start - import java.util.ArrayList; -+ - import org.bukkit.Location; - import org.bukkit.craftbukkit.entity.CraftHumanEntity; - import org.bukkit.entity.HumanEntity; -@@ -643,17 +646,31 @@ public class Inventory implements Container, Nameable { +@@ -643,17 +643,31 @@ public class Inventory implements Container, Nameable { } public boolean contains(ItemStack stack) { @@ -39,9 +19,9 @@ index 6e66141dca61f777b354854b5d0bac2570b8bf3b..6c5c233583922a418f758dba919257a8 + for (int i = 0; i < this.compartments.size(); i++) { + List list = this.compartments.get(i); + for (int j = 0; j < list.size(); j++) { -+ ItemStack itemstack1 = list.get(j); ++ ItemStack itemstack = list.get(j); + -+ if (!itemstack1.isEmpty() && ItemStack.isSameItemSameComponents(itemstack1, stack)) { ++ if (!itemstack.isEmpty() && ItemStack.isSameItemSameComponents(itemstack, stack)) { + return true; + } + } @@ -69,7 +49,81 @@ index 6e66141dca61f777b354854b5d0bac2570b8bf3b..6c5c233583922a418f758dba919257a8 } } } -@@ -695,7 +712,7 @@ public class Inventory implements Container, Nameable { +@@ -662,17 +676,30 @@ public class Inventory implements Container, Nameable { + } + + public boolean contains(TagKey tag) { +- Iterator iterator = this.compartments.iterator(); ++ if (org.leavesmc.leaves.LeavesConfig.removeInventoryContainsIterators) { ++ for (int i = 0; i < this.compartments.size(); i++) { ++ List list = this.compartments.get(i); ++ for (int j = 0; j < list.size(); j++) { ++ ItemStack itemstack = list.get(j); + +- while (iterator.hasNext()) { +- List list = (List) iterator.next(); +- Iterator iterator1 = list.iterator(); ++ if (!itemstack.isEmpty() && itemstack.is(tag)) { ++ return true; ++ } ++ } ++ } ++ } else { ++ Iterator iterator = this.compartments.iterator(); ++ ++ while (iterator.hasNext()) { ++ List list = (List) iterator.next(); ++ Iterator iterator1 = list.iterator(); + +- while (iterator1.hasNext()) { +- ItemStack itemstack = (ItemStack) iterator1.next(); ++ while (iterator1.hasNext()) { ++ ItemStack itemstack = (ItemStack) iterator1.next(); + +- if (!itemstack.isEmpty() && itemstack.is(tag)) { +- return true; ++ if (!itemstack.isEmpty() && itemstack.is(tag)) { ++ return true; ++ } + } + } + } +@@ -681,21 +708,34 @@ public class Inventory implements Container, Nameable { + } + + public boolean contains(Predicate predicate) { +- Iterator iterator = this.compartments.iterator(); ++ if (org.leavesmc.leaves.LeavesConfig.removeInventoryContainsIterators) { ++ for (int i = 0; i < this.compartments.size(); i++) { ++ List list = this.compartments.get(i); ++ for (int j = 0; j < list.size(); j++) { ++ ItemStack itemstack = list.get(j); + +- while (iterator.hasNext()) { +- List list = (List) iterator.next(); +- Iterator iterator1 = list.iterator(); ++ if (predicate.test(itemstack)) { ++ return true; ++ } ++ } ++ } ++ } else { ++ Iterator iterator = this.compartments.iterator(); + +- while (iterator1.hasNext()) { +- ItemStack itemstack = (ItemStack) iterator1.next(); ++ while (iterator.hasNext()) { ++ List list = (List) iterator.next(); ++ Iterator iterator1 = list.iterator(); + +- if (predicate.test(itemstack)) { +- return true; ++ while (iterator1.hasNext()) { ++ ItemStack itemstack = (ItemStack) iterator1.next(); ++ ++ if (predicate.test(itemstack)) { ++ return true; ++ } } } } diff --git a/patches/server/0036-InstantBlockUpdater-Reintroduced.patch b/patches/server/0036-InstantBlockUpdater-Reintroduced.patch index 70f593a2..c55f4cd2 100644 --- a/patches/server/0036-InstantBlockUpdater-Reintroduced.patch +++ b/patches/server/0036-InstantBlockUpdater-Reintroduced.patch @@ -6,25 +6,17 @@ Subject: [PATCH] InstantBlockUpdater Reintroduced This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition) diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 5ed7049b16e2c236d0c1f17e2812028cf089ea5c..b20aa275c4622ed7cb5afb1036e1e21f2671e614 100644 +index 5ed7049b16e2c236d0c1f17e2812028cf089ea5c..d7708d687f3c561e7064389e956cdc63da2cf2d9 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -74,6 +74,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; - import net.minecraft.world.level.material.FluidState; - import net.minecraft.world.level.material.Fluids; - import net.minecraft.world.level.redstone.CollectingNeighborUpdater; -+import net.minecraft.world.level.redstone.InstantNeighborUpdater; - import net.minecraft.world.level.redstone.NeighborUpdater; - import net.minecraft.world.level.saveddata.maps.MapId; - import net.minecraft.world.level.saveddata.maps.MapItemSavedData; -@@ -297,7 +298,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -297,7 +297,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl this.thread = Thread.currentThread(); this.biomeManager = new BiomeManager(this, i); this.isDebug = flag1; - this.neighborUpdater = new CollectingNeighborUpdater(this, j); + // Leaves start - instantBlockUpdaterReintroduced + if (org.leavesmc.leaves.LeavesConfig.instantBlockUpdaterReintroduced) { -+ this.neighborUpdater = new InstantNeighborUpdater(this); ++ this.neighborUpdater = new net.minecraft.world.level.redstone.InstantNeighborUpdater(this); + } else { + this.neighborUpdater = new CollectingNeighborUpdater(this, j); + } diff --git a/patches/server/0039-Alternative-block-placement-Protocol.patch b/patches/server/0039-Alternative-block-placement-Protocol.patch index 84814373..4652a91e 100644 --- a/patches/server/0039-Alternative-block-placement-Protocol.patch +++ b/patches/server/0039-Alternative-block-placement-Protocol.patch @@ -468,37 +468,3 @@ index 0000000000000000000000000000000000000000..7a49e2591e1eabf9d9444d530f631f03 + } + } +} -diff --git a/src/main/java/org/leavesmc/leaves/util/MathUtils.java b/src/main/java/org/leavesmc/leaves/util/MathUtils.java -index 6c42b029d98ed293645f06dde6838761f87f20bb..cd66a5f1b544640de1277cef870a60b53e1a128b 100644 ---- a/src/main/java/org/leavesmc/leaves/util/MathUtils.java -+++ b/src/main/java/org/leavesmc/leaves/util/MathUtils.java -@@ -75,4 +75,29 @@ public class MathUtils { - - return vector; - } -+ -+ private static final int[] MULTIPLY_DE_BRUIJN_BIT_POSITION = new int[]{0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9}; -+ -+ public static int floorLog2(int value) { -+ return ceilLog2(value) - (isPowerOfTwo(value) ? 0 : 1); -+ } -+ -+ public static int ceilLog2(int value) { -+ value = isPowerOfTwo(value) ? value : smallestEncompassingPowerOfTwo(value); -+ return MULTIPLY_DE_BRUIJN_BIT_POSITION[(int)((long)value * 125613361L >> 27) & 31]; -+ } -+ -+ public static boolean isPowerOfTwo(int value) { -+ return value != 0 && (value & value - 1) == 0; -+ } -+ -+ public static int smallestEncompassingPowerOfTwo(int value) { -+ int i = value - 1; -+ i |= i >> 1; -+ i |= i >> 2; -+ i |= i >> 4; -+ i |= i >> 8; -+ i |= i >> 16; -+ return i + 1; -+ } - } diff --git a/patches/server/0040-Player-operation-limiter.patch b/patches/server/0040-Player-operation-limiter.patch index bfffa10c..28b82d76 100644 --- a/patches/server/0040-Player-operation-limiter.patch +++ b/patches/server/0040-Player-operation-limiter.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Player operation limiter This patch is Powered by plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition) diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ba8e8120313cd371065f471fcc49a79d46b55dff..e6bdb42c8cf69e56d9fd81250b8e89ebe7001c4a 100644 +index 5afef331ec117adae0c29f5c4b9f43b7be7cdd4c..a873d07351f8909f71805eec16a2e8dc22de3bb4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -302,6 +302,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -301,6 +301,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent public @Nullable String clientBrandName = null; // Paper - Brand support public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event @@ -20,7 +20,7 @@ index ba8e8120313cd371065f471fcc49a79d46b55dff..e6bdb42c8cf69e56d9fd81250b8e89eb // Paper start - rewrite chunk system private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader; -@@ -765,6 +769,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -764,6 +768,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple this.joining = false; } // CraftBukkit end @@ -28,7 +28,7 @@ index ba8e8120313cd371065f471fcc49a79d46b55dff..e6bdb42c8cf69e56d9fd81250b8e89eb this.gameMode.tick(); this.wardenSpawnTracker.tick(); --this.spawnInvulnerableTime; -@@ -2946,5 +2951,32 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -2945,5 +2950,32 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple public CraftPlayer getBukkitEntity() { return (CraftPlayer) super.getBukkitEntity(); } @@ -62,18 +62,10 @@ index ba8e8120313cd371065f471fcc49a79d46b55dff..e6bdb42c8cf69e56d9fd81250b8e89eb // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 24b1715397ba8e6f5e9841a030d0e3d964356f89..7731bc9648838beb7c7968e85da12a32a06273e4 100644 +index 24b1715397ba8e6f5e9841a030d0e3d964356f89..c0d29abf5a21015a4a0334549c0fd9b9f585f834 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -45,6 +45,7 @@ import org.bukkit.event.Event; - import org.bukkit.event.block.Action; - import org.bukkit.event.player.PlayerGameModeChangeEvent; - import org.bukkit.event.player.PlayerInteractEvent; -+import org.leavesmc.leaves.event.player.PlayerOperationLimitEvent; - // CraftBukkit end - - public class ServerPlayerGameMode { -@@ -339,6 +340,19 @@ public class ServerPlayerGameMode { +@@ -339,6 +339,19 @@ public class ServerPlayerGameMode { } public void destroyAndAck(BlockPos pos, int sequence, String reason) { @@ -82,7 +74,7 @@ index 24b1715397ba8e6f5e9841a030d0e3d964356f89..7731bc9648838beb7c7968e85da12a32 + if (reason.equals("insta mine")) { + player.addInstaBreakCountPerTick(); + if (!player.allowOperation()) { -+ MinecraftServer.getServer().server.getPluginManager().callEvent(new PlayerOperationLimitEvent(player.getBukkitEntity(), PlayerOperationLimitEvent.Operation.MINE, CraftBlock.at(level, pos))); ++ MinecraftServer.getServer().server.getPluginManager().callEvent(new org.leavesmc.leaves.event.player.PlayerOperationLimitEvent(player.getBukkitEntity(), org.leavesmc.leaves.event.player.PlayerOperationLimitEvent.Operation.MINE, CraftBlock.at(level, pos))); + this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos))); + this.debugLogging(pos, false, sequence, reason); + return; @@ -94,22 +86,10 @@ index 24b1715397ba8e6f5e9841a030d0e3d964356f89..7731bc9648838beb7c7968e85da12a32 this.debugLogging(pos, true, sequence, reason); } else { diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java -index 7632d5ac83c84e943654477b3f36e6605e28c9a7..c21a65d9637739f1040dd27b096101a7a7adc0df 100644 +index 7632d5ac83c84e943654477b3f36e6605e28c9a7..b040844893a242280c4e8d1b2ae4af649c659b5c 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java -@@ -32,8 +32,11 @@ import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.gameevent.GameEvent; - import net.minecraft.world.phys.shapes.CollisionContext; - import org.bukkit.craftbukkit.block.CraftBlock; -+import org.bukkit.craftbukkit.block.CraftBlockState; -+import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.block.data.CraftBlockData; - import org.bukkit.event.block.BlockCanBuildEvent; -+import org.leavesmc.leaves.event.player.PlayerOperationLimitEvent; - // CraftBukkit end - - public class BlockItem extends Item { -@@ -80,6 +83,20 @@ public class BlockItem extends Item { +@@ -80,6 +80,20 @@ public class BlockItem extends Item { final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper - Reset placed block on exception // CraftBukkit end @@ -120,7 +100,7 @@ index 7632d5ac83c84e943654477b3f36e6605e28c9a7..c21a65d9637739f1040dd27b096101a7 + player.addPlaceBlockCountPerTick(); + if (!player.allowOperation()) { + if (blockstate != null) { -+ MinecraftServer.getServer().server.getPluginManager().callEvent(new PlayerOperationLimitEvent(player.getBukkitEntity(), PlayerOperationLimitEvent.Operation.PLACE, blockstate.getBlock())); ++ MinecraftServer.getServer().server.getPluginManager().callEvent(new org.leavesmc.leaves.event.player.PlayerOperationLimitEvent(player.getBukkitEntity(), org.leavesmc.leaves.event.player.PlayerOperationLimitEvent.Operation.PLACE, blockstate.getBlock())); + } + return InteractionResult.FAIL; + } diff --git a/patches/server/0041-Renewable-Elytra.patch b/patches/server/0041-Renewable-Elytra.patch index d1792be1..d340ed4a 100644 --- a/patches/server/0041-Renewable-Elytra.patch +++ b/patches/server/0041-Renewable-Elytra.patch @@ -6,19 +6,10 @@ Subject: [PATCH] Renewable Elytra This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition) diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index c277dac448a64809e93dd7a447ee3dc2a86c860e..750dc72ac7623fb22e4fce572ad56668debd756b 100644 +index c277dac448a64809e93dd7a447ee3dc2a86c860e..5641da81d6f00e153d847b9284251084d545e726 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -35,6 +35,8 @@ import net.minecraft.world.entity.ai.goal.Goal; - import net.minecraft.world.entity.ai.targeting.TargetingConditions; - import net.minecraft.world.entity.animal.Cat; - import net.minecraft.world.entity.player.Player; -+import net.minecraft.world.item.ItemStack; -+import net.minecraft.world.item.Items; - import net.minecraft.world.level.Level; - import net.minecraft.world.level.ServerLevelAccessor; - import net.minecraft.world.level.levelgen.Heightmap; -@@ -233,6 +235,20 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -233,6 +233,20 @@ public class Phantom extends FlyingMob implements Enemy { return entitysize.scale(1.0F + 0.15F * (float) i); } @@ -28,7 +19,7 @@ index c277dac448a64809e93dd7a447ee3dc2a86c860e..750dc72ac7623fb22e4fce572ad56668 + super.dropFromLootTable(source, causedByPlayer); + if (org.leavesmc.leaves.LeavesConfig.renewableElytra > 0.0D) { + if (source.getEntity() instanceof Shulker && this.random.nextDouble() < org.leavesmc.leaves.LeavesConfig.renewableElytra) { -+ ItemStack item = new ItemStack(Items.ELYTRA); ++ net.minecraft.world.item.ItemStack item = new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ELYTRA); + item.setDamageValue(432); + this.spawnAtLocation(item); + } diff --git a/patches/server/0042-Stackable-ShulkerBoxes.patch b/patches/server/0042-Stackable-ShulkerBoxes.patch index 963c0be8..60fb614c 100644 --- a/patches/server/0042-Stackable-ShulkerBoxes.patch +++ b/patches/server/0042-Stackable-ShulkerBoxes.patch @@ -96,10 +96,10 @@ index ea0d9335446b20073b9aafb9de453097355db79c..38c2e27343d68d016621cf953222b915 ItemStack itemstack1 = other.getItem(); diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java -index 6c5c233583922a418f758dba919257a8e1e7405f..d7bf7821c2f3dcae48968f9240459ef6acfd3f87 100644 +index eb11482f48c9f330b7fa62a278fd6f07d3a642e1..8631f3a5ce5aa24f195d5031dad6d289e4389314 100644 --- a/src/main/java/net/minecraft/world/entity/player/Inventory.java +++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java -@@ -114,7 +114,7 @@ public class Inventory implements Container, Nameable { +@@ -111,7 +111,7 @@ public class Inventory implements Container, Nameable { } private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) { @@ -108,7 +108,7 @@ index 6c5c233583922a418f758dba919257a8e1e7405f..d7bf7821c2f3dcae48968f9240459ef6 } // CraftBukkit start - Watch method above! :D -@@ -282,7 +282,9 @@ public class Inventory implements Container, Nameable { +@@ -279,7 +279,9 @@ public class Inventory implements Container, Nameable { this.setItem(slot, itemstack1); } @@ -119,7 +119,7 @@ index 6c5c233583922a418f758dba919257a8e1e7405f..d7bf7821c2f3dcae48968f9240459ef6 int l = Math.min(j, k); if (l == 0) { -@@ -397,7 +399,7 @@ public class Inventory implements Container, Nameable { +@@ -394,7 +396,7 @@ public class Inventory implements Container, Nameable { } if (i != -1) { diff --git a/patches/server/0043-Improve-fluid-direction-caching.patch b/patches/server/0043-Improve-fluid-direction-caching.patch index 2336445e..d92b446c 100644 --- a/patches/server/0043-Improve-fluid-direction-caching.patch +++ b/patches/server/0043-Improve-fluid-direction-caching.patch @@ -7,7 +7,7 @@ This patch is Powered by Pufferfish (https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -index 1c0712295695727ee9c4d430d4157b8e17cbd71f..7c1a0736124756f5acfa3451729a45e5bf2c2a94 100644 +index 1c0712295695727ee9c4d430d4157b8e17cbd71f..1687ab4965433459219bb5d8aaf5ec8e5baeb605 100644 --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java @@ -53,6 +53,11 @@ public abstract class FlowingFluid extends Fluid { @@ -22,55 +22,56 @@ index 1c0712295695727ee9c4d430d4157b8e17cbd71f..7c1a0736124756f5acfa3451729a45e5 private final Map shapes = Maps.newIdentityHashMap(); public FlowingFluid() {} -@@ -240,40 +245,69 @@ public abstract class FlowingFluid extends Fluid { +@@ -240,40 +245,70 @@ public abstract class FlowingFluid extends Fluid { } private boolean canPassThroughWall(Direction face, BlockGetter world, BlockPos pos, BlockState state, BlockPos fromPos, BlockState fromState) { - Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap; ++ // Leaves end - cache + if (!org.leavesmc.leaves.LeavesConfig.improveFluidDirectionCaching) { + Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap; - -- if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) { -- object2bytelinkedopenhashmap = (Object2ByteLinkedOpenHashMap) FlowingFluid.OCCLUSION_CACHE.get(); -- } else { -- object2bytelinkedopenhashmap = null; -- } ++ + if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) { + object2bytelinkedopenhashmap = (Object2ByteLinkedOpenHashMap) FlowingFluid.OCCLUSION_CACHE.get(); + } else { + object2bytelinkedopenhashmap = null; + } -- Block.BlockStatePairKey block_a; +- if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) { +- object2bytelinkedopenhashmap = (Object2ByteLinkedOpenHashMap) FlowingFluid.OCCLUSION_CACHE.get(); +- } else { +- object2bytelinkedopenhashmap = null; +- } + Block.BlockStatePairKey block_a; - -- if (object2bytelinkedopenhashmap != null) { -- block_a = new Block.BlockStatePairKey(state, fromState, face); -- byte b0 = object2bytelinkedopenhashmap.getAndMoveToFirst(block_a); ++ + if (object2bytelinkedopenhashmap != null) { + block_a = new Block.BlockStatePairKey(state, fromState, face); + byte b0 = object2bytelinkedopenhashmap.getAndMoveToFirst(block_a); - -- if (b0 != 127) { -- return b0 != 0; ++ + if (b0 != 127) { + return b0 != 0; + } + } else { + block_a = null; - } -+ ++ } + +- Block.BlockStatePairKey block_a; + VoxelShape voxelshape = state.getCollisionShape(world, pos); + VoxelShape voxelshape1 = fromState.getCollisionShape(world, fromPos); + boolean flag = !Shapes.mergedFaceOccludes(voxelshape, voxelshape1, face); -+ + +- if (object2bytelinkedopenhashmap != null) { +- block_a = new Block.BlockStatePairKey(state, fromState, face); +- byte b0 = object2bytelinkedopenhashmap.getAndMoveToFirst(block_a); + if (object2bytelinkedopenhashmap != null) { + if (object2bytelinkedopenhashmap.size() == 200) { + object2bytelinkedopenhashmap.removeLastByte(); + } -+ + +- if (b0 != 127) { +- return b0 != 0; + object2bytelinkedopenhashmap.putAndMoveToFirst(block_a, (byte) (flag ? 1 : 0)); -+ } + } + + return flag; } else { diff --git a/patches/server/0044-MC-Technical-Survival-Mode.patch b/patches/server/0044-MC-Technical-Survival-Mode.patch index 4b4170a4..a9f7b3b3 100644 --- a/patches/server/0044-MC-Technical-Survival-Mode.patch +++ b/patches/server/0044-MC-Technical-Survival-Mode.patch @@ -52,10 +52,10 @@ index d655a67584dbf973f767b59f7771c37c02762ad2..2d748b6b8929b34bf20ad32f141dac5b pearl.ownerUUID = null; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e6bdb42c8cf69e56d9fd81250b8e89ebe7001c4a..636c79ab0bab81812d879301b02eb25f3868eeef 100644 +index a873d07351f8909f71805eec16a2e8dc22de3bb4..8a5fbcdbef5d8e14ca09f6a23a19860d92258a5c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1634,7 +1634,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1633,7 +1633,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple @Override public boolean isInvulnerableTo(DamageSource damageSource) { @@ -140,10 +140,10 @@ index 592b330f187fb5eca51d60911bbebbaeaf46ef87..b08b7ffbcfbc6a12d74cadf878fd069f diff --git a/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java b/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java new file mode 100644 -index 0000000000000000000000000000000000000000..b6374842caec8c919839aaf403342208fa4b8f95 +index 0000000000000000000000000000000000000000..2fdcb75a1fb85ab2fc6759050b2e7ffa601dcfa0 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java -@@ -0,0 +1,26 @@ +@@ -0,0 +1,27 @@ +package org.leavesmc.leaves.util; + +import io.papermc.paper.configuration.GlobalConfiguration; @@ -163,6 +163,7 @@ index 0000000000000000000000000000000000000000..b6374842caec8c919839aaf403342208 + GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication = true; + GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons = true; + GlobalConfiguration.get().unsupportedSettings.allowPermanentBlockBreakExploits = true; ++ GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation = true; + GlobalConfiguration.get().packetLimiter.allPackets = new GlobalConfiguration.PacketLimiter.PacketLimit(GlobalConfiguration.get().packetLimiter.allPackets.interval(), + 5000.0, GlobalConfiguration.get().packetLimiter.allPackets.action()); + GlobalConfiguration.get().packetLimiter.overrides = Map.of(); diff --git a/patches/server/0045-Return-nether-portal-fix.patch b/patches/server/0045-Return-nether-portal-fix.patch index 1f5d5045..01e70746 100644 --- a/patches/server/0045-Return-nether-portal-fix.patch +++ b/patches/server/0045-Return-nether-portal-fix.patch @@ -6,19 +6,10 @@ Subject: [PATCH] Return nether portal fix This patch is powered by NetherPortalFix(https://github.com/TwelveIterationMods/NetherPortalFix) diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 636c79ab0bab81812d879301b02eb25f3868eeef..c6905ad01218ce5491fc87d83f80b39c3e25db18 100644 +index 8a5fbcdbef5d8e14ca09f6a23a19860d92258a5c..8d54ab1d3091817c38f3ae8691a3686ad1ac01dc 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -17,6 +17,8 @@ import java.util.OptionalInt; - import java.util.Set; - import java.util.stream.Collectors; - import javax.annotation.Nullable; -+ -+import net.minecraft.BlockUtil; - import net.minecraft.ChatFormatting; - import net.minecraft.CrashReport; - import net.minecraft.CrashReportCategory; -@@ -1437,6 +1439,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -1436,6 +1436,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); this.level().getCraftServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end diff --git a/patches/server/0061-Creative-fly-no-clip.patch b/patches/server/0061-Creative-fly-no-clip.patch index 44dd0e91..dd594fdd 100644 --- a/patches/server/0061-Creative-fly-no-clip.patch +++ b/patches/server/0061-Creative-fly-no-clip.patch @@ -60,10 +60,10 @@ index 54ba25632c2a9e1c93a5b3a0b92e5280864c49d6..eff9284b853f6771b6d44c8516436218 public boolean canBeHitByProjectile() { return !this.isSpectator() && super.canBeHitByProjectile(); diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java -index c21a65d9637739f1040dd27b096101a7a7adc0df..6dec706a2cadedfad0dff5e7784fe9bec65aad6c 100644 +index b040844893a242280c4e8d1b2ae4af649c659b5c..e667dc152e15e739f4efabed4d6e298e06ddc846 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java -@@ -205,7 +205,7 @@ public class BlockItem extends Item { +@@ -202,7 +202,7 @@ public class BlockItem extends Item { CollisionContext voxelshapecollision = entityhuman == null ? CollisionContext.empty() : CollisionContext.of(entityhuman); // CraftBukkit start - store default return Level world = context.getLevel(); // Paper - Cancel hit for vanished players diff --git a/patches/server/0062-Optimized-dragon-respawn.patch b/patches/server/0062-Optimized-dragon-respawn.patch index d3a434e2..27499377 100644 --- a/patches/server/0062-Optimized-dragon-respawn.patch +++ b/patches/server/0062-Optimized-dragon-respawn.patch @@ -18,18 +18,10 @@ index ee99519ebd46b1db3e76e7eb86e5cc121c867dc4..63f6f1328c4e39cc1f35480166ae5e22 for (int j = 0; j < this.height; j++) { for (int k = 0; k < this.depth; k++) { diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 18a1b4325cac81b040596071dab99ef9bf6f3142..cc08fbadde12ad9f2193811f75628d4bd8d59a0f 100644 +index 18a1b4325cac81b040596071dab99ef9bf6f3142..478cba8137d153fe922ca7f402d306d8c12bcb31 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -45,6 +45,7 @@ import net.minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhase; - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.block.Blocks; - import net.minecraft.world.level.block.entity.BlockEntity; -+import net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity; - import net.minecraft.world.level.block.entity.TheEndPortalBlockEntity; - import net.minecraft.world.level.block.state.pattern.BlockInWorld; - import net.minecraft.world.level.block.state.pattern.BlockPattern; -@@ -289,8 +290,67 @@ public class EndDragonFight { +@@ -289,8 +289,67 @@ public class EndDragonFight { return false; } @@ -46,7 +38,7 @@ index 18a1b4325cac81b040596071dab99ef9bf6f3142..cc08fbadde12ad9f2193811f75628d4b + for (j = cachePortalChunkIteratorZ; j <= 8; ++j) { + LevelChunk worldChunk = this.level.getChunk(i, j); + for (BlockEntity blockEntity : worldChunk.getBlockEntities().values()) { -+ if (blockEntity instanceof TheEndGatewayBlockEntity) { ++ if (blockEntity instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity) { + continue; + } + if (blockEntity instanceof TheEndPortalBlockEntity) { @@ -97,7 +89,7 @@ index 18a1b4325cac81b040596071dab99ef9bf6f3142..cc08fbadde12ad9f2193811f75628d4b ChunkPos chunkcoordintpair = new ChunkPos(this.origin); int i; -@@ -619,6 +679,11 @@ public class EndDragonFight { +@@ -619,6 +678,11 @@ public class EndDragonFight { } public boolean respawnDragon(List list) { // CraftBukkit - return boolean diff --git a/patches/server/0063-Enchantment-mending-compatibility-infinity.patch b/patches/server/0063-Enchantment-mending-compatibility-infinity.patch deleted file mode 100644 index 4a094010..00000000 --- a/patches/server/0063-Enchantment-mending-compatibility-infinity.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: Tue, 27 Jun 2023 13:48:36 +0800 -Subject: [PATCH] Enchantment mending compatibility infinity - - -diff --git a/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/patches/server/0064-Shave-snow-layers.patch b/patches/server/0063-Shave-snow-layers.patch similarity index 100% rename from patches/server/0064-Shave-snow-layers.patch rename to patches/server/0063-Shave-snow-layers.patch diff --git a/patches/server/0065-Spawn-ignore-lc.patch b/patches/server/0064-Spawn-ignore-lc.patch similarity index 74% rename from patches/server/0065-Spawn-ignore-lc.patch rename to patches/server/0064-Spawn-ignore-lc.patch index fb583a84..aa817d52 100644 --- a/patches/server/0065-Spawn-ignore-lc.patch +++ b/patches/server/0064-Spawn-ignore-lc.patch @@ -5,18 +5,10 @@ Subject: [PATCH] Spawn ignore lc diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index f0713e797b7ddfd39ebf96712983244f0abcf543..53b0c12d1adee2be920abd5fc5382f99f7d0873a 100644 +index f0713e797b7ddfd39ebf96712983244f0abcf543..5184df047c329323dfd1ebbf122963b4add098c3 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -38,6 +38,7 @@ import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.chunk.ChunkAccess; - import net.minecraft.world.level.chunk.ChunkGenerator; - import net.minecraft.world.level.chunk.LevelChunk; -+import net.minecraft.world.level.chunk.LevelChunkSection; - import net.minecraft.world.level.levelgen.Heightmap; - import net.minecraft.world.level.levelgen.structure.BuiltinStructures; - import net.minecraft.world.level.levelgen.structure.Structure; -@@ -199,6 +200,19 @@ public final class NaturalSpawner { +@@ -199,6 +199,19 @@ public final class NaturalSpawner { } public static int spawnCategoryForChunk(MobCategory group, ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner, int maxSpawns, Consumer trackEntity) { // Paper end - Optional per player mob spawns @@ -24,7 +16,7 @@ index f0713e797b7ddfd39ebf96712983244f0abcf543..53b0c12d1adee2be920abd5fc5382f99 + if (org.leavesmc.leaves.LeavesConfig.ignoreLC) { + int spawnN = 0; + for (int i = chunk.getMinBuildHeight(); i < chunk.getMaxBuildHeight(); i += 16) { -+ LevelChunkSection section = chunk.getSections()[chunk.getSectionIndex(i)]; ++ net.minecraft.world.level.chunk.LevelChunkSection section = chunk.getSections()[chunk.getSectionIndex(i)]; + if (section != null && !section.hasOnlyAir()) { + BlockPos pos = getRandomPosInChunk(world, chunk).offset(0, i, 0); + spawnN += spawnCategoryForPosition(group, world, chunk, pos, checker, runner, maxSpawns, trackEntity); @@ -36,7 +28,7 @@ index f0713e797b7ddfd39ebf96712983244f0abcf543..53b0c12d1adee2be920abd5fc5382f99 BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk); if (blockposition.getY() >= world.getMinBuildHeight() + 1) { -@@ -207,6 +221,16 @@ public final class NaturalSpawner { +@@ -207,6 +220,16 @@ public final class NaturalSpawner { return 0; // Paper - Optional per player mob spawns } diff --git a/patches/server/0066-Elytra-aeronautics-no-chunk-load.patch b/patches/server/0065-Elytra-aeronautics-no-chunk-load.patch similarity index 97% rename from patches/server/0066-Elytra-aeronautics-no-chunk-load.patch rename to patches/server/0065-Elytra-aeronautics-no-chunk-load.patch index b2e88311..fe581ecb 100644 --- a/patches/server/0066-Elytra-aeronautics-no-chunk-load.patch +++ b/patches/server/0065-Elytra-aeronautics-no-chunk-load.patch @@ -57,7 +57,7 @@ index bef88d547aefa9c5b701aa91ffc58114309a7db7..d4834489f3fc8ff8fa37dffc3eea7176 !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position()))) )) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9e6076920985bc8fc381c17daaeac328fad9df87..df301e270a3b381c47a2fa9404f6aa599ac28236 100644 +index deedfd0277131266d239b61d85eef1fb17da8c9f..8893c4ba4ad04d5580702dd55c18d766d2c236fc 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1080,7 +1080,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -84,14 +84,13 @@ index 9e6076920985bc8fc381c17daaeac328fad9df87..df301e270a3b381c47a2fa9404f6aa59 } 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 2912f6c787882dece02edc0c2c480c7ff81659ae..99d1c99f7a9aebe44bc849879f71c189e26eccad 100644 +index eff9284b853f6771b6d44c851643621897e18a17..191aeecdf355e94758ed1f8bb7ca1a91a492eab5 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -196,6 +196,8 @@ public abstract class Player extends LivingEntity { +@@ -196,6 +196,7 @@ public abstract class Player extends LivingEntity { private int currentImpulseContextResetGraceTime; public boolean affectsSpawning = true; // Paper - Affects Spawning API public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage -+ // Paper end + public boolean elytraAeronauticsNoChunk = false; // Leaves - Elytra aeronautics // CraftBukkit start diff --git a/patches/server/0067-Cache-ignite-odds.patch b/patches/server/0066-Cache-ignite-odds.patch similarity index 100% rename from patches/server/0067-Cache-ignite-odds.patch rename to patches/server/0066-Cache-ignite-odds.patch diff --git a/patches/server/0068-Lava-riptide.patch b/patches/server/0067-Lava-riptide.patch similarity index 100% rename from patches/server/0068-Lava-riptide.patch rename to patches/server/0067-Lava-riptide.patch diff --git a/patches/server/0069-No-block-update-command.patch b/patches/server/0068-No-block-update-command.patch similarity index 98% rename from patches/server/0069-No-block-update-command.patch rename to patches/server/0068-No-block-update-command.patch index 9e978ebf..f93d4637 100644 --- a/patches/server/0069-No-block-update-command.patch +++ b/patches/server/0068-No-block-update-command.patch @@ -43,10 +43,10 @@ index bfed0a72280631e6f20e6b5d493515c9b589db97..c779a244ed15e7b4c1f2c36b9a726e3f if (iblockdata.hasBlockEntity()) { diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -index 7c1a0736124756f5acfa3451729a45e5bf2c2a94..820bcf17b609ec0e91b558eb462492e58b7bafe7 100644 +index 1687ab4965433459219bb5d8aaf5ec8e5baeb605..36d49bd355b9c061b1663bcac7c9f590173f34df 100644 --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -@@ -505,6 +505,7 @@ public abstract class FlowingFluid extends Fluid { +@@ -506,6 +506,7 @@ public abstract class FlowingFluid extends Fluid { @Override public void tick(Level world, BlockPos pos, FluidState state) { diff --git a/patches/server/0070-Raider-die-skip-self-raid-check.patch b/patches/server/0069-Raider-die-skip-self-raid-check.patch similarity index 100% rename from patches/server/0070-Raider-die-skip-self-raid-check.patch rename to patches/server/0069-Raider-die-skip-self-raid-check.patch diff --git a/patches/server/0071-Container-open-passthrough.patch b/patches/server/0070-Container-open-passthrough.patch similarity index 100% rename from patches/server/0071-Container-open-passthrough.patch rename to patches/server/0070-Container-open-passthrough.patch diff --git a/patches/server/0072-Placeholder-for-Bladeren-Protocol.patch b/patches/server/0071-Placeholder-for-Bladeren-Protocol.patch similarity index 100% rename from patches/server/0072-Placeholder-for-Bladeren-Protocol.patch rename to patches/server/0071-Placeholder-for-Bladeren-Protocol.patch diff --git a/patches/server/0073-Placeholder-for-Bladeren-mspt-sync-protocol.patch b/patches/server/0072-Placeholder-for-Bladeren-mspt-sync-protocol.patch similarity index 100% rename from patches/server/0073-Placeholder-for-Bladeren-mspt-sync-protocol.patch rename to patches/server/0072-Placeholder-for-Bladeren-mspt-sync-protocol.patch diff --git a/patches/server/0074-SIMD-support.patch b/patches/server/0073-SIMD-support.patch similarity index 90% rename from patches/server/0074-SIMD-support.patch rename to patches/server/0073-SIMD-support.patch index ca4091d1..99dcdf4a 100644 --- a/patches/server/0074-SIMD-support.patch +++ b/patches/server/0073-SIMD-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] SIMD support diff --git a/build.gradle.kts b/build.gradle.kts -index dcaeee69130a58f17ad59dd6e353a96e5875e89c..369d3cf80e4f86a7d30c45befd0e10a594236dd5 100644 +index 268193499b9f1fae0c01963e8004a3e7422f77ca..b35bc56ca35e7ada015e011ab4c3136b4803e48c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -73,6 +73,7 @@ tasks.withType { diff --git a/patches/server/0075-Dont-respond-ping-before-start-fully.patch b/patches/server/0074-Dont-respond-ping-before-start-fully.patch similarity index 100% rename from patches/server/0075-Dont-respond-ping-before-start-fully.patch rename to patches/server/0074-Dont-respond-ping-before-start-fully.patch diff --git a/patches/server/0076-Faster-chunk-serialization.patch b/patches/server/0075-Faster-chunk-serialization.patch similarity index 100% rename from patches/server/0076-Faster-chunk-serialization.patch rename to patches/server/0075-Faster-chunk-serialization.patch diff --git a/patches/server/0077-Cache-world-generator-sea-level.patch b/patches/server/0076-Cache-world-generator-sea-level.patch similarity index 100% rename from patches/server/0077-Cache-world-generator-sea-level.patch rename to patches/server/0076-Cache-world-generator-sea-level.patch diff --git a/patches/server/0078-Skip-secondary-POI-sensor-if-absent.patch b/patches/server/0077-Skip-secondary-POI-sensor-if-absent.patch similarity index 100% rename from patches/server/0078-Skip-secondary-POI-sensor-if-absent.patch rename to patches/server/0077-Skip-secondary-POI-sensor-if-absent.patch diff --git a/patches/server/0080-Store-mob-counts-in-an-array.patch b/patches/server/0078-Store-mob-counts-in-an-array.patch similarity index 100% rename from patches/server/0080-Store-mob-counts-in-an-array.patch rename to patches/server/0078-Store-mob-counts-in-an-array.patch diff --git a/patches/server/0081-Cache-BlockStatePairKey-hash.patch b/patches/server/0079-Cache-BlockStatePairKey-hash.patch similarity index 100% rename from patches/server/0081-Cache-BlockStatePairKey-hash.patch rename to patches/server/0079-Cache-BlockStatePairKey-hash.patch diff --git a/patches/server/0082-Optimize-noise-generation.patch b/patches/server/0080-Optimize-noise-generation.patch similarity index 100% rename from patches/server/0082-Optimize-noise-generation.patch rename to patches/server/0080-Optimize-noise-generation.patch diff --git a/patches/server/0083-Disable-packet-limit.patch b/patches/server/0081-Disable-packet-limit.patch similarity index 100% rename from patches/server/0083-Disable-packet-limit.patch rename to patches/server/0081-Disable-packet-limit.patch diff --git a/patches/server/0084-Reduce-array-allocations.patch b/patches/server/0082-Reduce-array-allocations.patch similarity index 98% rename from patches/server/0084-Reduce-array-allocations.patch rename to patches/server/0082-Reduce-array-allocations.patch index 17ad3979..d3bb5ad8 100644 --- a/patches/server/0084-Reduce-array-allocations.patch +++ b/patches/server/0082-Reduce-array-allocations.patch @@ -193,7 +193,7 @@ index ff13d67151c50ea11a45117e524c7524e2b1a202..8c3ee4c9aa22bcc46f2dc3a5bc35bdde @Override diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index fa661b224eb658b444ab0e587f26dc91dc0d3ad7..444e3287b905650ee5e679eb2a3a440e013d4e5f 100644 +index 90a2c61c42cba7e38f167eccdd7a951a947963c4..2d6b221899a40e9bb4a52b21a62b71f7d1c26a80 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -66,6 +66,7 @@ import org.apache.commons.lang3.Validate; @@ -370,7 +370,7 @@ index 4f2ce8295977bfb8e9b6e98ca5405ecbce1dd3dd..f0496afa48c69f8619c3904dbc5e0109 for (int j = 0; j < i; ++j) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index e4671d1e124d29ca510ad230ee832641fdcae7c8..48f9e741cdfb388c8c2714cdf931ba043f257753 100644 +index 5c20fad61b81189ad45623346fa2b79ea8aa9b2a..2634a4cb8a880363829ecffa85cb57ac22f9a632 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1152,7 +1152,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -422,10 +422,10 @@ index 1bf54b0142fe41b29b21c8b97d3f52bb24a36a92..f19ace4f9027260ded3ee37c1bda91c5 public class ShapedRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe implements CraftingRecipe { // Paper - improve exact recipe choices diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b20aa275c4622ed7cb5afb1036e1e21f2671e614..fcf702cf45d31510cc51483d6063bdd999eb5f5a 100644 +index d7708d687f3c561e7064389e956cdc63da2cf2d9..e90269a8dbf974c3d37cbf2ce8576af94cf2ce04 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -102,6 +102,7 @@ import org.bukkit.craftbukkit.util.CraftSpawnCategory; +@@ -101,6 +101,7 @@ import org.bukkit.craftbukkit.util.CraftSpawnCategory; import org.bukkit.entity.SpawnCategory; import org.bukkit.event.block.BlockPhysicsEvent; // CraftBukkit end diff --git a/patches/server/0085-Optimize-sun-burn-tick.patch b/patches/server/0083-Optimize-sun-burn-tick.patch similarity index 96% rename from patches/server/0085-Optimize-sun-burn-tick.patch rename to patches/server/0083-Optimize-sun-burn-tick.patch index 8b70f987..076dbf33 100644 --- a/patches/server/0085-Optimize-sun-burn-tick.patch +++ b/patches/server/0083-Optimize-sun-burn-tick.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize sun burn tick This patch is Powered by Gale(https://github.com/GaleMC/Gale) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index df301e270a3b381c47a2fa9404f6aa599ac28236..42555b711a2d54ce2bada37a6e5cc970f095fbe4 100644 +index 8893c4ba4ad04d5580702dd55c18d766d2c236fc..a2316b7e9426a50f01d11b329a365ce9cd56b329 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1974,8 +1974,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -34,7 +34,7 @@ index df301e270a3b381c47a2fa9404f6aa599ac28236..42555b711a2d54ce2bada37a6e5cc970 public void absMoveTo(double x, double y, double z, float yaw, float pitch) { this.absMoveTo(x, y, z); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 48f9e741cdfb388c8c2714cdf931ba043f257753..3e3c2cb1d8d07b3cfd38aa675d35cabe72e73ae9 100644 +index 2634a4cb8a880363829ecffa85cb57ac22f9a632..d1ed94b5e924b39d9d17fd27f0e123316a3b4da2 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -1752,15 +1752,41 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab diff --git a/patches/server/0086-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch b/patches/server/0084-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch similarity index 100% rename from patches/server/0086-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch rename to patches/server/0084-Reduce-lambda-and-Optional-allocation-in-EntityBased.patch diff --git a/patches/server/0087-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch b/patches/server/0085-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch similarity index 100% rename from patches/server/0087-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch rename to patches/server/0085-Avoid-Class-isAssignableFrom-call-in-ClassInstanceMu.patch diff --git a/patches/server/0088-Optimized-CubePointRange.patch b/patches/server/0086-Optimized-CubePointRange.patch similarity index 100% rename from patches/server/0088-Optimized-CubePointRange.patch rename to patches/server/0086-Optimized-CubePointRange.patch diff --git a/patches/server/0089-Check-frozen-ticks-before-landing-block.patch b/patches/server/0087-Check-frozen-ticks-before-landing-block.patch similarity index 100% rename from patches/server/0089-Check-frozen-ticks-before-landing-block.patch rename to patches/server/0087-Check-frozen-ticks-before-landing-block.patch diff --git a/patches/server/0090-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0088-Skip-entity-move-if-movement-is-zero.patch similarity index 100% rename from patches/server/0090-Skip-entity-move-if-movement-is-zero.patch rename to patches/server/0088-Skip-entity-move-if-movement-is-zero.patch diff --git a/patches/server/0091-Skip-cloning-advancement-criteria.patch b/patches/server/0089-Skip-cloning-advancement-criteria.patch similarity index 100% rename from patches/server/0091-Skip-cloning-advancement-criteria.patch rename to patches/server/0089-Skip-cloning-advancement-criteria.patch diff --git a/patches/server/0092-Skip-negligible-planar-movement-multiplication.patch b/patches/server/0090-Skip-negligible-planar-movement-multiplication.patch similarity index 95% rename from patches/server/0092-Skip-negligible-planar-movement-multiplication.patch rename to patches/server/0090-Skip-negligible-planar-movement-multiplication.patch index 937a8d58..ccd6aa84 100644 --- a/patches/server/0092-Skip-negligible-planar-movement-multiplication.patch +++ b/patches/server/0090-Skip-negligible-planar-movement-multiplication.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Skip negligible planar movement multiplication This patch is Powered by Gale(https://github.com/GaleMC/Gale) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 1d87a789c717435ab45e0b00429bd766f03beba6..dfa10ae5d19840febb15b46293dc29d309b6d6d9 100644 +index 8c99cd9ab1d41c3f1a26d168b58409456e4b5732..0b42dc7526e2119cc921d9ed478c6c66c3a13a41 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1229,9 +1229,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0093-Fix-villagers-dont-release-memory.patch b/patches/server/0091-Fix-villagers-dont-release-memory.patch similarity index 100% rename from patches/server/0093-Fix-villagers-dont-release-memory.patch rename to patches/server/0091-Fix-villagers-dont-release-memory.patch diff --git a/patches/server/0094-Avoid-anvil-too-expensive.patch b/patches/server/0092-Avoid-anvil-too-expensive.patch similarity index 100% rename from patches/server/0094-Avoid-anvil-too-expensive.patch rename to patches/server/0092-Avoid-anvil-too-expensive.patch diff --git a/patches/server/0095-Bow-infinity-fix.patch b/patches/server/0093-Bow-infinity-fix.patch similarity index 100% rename from patches/server/0095-Bow-infinity-fix.patch rename to patches/server/0093-Bow-infinity-fix.patch diff --git a/patches/server/0096-Zero-tick-plants.patch b/patches/server/0094-Zero-tick-plants.patch similarity index 100% rename from patches/server/0096-Zero-tick-plants.patch rename to patches/server/0094-Zero-tick-plants.patch diff --git a/patches/server/0097-Leaves-update-command.patch b/patches/server/0095-Leaves-update-command.patch similarity index 100% rename from patches/server/0097-Leaves-update-command.patch rename to patches/server/0095-Leaves-update-command.patch diff --git a/patches/server/0098-Force-peaceful-mode-switch.patch b/patches/server/0096-Force-peaceful-mode-switch.patch similarity index 98% rename from patches/server/0098-Force-peaceful-mode-switch.patch rename to patches/server/0096-Force-peaceful-mode-switch.patch index 18990016..b02e5221 100644 --- a/patches/server/0098-Force-peaceful-mode-switch.patch +++ b/patches/server/0096-Force-peaceful-mode-switch.patch @@ -69,10 +69,10 @@ index 24cac0a5c6c724409559b5c98067e0baf8b4602d..ffc071f96e74490af821531ca361ca6e if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 53b0c12d1adee2be920abd5fc5382f99f7d0873a..e9b7860372cbcf7beefb60f68783aa632b9eaa84 100644 +index 5184df047c329323dfd1ebbf122963b4add098c3..3140d20aff7b1c518330bae088574e7163793eaf 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -128,6 +128,12 @@ public final class NaturalSpawner { +@@ -127,6 +127,12 @@ public final class NaturalSpawner { } public static void spawnForChunk(ServerLevel world, LevelChunk chunk, NaturalSpawner.SpawnState info, boolean spawnAnimals, boolean spawnMonsters, boolean rareSpawn) { @@ -85,7 +85,7 @@ index 53b0c12d1adee2be920abd5fc5382f99f7d0873a..e9b7860372cbcf7beefb60f68783aa63 world.getProfiler().push("spawner"); MobCategory[] aenumcreaturetype = NaturalSpawner.SPAWNING_CATEGORIES; int i = aenumcreaturetype.length; -@@ -136,6 +142,11 @@ public final class NaturalSpawner { +@@ -135,6 +141,11 @@ public final class NaturalSpawner { for (int j = 0; j < i; ++j) { MobCategory enumcreaturetype = aenumcreaturetype[j]; diff --git a/patches/server/0099-Add-Leaves-Auto-Update.patch b/patches/server/0097-Add-Leaves-Auto-Update.patch similarity index 100% rename from patches/server/0099-Add-Leaves-Auto-Update.patch rename to patches/server/0097-Add-Leaves-Auto-Update.patch diff --git a/patches/server/0100-Replay-Mod-API.patch b/patches/server/0098-Replay-Mod-API.patch similarity index 98% rename from patches/server/0100-Replay-Mod-API.patch rename to patches/server/0098-Replay-Mod-API.patch index f43180c5..71a869f0 100644 --- a/patches/server/0100-Replay-Mod-API.patch +++ b/patches/server/0098-Replay-Mod-API.patch @@ -390,23 +390,14 @@ index d7f373bae76e14ce20515ec22bf48c40a2054f92..a58a495d35c5963df7947b42c4000a0f + // Leaves end - replay mod api } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 25761c04b17a1e3f2a48a04796f78c2811d44920..5a3f2868d7753cf257f54355b0978abb6744c516 100644 +index a007beca6c00bce4514889935b1762a37826c75a..02881fdb1a3c96466618149c288094b755eafb4d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -61,6 +61,8 @@ import org.leavesmc.leaves.bot.ServerBot; - import org.leavesmc.leaves.entity.CraftBot; - - import net.md_5.bungee.api.chat.BaseComponent; // Spigot -+import org.leavesmc.leaves.entity.CraftPhotographer; -+import org.leavesmc.leaves.replay.ServerPhotographer; - - public abstract class CraftEntity implements org.bukkit.entity.Entity { - private static PermissibleBase perm; -@@ -97,6 +99,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -95,6 +95,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } - if (entity instanceof ServerBot) { return new CraftBot(server, (ServerBot) entity); } -+ if (entity instanceof ServerPhotographer) { return new CraftPhotographer(server, (ServerPhotographer) entity); } + if (entity instanceof org.leavesmc.leaves.bot.ServerBot bot) { return new org.leavesmc.leaves.entity.CraftBot(server, bot); } ++ if (entity instanceof org.leavesmc.leaves.replay.ServerPhotographer photographer) { return new org.leavesmc.leaves.entity.CraftPhotographer(server, photographer); } // Special case complex part, since there is no extra entity type for them if (entity instanceof EnderDragonPart complexPart) { diff --git a/patches/server/0101-Leaves-I18n.patch b/patches/server/0099-Leaves-I18n.patch similarity index 100% rename from patches/server/0101-Leaves-I18n.patch rename to patches/server/0099-Leaves-I18n.patch diff --git a/patches/server/0102-Fix-minecraft-hopper-not-work-without-player.patch b/patches/server/0100-Fix-minecraft-hopper-not-work-without-player.patch similarity index 100% rename from patches/server/0102-Fix-minecraft-hopper-not-work-without-player.patch rename to patches/server/0100-Fix-minecraft-hopper-not-work-without-player.patch diff --git a/patches/server/0103-RNG-Fishing.patch b/patches/server/0101-RNG-Fishing.patch similarity index 100% rename from patches/server/0103-RNG-Fishing.patch rename to patches/server/0101-RNG-Fishing.patch diff --git a/patches/server/0104-Wool-Hopper-Counter.patch b/patches/server/0102-Wool-Hopper-Counter.patch similarity index 100% rename from patches/server/0104-Wool-Hopper-Counter.patch rename to patches/server/0102-Wool-Hopper-Counter.patch diff --git a/patches/server/0105-Leaves-Reload-Command.patch b/patches/server/0103-Leaves-Reload-Command.patch similarity index 100% rename from patches/server/0105-Leaves-Reload-Command.patch rename to patches/server/0103-Leaves-Reload-Command.patch diff --git a/patches/server/0106-Spider-jockeys-drop-gapples.patch b/patches/server/0104-Spider-jockeys-drop-gapples.patch similarity index 100% rename from patches/server/0106-Spider-jockeys-drop-gapples.patch rename to patches/server/0104-Spider-jockeys-drop-gapples.patch diff --git a/patches/server/0107-Force-Void-Trade.patch b/patches/server/0105-Force-Void-Trade.patch similarity index 100% rename from patches/server/0107-Force-Void-Trade.patch rename to patches/server/0105-Force-Void-Trade.patch diff --git a/patches/server/0108-Placeholder-for-Servux-Protocol.patch b/patches/server/0106-Placeholder-for-Servux-Protocol.patch similarity index 100% rename from patches/server/0108-Placeholder-for-Servux-Protocol.patch rename to patches/server/0106-Placeholder-for-Servux-Protocol.patch diff --git a/patches/server/0109-Villager-infinite-discounts.patch b/patches/server/0107-Villager-infinite-discounts.patch similarity index 100% rename from patches/server/0109-Villager-infinite-discounts.patch rename to patches/server/0107-Villager-infinite-discounts.patch diff --git a/patches/server/0110-CCE-update-suppression.patch b/patches/server/0108-CCE-update-suppression.patch similarity index 100% rename from patches/server/0110-CCE-update-suppression.patch rename to patches/server/0108-CCE-update-suppression.patch diff --git a/patches/server/0111-Disable-offline-warn-if-use-proxy.patch b/patches/server/0109-Disable-offline-warn-if-use-proxy.patch similarity index 100% rename from patches/server/0111-Disable-offline-warn-if-use-proxy.patch rename to patches/server/0109-Disable-offline-warn-if-use-proxy.patch diff --git a/patches/server/0112-Disable-moved-wrongly-threshold.patch b/patches/server/0110-Disable-moved-wrongly-threshold.patch similarity index 100% rename from patches/server/0112-Disable-moved-wrongly-threshold.patch rename to patches/server/0110-Disable-moved-wrongly-threshold.patch diff --git a/patches/server/0113-Armor-stand-cant-kill-by-mob-projectile.patch b/patches/server/0111-Armor-stand-cant-kill-by-mob-projectile.patch similarity index 100% rename from patches/server/0113-Armor-stand-cant-kill-by-mob-projectile.patch rename to patches/server/0111-Armor-stand-cant-kill-by-mob-projectile.patch diff --git a/patches/server/0114-Make-Item-tick-vanilla.patch b/patches/server/0112-Make-Item-tick-vanilla.patch similarity index 100% rename from patches/server/0114-Make-Item-tick-vanilla.patch rename to patches/server/0112-Make-Item-tick-vanilla.patch diff --git a/patches/server/0115-Copper-Bulb-1-gt-delay.patch b/patches/server/0113-Copper-Bulb-1-gt-delay.patch similarity index 100% rename from patches/server/0115-Copper-Bulb-1-gt-delay.patch rename to patches/server/0113-Copper-Bulb-1-gt-delay.patch diff --git a/patches/server/0116-Crafter-1-gt-delay.patch b/patches/server/0114-Crafter-1-gt-delay.patch similarity index 100% rename from patches/server/0116-Crafter-1-gt-delay.patch rename to patches/server/0114-Crafter-1-gt-delay.patch diff --git a/patches/server/0117-Linear-region-file-format.patch b/patches/server/0115-Linear-region-file-format.patch similarity index 100% rename from patches/server/0117-Linear-region-file-format.patch rename to patches/server/0115-Linear-region-file-format.patch diff --git a/patches/server/0118-Protection-stacking.patch b/patches/server/0116-Protection-stacking.patch similarity index 100% rename from patches/server/0118-Protection-stacking.patch rename to patches/server/0116-Protection-stacking.patch diff --git a/patches/server/0119-No-TNT-place-update.patch b/patches/server/0117-No-TNT-place-update.patch similarity index 100% rename from patches/server/0119-No-TNT-place-update.patch rename to patches/server/0117-No-TNT-place-update.patch diff --git a/patches/server/0120-Placing-locked-hopper-no-longer-send-NC-updates.patch b/patches/server/0118-Placing-locked-hopper-no-longer-send-NC-updates.patch similarity index 90% rename from patches/server/0120-Placing-locked-hopper-no-longer-send-NC-updates.patch rename to patches/server/0118-Placing-locked-hopper-no-longer-send-NC-updates.patch index bff38bec..27469487 100644 --- a/patches/server/0120-Placing-locked-hopper-no-longer-send-NC-updates.patch +++ b/patches/server/0118-Placing-locked-hopper-no-longer-send-NC-updates.patch @@ -5,7 +5,7 @@ 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 fcf702cf45d31510cc51483d6063bdd999eb5f5a..f3e3047add2d0d7cdb0bf62dd445aa68c66cde5c 100644 +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; @@ -16,7 +16,7 @@ index fcf702cf45d31510cc51483d6063bdd999eb5f5a..f3e3047add2d0d7cdb0bf62dd445aa68 import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.TickingBlockEntity; import net.minecraft.world.level.block.state.BlockState; -@@ -699,7 +700,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -698,7 +699,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } if ((i & 1) != 0) { diff --git a/patches/server/0121-Renewable-deepslate.patch b/patches/server/0119-Renewable-deepslate.patch similarity index 100% rename from patches/server/0121-Renewable-deepslate.patch rename to patches/server/0119-Renewable-deepslate.patch diff --git a/patches/server/0122-Renewable-sponges.patch b/patches/server/0120-Renewable-sponges.patch similarity index 100% rename from patches/server/0122-Renewable-sponges.patch rename to patches/server/0120-Renewable-sponges.patch diff --git a/patches/server/0123-Renewable-coral.patch b/patches/server/0121-Renewable-coral.patch similarity index 100% rename from patches/server/0123-Renewable-coral.patch rename to patches/server/0121-Renewable-coral.patch diff --git a/patches/server/0124-Fast-resume.patch b/patches/server/0122-Fast-resume.patch similarity index 100% rename from patches/server/0124-Fast-resume.patch rename to patches/server/0122-Fast-resume.patch diff --git a/patches/server/0125-Vanilla-hopper.patch b/patches/server/0123-Vanilla-hopper.patch similarity index 100% rename from patches/server/0125-Vanilla-hopper.patch rename to patches/server/0123-Vanilla-hopper.patch diff --git a/patches/server/0126-Force-minecraft-command.patch b/patches/server/0124-Force-minecraft-command.patch similarity index 100% rename from patches/server/0126-Force-minecraft-command.patch rename to patches/server/0124-Force-minecraft-command.patch diff --git a/patches/server/0127-Fix-falling-block-s-block-location.patch b/patches/server/0125-Fix-falling-block-s-block-location.patch similarity index 100% rename from patches/server/0127-Fix-falling-block-s-block-location.patch rename to patches/server/0125-Fix-falling-block-s-block-location.patch diff --git a/patches/server/0128-Fix-NPE-during-creating-GUI-graph.patch b/patches/server/0126-Fix-NPE-during-creating-GUI-graph.patch similarity index 100% rename from patches/server/0128-Fix-NPE-during-creating-GUI-graph.patch rename to patches/server/0126-Fix-NPE-during-creating-GUI-graph.patch diff --git a/patches/server/0129-Bytebuf-API.patch b/patches/server/0127-Bytebuf-API.patch similarity index 100% rename from patches/server/0129-Bytebuf-API.patch rename to patches/server/0127-Bytebuf-API.patch diff --git a/patches/server/0079-Cache-CubeVoxelShape-shape-array.patch b/patches/unapplied/server/0078-Cache-CubeVoxelShape-shape-array.patch similarity index 100% rename from patches/server/0079-Cache-CubeVoxelShape-shape-array.patch rename to patches/unapplied/server/0078-Cache-CubeVoxelShape-shape-array.patch