Files
Purpur/patches/server/0143-Changeable-Mob-Left-Handed-Chance.patch
BillyGalbreath ba42138259 Update to 1.16.5
2021-01-15 21:03:49 -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 475741612979fa16dd29df3aea9764d501be988a..947c9fb574f111e3edfadab3c3e120b8451e1c25 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1136,7 +1136,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 7ccfce8887f9d241195b08797d141c4d78ab40b3..54205c55ef3314e06c60c64c1984baae21dbdd1d 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> itemImmuneToCactus = new ArrayList<>();