blob: d5f6feb1ca7d7c20d8f1b2b1a3de3c310292968f (
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
70
71
|
package bloodasp.galacticgreg.api;
import net.minecraft.block.Block;
import bloodasp.galacticgreg.api.Enums.AllowedBlockPosition;
public class SpecialBlockComb extends BlockMetaComb {
private AllowedBlockPosition _mBlockPosition;
/**
* Creates a simple instance for a block that has a meta value and a block position it is allowed to spawn
*
* @param pBlock The Block in question
* @param pMeta The meta value of the block
* @param pBlockPosition The position this block is allowed to generate
*/
public SpecialBlockComb(Block pBlock, int pMeta, AllowedBlockPosition pBlockPosition) {
super(pBlock, pMeta);
_mBlockPosition = pBlockPosition;
}
/**
* Creates a simple instance for a block that has no meta value but a position it is allowed to spawn
*
* @param pBlock The Block in question. 0 is used as meta
* @param pBlockPosition The position this block is allowed to generate
*/
public SpecialBlockComb(Block pBlock, AllowedBlockPosition pBlockPosition) {
super(pBlock, 0);
_mBlockPosition = pBlockPosition;
}
/**
* Creates a simple instance for a block that has no meta value and is allowed to spawn everywhere
*
* @param pBlock The Block in question. 0 is used as meta, and "CoreAndShell" is used as position
*/
public SpecialBlockComb(Block pBlock) {
super(pBlock, 0);
_mBlockPosition = AllowedBlockPosition.AsteroidCoreAndShell;
}
/**
* Internal function
*
* @return The position the block is supposed to spawn at
*/
public AllowedBlockPosition getBlockPosition() {
return _mBlockPosition;
}
@Override
public boolean equals(Object other) {
if (other == null) return false;
if (other == this) return true;
if (!(other instanceof SpecialBlockComb)) return false;
SpecialBlockComb otherObj = (SpecialBlockComb) other;
boolean tFlag = true;
String otherName = Block.blockRegistry.getNameForObject(otherObj.getBlock());
String thisName = Block.blockRegistry.getNameForObject(this.getBlock());
if (!otherName.equals(thisName)) tFlag = false;
if (!(otherObj.getMeta() == this.getMeta())) tFlag = false;
if (!(otherObj.getBlockPosition() == this.getBlockPosition())) tFlag = false;
return tFlag;
}
}
|