mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Implement the Mob Blindness mod
This commit is contained in:
46
patches/server/0208-Implement-Mob-Blindness.patch
Normal file
46
patches/server/0208-Implement-Mob-Blindness.patch
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Encode42 <me@encode42.dev>
|
||||||
|
Date: Tue, 11 May 2021 21:00:53 -0400
|
||||||
|
Subject: [PATCH] Implement Mob Blindness
|
||||||
|
|
||||||
|
Ported from https://github.com/raltsmc/mobblindness
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||||
|
index aa2106e038ff882924be5b956af7cb3e8ff00397..2dc40e11eae98400b426175ceb2c92cd5942291c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||||
|
@@ -925,6 +925,18 @@ public abstract class EntityLiving extends Entity {
|
||||||
|
// Airplane end
|
||||||
|
d0 *= 0.5D;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Purpur start
|
||||||
|
+ if (entity instanceof EntityLiving) {
|
||||||
|
+ EntityLiving livingEntity = (EntityLiving) entity;
|
||||||
|
+ if (livingEntity.hasEffect(MobEffects.BLINDNESS)) {
|
||||||
|
+ int amplifier = livingEntity.getEffect(MobEffects.BLINDNESS).getAmplifier();
|
||||||
|
+ for (int i = 0; i < amplifier; i++) {
|
||||||
|
+ d0 *= world.purpurConfig.mobsBlindnessMultiplier;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Purpur end
|
||||||
|
}
|
||||||
|
|
||||||
|
return d0;
|
||||||
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
|
index 07c66f9d41e7a74021dde6702d654710e400e93b..1aa5a4849411eee5419a9daf7fe2b197e1d37153 100644
|
||||||
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
|
@@ -542,6 +542,11 @@ public class PurpurWorldConfig {
|
||||||
|
mobsSpawnOnBlueIce = getBoolean("blocks.blue_ice.allow-mob-spawns", mobsSpawnOnBlueIce);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public int mobsBlindnessMultiplier = 1;
|
||||||
|
+ private void blindnessSettings() {
|
||||||
|
+ mobsBlindnessMultiplier = getInt("gameplay-mechanics.entity-blindness-multiplier", mobsBlindnessMultiplier);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public boolean chestOpenWithBlockOnTop = false;
|
||||||
|
private void chestSettings() {
|
||||||
|
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|
||||||
Reference in New Issue
Block a user