Files
Purpur/patches/server/0113-Changeable-Mob-Left-Handed-Chance.patch
Ben Kerllenevich 17c72b537c 200/273
2022-06-08 11:50:34 -04:00

35 lines
1.9 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 7dd8fdb921e8ad0a2d21f67241ed7c07614347a0..034aa7c98397bd9e4fd1e615e3cdad7e3473eb70 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1233,7 +1233,7 @@ public abstract class Mob extends LivingEntity {
RandomSource randomsource = world.getRandom();
this.getAttribute(Attributes.FOLLOW_RANGE).addPermanentModifier(new AttributeModifier("Random spawn bonus", randomsource.triangle(0.0D, 0.11485000000000001D), AttributeModifier.Operation.MULTIPLY_BASE));
- if (randomsource.nextFloat() < 0.05F) {
+ if (randomsource.nextFloat() < world.getLevel().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 7ccfccaaa3a4105751cdccdefa0784e7657bb503..b5b9217aeffb10219f06e196e91060ea24326b47 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -150,8 +150,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;