Added world settings for mobs picking up loot

This commit is contained in:
Jake Potrebic 2020-11-28 18:46:44 -08:00 committed by Mariell
parent 91eda5bd37
commit c8a8d6fbe9

View File

@ -0,0 +1,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 df8a43cd7a561bc5471d9b2f300c7ca4c06e2c9c..80409c4b52a4bb7146760070dae0e04d49bdd6b3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -359,6 +359,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);
}