mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
35 lines
2.0 KiB
Diff
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 198fe041d20e7ed21b47d5c22dcc121a8d388623..6a8347ceefd663066de5887fef8ebc82b30a1b93 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
|
@@ -1223,7 +1223,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 e034ffef119e36e8beee125bfdaa821aba63fcaf..b58de3cc86dbeae9fc4fa612f46ef9b75432965c 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -130,8 +130,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;
|