diff options
| author | Martin Robertz <dream-master@gmx.net> | 2021-12-15 16:11:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-15 16:11:54 +0100 |
| commit | 128c74faa99dfef8d056c1d82c6e4388b9d470e8 (patch) | |
| tree | 2c84162154ba681232f86dffd4106db530236814 /src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java | |
| parent | 47ce336f288a45aa3244c8ae1177499fa5080942 (diff) | |
| parent | ff4b8c7068c2ea7d654e9beda00646d23e62b314 (diff) | |
| download | GT5-Unofficial-128c74faa99dfef8d056c1d82c6e4388b9d470e8.tar.gz GT5-Unofficial-128c74faa99dfef8d056c1d82c6e4388b9d470e8.tar.bz2 GT5-Unofficial-128c74faa99dfef8d056c1d82c6e4388b9d470e8.zip | |
Merge pull request #65 from GTNewHorizons/unified-build-script2
Move sources and resources
Diffstat (limited to 'src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java')
| -rw-r--r-- | src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java b/src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java new file mode 100644 index 0000000000..28416793f5 --- /dev/null +++ b/src/main/java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java @@ -0,0 +1,69 @@ +package gtPlusPlus.plugin.villagers.tile; + +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; +import gtPlusPlus.core.block.ModBlocks; +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.MobSpawnerBaseLogic; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class MobSpawnerCustomLogic extends MobSpawnerBaseLogic { + + private TileEntityGenericSpawner mTile; + + public MobSpawnerCustomLogic(TileEntityGenericSpawner tile) { + if (tile != null) { + mTile = tile; + } + + if (TileEntityGenericSpawner.mSpawners.get(mTile.getID()) != null) { + Class<Entity> c = TileEntityGenericSpawner.mSpawners.get(mTile.getID()); + EntityRegistration x = EntityRegistry.instance().lookupModSpawn(c, false); + if (x != null) { + this.setEntityName(x.getEntityName()); + } + } + + } + + @Override + public void func_98267_a(int eventID) { + if (mTile != null) mTile.getWorldObj().addBlockEvent(mTile.xCoord, mTile.yCoord, mTile.zCoord, ModBlocks.blockCustomMobSpawner, eventID, 0); + } + + @Override + public World getSpawnerWorld() { + if (mTile != null) return mTile.getWorldObj(); + return null; + } + + @Override + public int getSpawnerX() { + if (mTile != null) return mTile.xCoord; + return 0; + } + + @Override + public int getSpawnerY() { + if (mTile != null) return mTile.yCoord; + return 0; + } + + @Override + public int getSpawnerZ() { + if (mTile != null) return mTile.zCoord; + return 0; + } + + @Override + public void setRandomEntity(MobSpawnerBaseLogic.WeightedRandomMinecart p_98277_1_) { + super.setRandomEntity(p_98277_1_); + if (mTile != null) { + if (this.getSpawnerWorld() != null) { + this.getSpawnerWorld().markBlockForUpdate(mTile.xCoord, mTile.yCoord, mTile.zCoord); + } + } + } + +} |
