Advertisement
Guest User

New Block Class

a guest
Jan 25th, 2014
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.55 KB | None | 0 0
  1. public class BlockEleventhTardis extends BlockContainer
  2. {
  3.    
  4.     public BlockEleventhTardis(int i, Material m)
  5.     {
  6.         super(i, m);
  7.        
  8.         setHardness(3.5F);
  9.         setStepSound(Block.soundStoneFootstep);
  10.         setCreativeTab(DoctorWhoAdventure.tabDoctorWho);
  11.         setResistance(1000.0F);
  12.         setResistance(1000.0F);
  13.         setHardness(1.5F);
  14.         setLightOpacity(0);
  15.         setLightValue(0.0f);
  16.         setTickRandomly(false);
  17.         setUnlocalizedName("dwadventure:EleventhTardis");
  18.        
  19.      // Harvest level for this block. par2 can be pickaxe, axe, or shovel, or
  20.         // a different toolclass. par3 is the minimum level of item required to
  21.         // break it:
  22.         // 0=bare hands, 1=wood, 2=stone, 3=iron, 4=diamond
  23.         //ItemSonicScrewdriver.setBlockHarvestLevel(this, "sonic", 0);
  24.     }
  25.    
  26.     @SideOnly(Side.CLIENT)
  27.     public void registerIcons(IconRegister par1IconRegister)
  28.  
  29.         {
  30.             blockIcon = par1IconRegister.registerIcon("dwadventures:EleventhTARDIS");
  31.         }  
  32.  
  33.     /**
  34.      * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
  35.      * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
  36.      */
  37.    
  38.     @Override
  39.     public boolean isOpaqueCube()
  40.     {
  41.         return false;
  42.     }
  43.  
  44.     /**
  45.      * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
  46.      */
  47.  
  48.     public boolean renderAsNormalBlock()
  49.     {
  50.         return false;
  51.     }
  52.        
  53.     /**
  54.      * Returns Returns true if the given side of this block type should be
  55.      * rendered (if it's solid or not), if the adjacent block is at the given
  56.      * coordinates. Args: blockAccess, x, y, z, side
  57.      */
  58.     @Override
  59.     public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
  60.             return true;
  61.     }
  62.    
  63.     /**
  64.      * This method is called on a block after all other blocks gets already
  65.      * created. You can use it to reference and configure something on the block
  66.      * that needs the others ones.
  67.      */
  68.     @Override
  69.     protected void initializeBlock() {
  70.     }
  71.    
  72.     /**
  73.      * Called throughout the code as a replacement for block instanceof
  74.      * BlockContainer Moving this to the Block base class allows for mods that
  75.      * wish
  76.      * to extend vinella blocks, and also want to have a tile entity on that
  77.      * block, may.
  78.      *
  79.      * Return true from this function to specify this block has a tile entity.
  80.      *
  81.      * @param metadata
  82.      *            Metadata of the current block
  83.      * @return True if block has a tile entity, false otherwise
  84.      */
  85.     @Override
  86.     public boolean hasTileEntity(int metadata) {
  87.             return true;
  88.     }
  89.    
  90.     /**
  91.      * Called throughout the code as a replacement for
  92.      * BlockContainer.getBlockEntity Return the same thing you would from that
  93.      * function. This will
  94.      * fall back to BlockContainer.getBlockEntity if this block is a
  95.      * BlockContainer.
  96.      *
  97.      * @param metadata
  98.      *            The Metadata of the current block
  99.      * @return A instance of a class extending TileEntity
  100.      */
  101.     @Override
  102.     public TileEntity createTileEntity(World world, int metadata) {
  103.             return new TileEntityTardis();
  104.     }
  105.  
  106.     @Override
  107.     public TileEntity createNewTileEntity(World world) {
  108.         // TODO Auto-generated method stub
  109.         return new TileEntityTardis();
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement