Yatopia/patches/server/0016-EMC-ZombieReinforcementEvent.patch
2020-02-26 20:12:29 +01:00

38 lines
2.0 KiB
Diff

From 978627fcf684028e49549fcb18f7023bc2649bae 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 8635d4f4..01428294 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