Yatopia/patches/server/0015-EMC-ZombieReinforcementEvent.patch
2020-06-23 01:09:14 +02:00

38 lines
2.0 KiB
Diff

From e7486752efce7b488d80f8dd7bcec48d24813140 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 22 Mar 2014 23:52:54 -0400
Subject: [PATCH] EMC ZombieReinforcementEvent
Control when a zombie reinforcement event should occur (modify chance)
also makes it run on all difficulty levels
---
src/main/java/net/minecraft/server/EntityZombie.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 07ebc1d81..7524fd75c 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -322,7 +322,17 @@ public class EntityZombie extends EntityMonster {
entityliving = (EntityLiving) damagesource.getEntity();
}
- if (entityliving != null && this.world.getDifficulty() == EnumDifficulty.HARD && (double) this.random.nextFloat() < this.getAttributeInstance(EntityZombie.d).getValue() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
+ // EMC start
+ boolean spawnReinforcements = false;
+ if (entityliving != null && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
+ final double chance = this.getAttributeInstance(EntityZombie.d).getValue();
+ com.empireminecraft.customevents.ZombieReinforcementEvent event = new com.empireminecraft.customevents.ZombieReinforcementEvent( this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(), chance);
+ if (event.callEvent()) {
+ spawnReinforcements = this.random.nextFloat() < event.getChance();
+ }
+ }
+ if (spawnReinforcements) {
+ // EMC end
int i = MathHelper.floor(this.locX());
int j = MathHelper.floor(this.locY());
int k = MathHelper.floor(this.locZ());
--
2.25.1.windows.1