Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d4611b
commit 3ba8c81
Showing
6 changed files
with
98 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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..b8622f687b4fd70aaee5fa44cc50b8ee38582582 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 double mobsBlindnessMultiplier = 1; | ||
+ private void blindnessSettings() { | ||
+ mobsBlindnessMultiplier = getDouble("gameplay-mechanics.entity-blindness-multiplier", mobsBlindnessMultiplier); | ||
+ } | ||
+ | ||
public boolean chestOpenWithBlockOnTop = false; | ||
private void chestSettings() { | ||
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop); |