mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
7b0c576798
Allows us much greater control over the Spigot portion of the code and makes us more "proper" Credit to @Dmck2b for originally passing the idea along a while back
85 lines
3.7 KiB
Diff
85 lines
3.7 KiB
Diff
From 2a00eb8a54efd19242c35ab1b0e4eefed740cb5f 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
|
|
index 134e06b..f1bad28 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -119,6 +119,7 @@ public abstract class Entity {
|
|
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
|
public final boolean defaultActivationState;
|
|
public long activatedTick = 0;
|
|
+ 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 a812656..f6c4788 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -400,6 +400,12 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
this.world.methodProfiler.a("checkDespawn");
|
|
this.w();
|
|
this.world.methodProfiler.b();
|
|
+ // Spigot Start
|
|
+ if ( this.fromMobSpawner )
|
|
+ {
|
|
+ return;
|
|
+ }
|
|
+ // Spigot End
|
|
this.world.methodProfiler.a("sensing");
|
|
this.bq.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 e39d533..2276905 100644
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
@@ -136,6 +136,12 @@ public abstract class MobSpawnerAbstract {
|
|
SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d());
|
|
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
|
|
}
|
|
@@ -181,6 +187,12 @@ public abstract class MobSpawnerAbstract {
|
|
SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d());
|
|
if (!event.isCancelled()) {
|
|
this.a().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
|
|
index b8e144d..d7766bb 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 );
|
|
+ }
|
|
}
|
|
--
|
|
1.9.1
|
|
|