Skip to content

Commit

Permalink
Spider jockeys drop gapples (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Sep 5, 2023
1 parent c9f3b32 commit 8be3796
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
10 changes: 8 additions & 2 deletions patches/server/0004-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
29 changes: 29 additions & 0 deletions patches/server/0125-Spider-jockeys-drop-gapples.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <[email protected]>
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) {

0 comments on commit 8be3796

Please sign in to comment.