mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-24 22:14:44 +00:00
Start to work on ceramic blocks
This commit is contained in:
1 parent
4b6e3e5424
commit
9e68539431
28 files changed
+1009
-661
No files matched your search
@@ -0,0 +1,65 @@
|
||||
package binnie.botany.ceramic.brick;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CeramicBrickPair {
|
||||
EnumFlowerColor colorFirst;
|
||||
EnumFlowerColor colorSecond;
|
||||
CeramicBrickType type;
|
||||
int ordinal;
|
||||
|
||||
CeramicBrickPair(final EnumFlowerColor colorFirst, final EnumFlowerColor colorSecond, CeramicBrickType type) {
|
||||
this.colorFirst = colorFirst;
|
||||
this.colorSecond = colorSecond;
|
||||
this.type = type;
|
||||
this.ordinal = colorFirst.ordinal() + colorSecond.ordinal() * 256 + type.ordinal() * 256 * 256;
|
||||
}
|
||||
|
||||
public boolean isTwoColors() {
|
||||
return this.type.canDouble() && this.colorSecond != this.colorFirst;
|
||||
}
|
||||
|
||||
public CeramicBrickPair(ItemStack stack) {
|
||||
this(TileEntityMetadata.getItemDamage(stack));
|
||||
}
|
||||
|
||||
public ItemStack getStack(int i) {
|
||||
ItemStack s = new ItemStack(Botany.ceramicBrick, i, this.ordinal());
|
||||
return s;
|
||||
}
|
||||
|
||||
public CeramicBrickPair(int id) {
|
||||
this.colorFirst = EnumFlowerColor.get(id & 0xFF);
|
||||
this.colorSecond = EnumFlowerColor.get(id >> 8 & 0xFF);
|
||||
this.type = CeramicBrickType.get(id >> 16 & 0xFF);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String name = this.colorFirst.getColourName();
|
||||
if (this.type.canDouble() && this.colorSecond != this.colorFirst) {
|
||||
name = name + " & " + this.colorSecond.getColourName();
|
||||
}
|
||||
return name + " " + this.type.name;
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getSprite(int pass) {
|
||||
return this.type.sprites[pass];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof CeramicBrickPair)){
|
||||
return false;
|
||||
}
|
||||
return ((CeramicBrickPair)obj).ordinal() == ordinal();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user