Files
Purpur/patches/server/0128-Changeable-Mob-Left-Handed-Chance.patch
William Blake Galbreath dd259870b0 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
2780e94 Fix PaperTickList (#6241)
b854e7e Drop unneeded patch (#6240)
2961b2a Fix various mob drops being captured as death drops (#5675)
3801a39 Add ItemRarity test (#6247)
170382f Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6245)
2021-07-23 10:55:21 -05:00

35 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <me@notom3ga.me>
Date: Mon, 30 Nov 2020 11:40:11 -0500
Subject: [PATCH] Changeable Mob Left Handed Chance
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index de61f919380308f48c28ab2027077875f1e182e7..5128ee7630096ae87e2ce703b099057e9f769ee6 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1208,7 +1208,7 @@ public abstract class Mob extends LivingEntity {
@Nullable
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
this.getAttribute(Attributes.FOLLOW_RANGE).addPermanentModifier(new AttributeModifier("Random spawn bonus", this.random.nextGaussian() * 0.05D, AttributeModifier.Operation.MULTIPLY_BASE));
- if (this.random.nextFloat() < 0.05F) {
+ if (this.random.nextFloat() < this.level.purpurConfig.entityLeftHandedChance) { // Purpur
this.setLeftHanded(true);
} else {
this.setLeftHanded(false);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index c99f97d68752d89037a017761abdc3bef2ef3785..b97175d637c679dcb29b2781f8e8f7d020738527 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -129,8 +129,10 @@ public class PurpurWorldConfig {
}
public int entityLifeSpan = 0;
+ public float entityLeftHandedChance = 0.05f;
private void entitySettings() {
entityLifeSpan = getInt("gameplay-mechanics.entity-lifespan", entityLifeSpan);
+ entityLeftHandedChance = (float) getDouble("gameplay-mechanics.entity-left-handed-chance", entityLeftHandedChance);
}
public boolean infinityWorksWithoutArrows = false;