Files
Purpur/patches/server/0145-Changeable-Mob-Left-Handed-Chance.patch
BillyGalbreath 4e8a150377 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
98a702c7d [CI-SKIP] [Auto] Rebuild Patches
cab361600 Expose LivingEntity hurt direction
7ef05fbd8 Do not perform neighbour updates when using debug stick (Fixes #2134)
2020-12-23 00:45:57 -06:00

35 lines
2.1 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/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 2fef6967323145049a45d8cc44d50c788fb3e8be..e2d7c20e66b5a6c3d6037ee3e15d1ce676c29c97 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1135,7 +1135,7 @@ public abstract class EntityInsentient extends EntityLiving {
@Nullable
public GroupDataEntity prepare(WorldAccess worldaccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).addModifier(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.world.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 ee7b5efcfc0e185f0dfec50054ff53ee46d48d59..090a8c681c4288bff1efef1f782d2bf36abaef77 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 List<Item> itemImmuneToExplosion = new ArrayList<>();