From 2a39802f8d846864a587def7c0d3cf2e3da8449a Mon Sep 17 00:00:00 2001 From: md_5 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 index 1045aa2..f1d7dc5 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -145,6 +145,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 index 8351aa5..16444b6 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -619,6 +619,12 @@ public abstract class EntityInsentient extends EntityLiving { this.world.methodProfiler.a("checkDespawn"); this.L(); this.world.methodProfiler.b(); + // Spigot Start + if ( this.fromMobSpawner ) + { + return; + } + // Spigot End this.world.methodProfiler.a("sensing"); this.bu.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 index 01cbd71..efe792b 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -94,7 +94,12 @@ public abstract class MobSpawnerAbstract { if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) { ((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null); } - + // Spigot Start + if ( entity.world.spigotConfig.nerfSpawnerMobs ) + { + entity.fromMobSpawner = true; + } + // Spigot End ChunkRegionLoader.a(entity, world, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit world.triggerEffect(2004, blockposition, 0); if (entityinsentient != null) { diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 6df2186..3854195 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -210,4 +210,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 ); + } } -- 2.5.0