001 /** 002 * MobSpawner.java - Wrapper for mob spawners. 003 * @author James 004 */ 005 public class MobSpawner implements ComplexBlock { 006 007 db spawner; 008 009 /** 010 * Creates an interface for the spawner. 011 * @param spawner 012 */ 013 public MobSpawner(db spawner) { 014 this.spawner = spawner; 015 } 016 017 public int getX() { 018 return spawner.b; 019 } 020 021 public int getY() { 022 return spawner.c; 023 } 024 025 public int getZ() { 026 return spawner.d; 027 } 028 029 public Block getBlock() { 030 return etc.getServer().getBlockAt(getX(), getY(), getZ()); 031 } 032 033 public void update() { 034 spawner.d(); 035 } 036 037 /** 038 * Allows what to spawn to change on-the-fly 039 * @param spawn 040 */ 041 public void setSpawn(String spawn) { 042 spawner.a(spawn); 043 } 044 045 /** 046 * Returns the spawn used. 047 * This DOESN't work anymore. 048 * @return 049 */ 050 @Deprecated 051 public String getSpawn() { 052 return ""; 053 } 054 055 /** 056 * Allows delay of what to spawn to change on-the-fly 057 * Modification of this is near-useless as delays get randomized after spawn. 058 * See: Block.setSpawnData() if you want to adjust this value. 059 * @param delay 060 */ 061 public void setDelay(int delay) { 062 spawner.e = delay; 063 } 064 }