aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0563-Added-world-settings-for-mobs-picking-up-loot.patch
blob: 643cc13eaf5fc11bd38029a6dffce7ae0a174875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 28 Nov 2020 18:43:52 -0800
Subject: [PATCH] Added world settings for mobs picking up loot


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 375c15f672cbc612e4ab967d3519697937e7860e..137e4a16c4013bbbd6fed4f09f076267b2f45707 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -737,6 +737,14 @@ public class PaperWorldConfig {
         phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs);
     }
 
+    public boolean zombiesAlwaysCanPickUpLoot;
+    public boolean skeletonsAlwaysCanPickUpLoot;
+    private void setMobsAlwaysCanPickUpLoot() {
+        zombiesAlwaysCanPickUpLoot = getBoolean("mobs-can-always-pick-up-loot.zombies", false);
+        skeletonsAlwaysCanPickUpLoot = getBoolean("mobs-can-always-pick-up-loot.skeletons", false);
+        log("Zombies can always pick up loot: " + zombiesAlwaysCanPickUpLoot + ". Skeletons can always pick up loot: " + skeletonsAlwaysCanPickUpLoot + ".");
+    }
+
     public int expMergeMaxValue;
     private void expMergeMaxValue() {
         expMergeMaxValue = getInt("experience-merge-max-value", -1);
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 609380af4de4118a543b6ec94feb176e6f6870ed..ecf12ed5014202181e78af051e4a9ca88a275794 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -147,7 +147,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
         this.populateDefaultEquipmentSlots(difficulty);
         this.populateDefaultEquipmentEnchantments(difficulty);
         this.reassessWeaponGoal();
-        this.setCanPickUpLoot(this.random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
+        this.setCanPickUpLoot(this.level.paperConfig.skeletonsAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper
         if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
             LocalDate localdate = LocalDate.now();
             int i = localdate.get(ChronoField.DAY_OF_MONTH);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 5341f65436bb147c8aed5206c5e4515c7517bc2e..92145b35cf9f04afd388dfea8215097a9da7c5a7 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -503,7 +503,7 @@ public class Zombie extends Monster {
         Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
         float f = difficulty.getSpecialMultiplier();
 
-        this.setCanPickUpLoot(this.random.nextFloat() < 0.55F * f);
+        this.setCanPickUpLoot(this.level.paperConfig.zombiesAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * f); // Paper
         if (object == null) {
             object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(world.getRandom()), true);
         }