Paper/CraftBukkit-Patches/0064-Add-Option-to-Nerf-Mobs-from-Spawner-s.patch

85 lines
3.8 KiB
Diff
Raw Normal View History

2015-04-16 10:19:45 +00:00
From 6f07b5b8fb96bdfa7b2bd48ae6e302f0f175a14c Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 2 Feb 2014 16:55:46 +0000
Subject: [PATCH] Add Option to Nerf Mobs from Spawner's
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
2015-02-28 11:36:22 +00:00
index 5e1e695..b930c0d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
2015-02-28 11:36:22 +00:00
@@ -120,6 +120,7 @@ public abstract class Entity implements ICommandListener {
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
+ public boolean fromMobSpawner;
public void inactiveTick() { }
// Spigot end
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
2015-04-16 10:19:45 +00:00
index d0769c6..acf0578 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
2015-04-16 10:19:45 +00:00
@@ -457,6 +457,12 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.methodProfiler.a("checkDespawn");
2014-11-28 01:17:45 +00:00
this.D();
this.world.methodProfiler.b();
+ // Spigot Start
+ if ( this.fromMobSpawner )
+ {
+ return;
+ }
+ // Spigot End
this.world.methodProfiler.a("sensing");
2015-02-28 11:36:22 +00:00
this.bk.a();
this.world.methodProfiler.b();
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
2015-02-28 11:36:22 +00:00
index 41cfde8..df71db5 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -144,6 +144,12 @@ public abstract class MobSpawnerAbstract {
2014-11-28 01:17:45 +00:00
SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
if (!event.isCancelled()) {
entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // Spigot Start
+ if ( entity.world.spigotConfig.nerfSpawnerMobs )
+ {
+ entity.fromMobSpawner = true;
+ }
+ // Spigot End
}
// CraftBukkit end
}
2015-02-28 11:36:22 +00:00
@@ -191,6 +197,12 @@ public abstract class MobSpawnerAbstract {
2014-11-28 01:17:45 +00:00
SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b().getX(), this.b().getY(), this.b().getZ());
if (!event.isCancelled()) {
2014-11-28 01:17:45 +00:00
entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ // Spigot Start
+ if ( entity.world.spigotConfig.nerfSpawnerMobs )
+ {
+ entity.fromMobSpawner = true;
+ }
+ // Spigot End
}
// Spigot end
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2015-02-26 10:40:16 +00:00
index 9c1cd19..891812a 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -252,4 +252,11 @@ public class SpigotWorldConfig
zombieAggressiveTowardsVillager = getBoolean( "zombie-aggressive-towards-villager", true );
log( "Zombie Aggressive Towards Villager: " + zombieAggressiveTowardsVillager );
}
+
+ public boolean nerfSpawnerMobs;
+ private void nerfSpawnerMobs()
+ {
+ nerfSpawnerMobs = getBoolean( "nerf-spawner-mobs", false );
+ log( "Nerfing mobs spawned from spawners: " + nerfSpawnerMobs );
+ }
}
--
2014-11-28 01:17:45 +00:00
2.1.0