001package net.minecraftforge.event.world; 002 003import java.util.ArrayList; 004import java.util.List; 005 006import net.minecraft.entity.EnumCreatureType; 007import net.minecraft.world.World; 008import net.minecraft.world.biome.SpawnListEntry; 009import net.minecraftforge.event.Cancelable; 010import net.minecraftforge.event.Event; 011 012public class WorldEvent extends Event 013{ 014 public final World world; 015 016 public WorldEvent(World world) 017 { 018 this.world = world; 019 } 020 021 public static class Load extends WorldEvent 022 { 023 public Load(World world) { super(world); } 024 } 025 026 public static class Unload extends WorldEvent 027 { 028 public Unload(World world) { super(world); } 029 } 030 031 public static class Save extends WorldEvent 032 { 033 public Save(World world) { super(world); } 034 } 035 036 /** 037 * Called by WorldServer to gather a list of all possible entities that can spawn at the specified location. 038 * Canceling the event will result in a empty list, meaning no entity will be spawned. 039 */ 040 @Cancelable 041 public static class PotentialSpawns extends WorldEvent 042 { 043 public final EnumCreatureType type; 044 public final int x; 045 public final int y; 046 public final int z; 047 public final List<SpawnListEntry> list; 048 049 public PotentialSpawns(World world, EnumCreatureType type, int x, int y, int z, List oldList) 050 { 051 super(world); 052 this.x = x; 053 this.y = y; 054 this.z = z; 055 this.type = type; 056 if (oldList != null) 057 { 058 this.list = (List<SpawnListEntry>)oldList; 059 } 060 else 061 { 062 this.list = new ArrayList<SpawnListEntry>(); 063 } 064 } 065 } 066}