Skip to content

Instantly share code, notes, and snippets.

@KryptonCaptain
Last active December 3, 2017 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KryptonCaptain/a709b40e46e7bdfc457793b630936d98 to your computer and use it in GitHub Desktop.
Save KryptonCaptain/a709b40e46e7bdfc457793b630936d98 to your computer and use it in GitHub Desktop.
tc block cosmetic stone V
public class BlockCosmeticStoneV extends Block {
public BlockCosmeticStoneV() { //standard block shit
super(Material.rock);
setResistance(10.0F);
setHardness(2.0F);
setStepSound(soundTypeStone);
setCreativeTab(ThaumicNexus.tabTN);
}
public IIcon[] icon = new IIcon[17];
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister ir) { //icon reg
this.icon[0] = ir.registerIcon("thaumicnexus:tc5/arcane_brick_stone");
this.icon[1] = ir.registerIcon("thaumicnexus:tc5/arcane_stone_1");
this.icon[2] = ir.registerIcon("thaumicnexus:tc5/arcane_stone_2");
this.icon[3] = ir.registerIcon("thaumicnexus:tc5/arcane_stone_3");
this.icon[4] = ir.registerIcon("thaumicnexus:tc5/ancient_tile");
this.icon[5] = ir.registerIcon("thaumicnexus:tc5/ancient_stone_1");
this.icon[6] = ir.registerIcon("thaumicnexus:tc5/ancient_stone_2");
this.icon[7] = ir.registerIcon("thaumicnexus:tc5/ancient_stone_3");
this.icon[8] = ir.registerIcon("thaumicnexus:tc5/ancient_stone_4");
this.icon[9] = ir.registerIcon("thaumicnexus:tc5/ancient_stone_5");
this.icon[10] = ir.registerIcon("thaumicnexus:tc5/ancient_rock_stone_1");
this.icon[11] = ir.registerIcon("thaumicnexus:tc5/ancient_rock_stone_2");
this.icon[12] = ir.registerIcon("thaumicnexus:tc5/ancient_rock_stone_3");
this.icon[13] = ir.registerIcon("thaumicnexus:tc5/ancient_rock_stone_4");
this.icon[14] = ir.registerIcon("thaumicnexus:tc5/eldritch_stone_3");
this.icon[15] = ir.registerIcon("thaumicnexus:tc5/eldritch_stone_1");
this.icon[16] = ir.registerIcon("thaumicnexus:tc5/eldritch_stone_2");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) { //standard icons for blocks in NEI/creative tab
if (meta == 0) {
return this.icon[0];
}
if (meta == 1) {
return this.icon[1];
}
if (meta == 2) {
return this.icon[4];
}
if (meta == 3) {
return this.icon[5];
}
if (meta == 4) {
return this.icon[10];
}
if (meta == 5) {
return this.icon[14];
}
return super.getIcon(side, meta);
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess ba, int x, int y, int z, int side) { //icons for blocks when they're in the world
int md = ba.getBlockMetadata(x, y, z);
if ((md == 1) || (side >= 100))
{
String l = x + "" + y + "" + z;
Random r1 = new Random(Math.abs(l.hashCode() * 100) + 1);
int i = r1.nextInt(12345 + side) % 3; //the "% 3" indicates 3 texture variants to swap between
return this.icon[(1 + i)];
}
if ((md == 3) || (side >= 100))
{
String l = x + "" + y + "" + z;
Random r1 = new Random(Math.abs(l.hashCode() * 100) + 1);
int i = r1.nextInt(12345 + side) % 6;
return this.icon[(4 + i)];
}
if ((md == 4) || (side >= 100))
{
String l = x + "" + y + "" + z;
Random r1 = new Random(Math.abs(l.hashCode() * 100) + 1);
int i = r1.nextInt(12345 + side) % 4;
return this.icon[(10 + i)];
}
if ((md == 5) || (side >= 100))
{
String l = x + "" + y + "" + z;
Random r1 = new Random(Math.abs(l.hashCode() * 100) + 1);
int i = r1.nextInt(12345 + side) % 3;
return this.icon[(14 + i)];
}
return super.getIcon(ba, x, y, z, side);
}
public void setBlockBoundsBasedOnState(IBlockAccess world, int i, int j, int k) {
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
public void setBlockBoundsForItemRender() {
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { //sub-blocks for efficiency, need a BlockItem/ItemBlock? class to go with it
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
par3List.add(new ItemStack(par1, 1, 2));
par3List.add(new ItemStack(par1, 1, 3));
par3List.add(new ItemStack(par1, 1, 4));
par3List.add(new ItemStack(par1, 1, 5));
}
public int quantityDropped(Random par1Random) {
return 1;
}
public int damageDropped(int par1) {
return /*par1 == 1 ? 1 : par1 == 2 ? 1 : par1 == 3 ? 1 :*/ par1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment