aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/plugin/villagers/tile
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-06-29 21:46:16 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-06-29 21:46:16 +1000
commitebac3516aada8378ca10b78acf0f942440934e6c (patch)
tree0f646b1945ab259ff42dd625ab03f4b1f14c6b89 /src/Java/gtPlusPlus/plugin/villagers/tile
parentcccd154da5181349169a06219254b31489925f22 (diff)
downloadGT5-Unofficial-ebac3516aada8378ca10b78acf0f942440934e6c.tar.gz
GT5-Unofficial-ebac3516aada8378ca10b78acf0f942440934e6c.tar.bz2
GT5-Unofficial-ebac3516aada8378ca10b78acf0f942440934e6c.zip
+ More Villager work.
+ Added framework for custom spawners.
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;
+ }
+ }
+
+
+}