Files
Purpur/patches/server/0116-Changeable-Mob-Left-Handed-Chance.patch
2021-12-31 09:45:42 -06:00

35 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <ben@omega24.dev>
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 78f7022c6584e634b000cc0c079112fc6cc8e869..2f75ebe8088d70f73a17557fe525ae119a1e19e9 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1225,7 +1225,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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index d262ce0d56d03a12c2eddc054a63bef42fe2c140..5679ea7fc6ae18b63f63d32ac91043ae12d897ba 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -149,8 +149,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;