Paper/Spigot-Server-Patches/0639-Added-world-settings-for-mobs-picking-up-loot.patch
Aikar 3148b25b1c
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2021-01-11 14:12:09 -05:00

52 lines
3.2 KiB
Diff

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 a555d040fdc58f7c89ef78e3e6851916fdd8462a..c42e5d9f9c9f67988383c4c25123d8a629ede9e3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -361,6 +361,14 @@ public class PaperWorldConfig {
log("Creeper lingering effect: " + disableCreeperLingeringEffect);
}
+ 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/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
index ced89af70ca791bfe42c4e2d21604997a0cf3e0f..f73304240a626f3f7d9355e6e5f2963a06c4bb7d 100644
--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
@@ -107,7 +107,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
this.a(difficultydamagescaler);
this.b(difficultydamagescaler);
this.eL();
- this.setCanPickupLoot(this.random.nextFloat() < 0.55F * difficultydamagescaler.d());
+ this.setCanPickupLoot(this.world.paperConfig.skeletonsAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * difficultydamagescaler.d()); // Paper
if (this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
LocalDate localdate = LocalDate.now();
int i = localdate.get(ChronoField.DAY_OF_MONTH);
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 096c345da09b273c9e3e30e93759f5901c5e6fb4..62d202ff871cf3f3deea69931fbee84131bdda8b 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -433,7 +433,7 @@ public class EntityZombie extends EntityMonster {
Object object = super.prepare(worldaccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound);
float f = difficultydamagescaler.d();
- this.setCanPickupLoot(this.random.nextFloat() < 0.55F * f);
+ this.setCanPickupLoot(this.world.paperConfig.zombiesAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * f); // Paper
if (object == null) {
object = new EntityZombie.GroupDataZombie(a(worldaccess.getRandom()), true);
}