aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/plugin/villagers/tile
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/plugin/villagers/tile')
-rw-r--r--src/Java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java48
-rw-r--r--src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java75
2 files changed, 123 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java b/src/Java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java
new file mode 100644
index 0000000000..131c97bf23
--- /dev/null
+++ b/src/Java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java
@@ -0,0 +1,48 @@
+package gtPlusPlus.plugin.villagers.tile;
+
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.MobSpawnerBaseLogic;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+
+public class MobSpawnerCustomLogic extends MobSpawnerBaseLogic {
+
+ private final TileEntity mTile;
+
+ public MobSpawnerCustomLogic(TileEntity tile) {
+ mTile = tile;
+ }
+
+
+ @Override
+ public void func_98267_a(int p_98267_1_){
+ mTile.getWorldObj().addBlockEvent(
+ mTile.xCoord,
+ mTile.yCoord,
+ mTile.zCoord,
+ Blocks.mob_spawner,
+ p_98267_1_,
+ 0);
+ }
+
+ @Override
+ public World getSpawnerWorld() {
+ return mTile.getWorldObj();
+ }
+
+ @Override
+ public int getSpawnerX() {
+ return mTile.xCoord;
+ }
+
+ @Override
+ public int getSpawnerY() {
+ return mTile.yCoord;
+ }
+
+ @Override
+ public int getSpawnerZ() {
+ return mTile.zCoord;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java b/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java
new file mode 100644
index 0000000000..ea05525166
--- /dev/null
+++ b/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java
@@ -0,0 +1,75 @@
+package gtPlusPlus.plugin.villagers.tile;
+
+import java.util.HashMap;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.tileentity.TileEntityMobSpawner;
+
+public class TileEntityGenericSpawner extends TileEntityMobSpawner {
+
+ /*
+ * Static Variables
+ */
+
+ /**
+ * The Mob Spawner Map
+ */
+ public static HashMap<Integer, Entity> mSpawners = new HashMap<Integer, Entity>();
+
+ /**
+ * Registers a New Mob Spawner Type
+ * @param aID - the Spawner type ID
+ * @param aEntity - the Entity which you'd like to spawn
+ */
+ public static boolean registerNewMobSpawner(int aID, Entity aEntity) {
+ int registered = mSpawners.size();
+ mSpawners.put(aID, aEntity);
+ return mSpawners.size() > registered;
+ }
+
+ /*
+ * Instance Variables
+ */
+
+ /**
+ * The {@link Entity} type which spawns.
+ */
+ private final Entity mSpawnType;
+
+
+
+ /*
+ * Constructors
+ */
+
+ /**
+ * Constructs a new Spawner, based on an existing type registered.
+ * @param aID - The ID in the {@link mSpawners} map.
+ */
+ public TileEntityGenericSpawner(int aID) {
+ if (mSpawners.get(aID) != null) {
+ mSpawnType = mSpawners.get(aID);
+ }
+ else {
+ mSpawnType = null;
+ }
+ }
+
+
+ /**
+ * Constructs a new Spawner, then registers it.
+ * @param aID - The ID to be used in the {@link mSpawners} map.
+ * @param aEntity - The {@link Entity} type which will be spawned.
+ */
+ public TileEntityGenericSpawner(int aID, Entity aEntity) {
+ if (aEntity != null) {
+ mSpawnType = aEntity;
+ this.registerNewMobSpawner(aID, aEntity);
+ }
+ else {
+ mSpawnType = null;
+ }
+ }
+
+
+}