Advertisement
Guest User

Untitled

a guest
Jul 21st, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. public class BlockThaumicGen extends BlockContainer { // implements IWandable {
  2.  
  3. private String name = "thaumicgen";
  4. @SideOnly(Side.CLIENT)
  5. private IIcon side;
  6. @SideOnly(Side.CLIENT)
  7. private IIcon front;
  8.  
  9.  
  10.  
  11.  
  12.  
  13. @Override
  14. @SideOnly(Side.CLIENT)
  15. public void registerBlockIcons(IIconRegister reg) {
  16. this.blockIcon = reg.registerIcon(Knowledge.MODID+":"+ name + "_def");
  17. this.front = reg.registerIcon(Knowledge.MODID+":"+name+"_front");
  18. this.side = reg.registerIcon(Knowledge.MODID+":"+name+"_side");
  19.  
  20. }
  21.  
  22.  
  23. @Override
  24. @SideOnly(Side.CLIENT)
  25. public IIcon getIcon(int side, int meta) {
  26. ForgeDirection opp = ForgeDirection.getOrientation(meta).getOpposite();
  27. ForgeDirection s = ForgeDirection.getOrientation(side);
  28. if (side == 0 || side == 1 || s == opp) {
  29. return this.blockIcon;
  30. }
  31. else if (side == meta) {
  32. return this.front;
  33. }
  34.  
  35. else return this.side;
  36. }
  37.  
  38.  
  39.  
  40.  
  41. public BlockThaumicGen() {
  42.  
  43. super(Material.rock);
  44. this.setCreativeTab(Knowledge.tab).setBlockName(Knowledge.MODID+"_"+name);
  45. this.setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypeStone);
  46. this.setHarvestLevel("pickaxe", 0);
  47. this.setTickRandomly(true);
  48.  
  49. }
  50.  
  51. public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entity, ItemStack item)
  52. {
  53. int l = MathHelper.floor_double((double)(entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
  54.  
  55.  
  56. if (l == 0)
  57. {
  58. world.setBlockMetadataWithNotify(i, j, k, 2, 2);
  59. }
  60.  
  61. if (l == 1)
  62. {
  63. world.setBlockMetadataWithNotify(i, j, k, 5, 2);
  64. }
  65.  
  66. if (l == 2)
  67. {
  68. world.setBlockMetadataWithNotify(i, j, k, 3, 2);
  69. }
  70.  
  71. if (l == 3)
  72. {
  73. world.setBlockMetadataWithNotify(i, j, k, 4, 2);
  74. }
  75. }
  76.  
  77.  
  78.  
  79. public Item getItemDropped() {
  80. return Item.getItemFromBlock(this);
  81. }
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89. @Override
  90. public TileEntity createNewTileEntity(World world, int metadata) {
  91.  
  92. return new TileEntityThaumicGen();
  93. }
  94.  
  95.  
  96.  
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement