aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/plugin/villagers/tile/MobSpawnerCustomLogic.java
blob: c7ffd6ee8c5555509202021015ed34ee7e5b87f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 TileEntity mTile;

	public MobSpawnerCustomLogic(TileEntity tile) {
		if (tile != null) {
			mTile = tile;
		}
	}

	@Override
	public void func_98267_a(int eventID) {
		if (mTile != null) mTile.getWorldObj().addBlockEvent(mTile.xCoord, mTile.yCoord, mTile.zCoord, Blocks.mob_spawner, 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);
			}
		}
	}

}