blob: 28416793f51e08b11761a1d55541324320eb926d (
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
58
59
60
61
62
63
64
65
66
67
68
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);
}
}
}
}
|