-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpawnListener.java
28 lines (25 loc) · 954 Bytes
/
SpawnListener.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package freeradicalx.zombies;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
//Listens for spawn events, useful for silencing vanilla mob spawns
public class SpawnListener {
//Cancels vanilla mobs
@ForgeSubscribe
public void onEntitySpawn(EntityJoinWorldEvent event)
{
if(event.entity instanceof EntitySkeleton ||
event.entity instanceof EntityZombie ||
event.entity instanceof EntitySpider ||
event.entity instanceof EntityCreeper ||
event.entity instanceof EntityEnderman ||
event.entity instanceof EntitySlime) {
event.setCanceled(true);
}
}
}