From 8be3796392401a4259494d8aa8ceaf054b6b0df2 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Tue, 5 Sep 2023 08:49:44 +0800 Subject: [PATCH] Spider jockeys drop gapples (#127) --- ...004-Leaves-Server-Config-And-Command.patch | 10 +++++-- .../0125-Spider-jockeys-drop-gapples.patch | 29 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 patches/server/0125-Spider-jockeys-drop-gapples.patch diff --git a/patches/server/0004-Leaves-Server-Config-And-Command.patch b/patches/server/0004-Leaves-Server-Config-And-Command.patch index 1b4e5363..3f82cd2a 100644 --- a/patches/server/0004-Leaves-Server-Config-And-Command.patch +++ b/patches/server/0004-Leaves-Server-Config-And-Command.patch @@ -129,10 +129,10 @@ index e1c99d941c7bb954bf3ac83d5002dbf58fd833b0..4760b943da08771a42fcb22eba4d586d .withRequiredArg() diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..d739f8b96caea228335543f412546d187c7f246c +index 0000000000000000000000000000000000000000..2b970df3db3bc9ab4c9c82807b2adbdb54cd6d9b --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -0,0 +1,1020 @@ +@@ -0,0 +1,1026 @@ +package top.leavesmc.leaves; + +import com.destroystokyo.paper.util.SneakyThrow; @@ -978,6 +978,12 @@ index 0000000000000000000000000000000000000000..d739f8b96caea228335543f412546d18 + lootWorldRandom = getBoolean("settings.modify.minecraft-old.loot-world-random", lootWorldRandom); + } + ++ public static double spiderJockeysDropGapples = -1.0; ++ private static void spiderJockeysDropGapples() { ++ spiderJockeysDropGapples = getDouble("settings.modify.spider-jockeys-drop-gapples", spiderJockeysDropGapples); ++ } ++ ++ + public static final class WorldConfig { + + public final String worldName; diff --git a/patches/server/0125-Spider-jockeys-drop-gapples.patch b/patches/server/0125-Spider-jockeys-drop-gapples.patch new file mode 100644 index 00000000..d9c0dfee --- /dev/null +++ b/patches/server/0125-Spider-jockeys-drop-gapples.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: violetc <58360096+s-yh-china@users.noreply.github.com> +Date: Tue, 5 Sep 2023 08:49:01 +0800 +Subject: [PATCH] Spider jockeys drop gapples + + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java +index 05432184077752b1d0cb764a5e39ed875748b2d6..e8c576313cabb1bfb6fc157ce46e8db7f0683d25 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java +@@ -152,6 +152,18 @@ public class Spider extends Monster { + this.entityData.set(Spider.DATA_FLAGS_ID, b0); + } + ++ // Leaves start - spider jockeys drop gapples ++ @Override ++ protected void dropFromLootTable(DamageSource damageSource, boolean causedByPlayer) { ++ super.dropFromLootTable(damageSource, causedByPlayer); ++ if (top.leavesmc.leaves.LeavesConfig.spiderJockeysDropGapples > 0.0D) { ++ if (this.random.nextDouble() < top.leavesmc.leaves.LeavesConfig.spiderJockeysDropGapples) { ++ this.spawnAtLocation(new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ENCHANTED_GOLDEN_APPLE)); ++ } ++ } ++ } ++ // Leaves end - spider jockeys drop gapples ++ + @Nullable + @Override + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {