Advertisement
hedgehog1029

TileEntityMarioPipeBlock.java

Jul 25th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.78 KB | None | 0 0
  1. package io.github.hedgehog1029.mariopipe;
  2.  
  3. import net.minecraft.block.BlockContainer;
  4. import net.minecraft.block.material.Material;
  5. import net.minecraft.client.renderer.texture.IIconRegister;
  6. import net.minecraft.creativetab.CreativeTabs;
  7. import net.minecraft.tileentity.TileEntity;
  8. import net.minecraft.world.World;
  9. import net.minecraftforge.client.IItemRenderer;
  10. import net.minecraftforge.client.IItemRenderer.ItemRenderType;
  11.  
  12. public class TileEntityMarioPipeBlock extends BlockContainer {
  13.     //Treat it like a normal block here. The Block Bounds are a good idea - the first three are X Y and Z of the botton-left corner,
  14.     //And the second three are the top-right corner.
  15.     public TileEntityMarioPipeBlock() {
  16.             super(Material.iron);
  17.             this.setCreativeTab(CreativeTabs.tabTransport);
  18.             this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.1F, 1.0F);
  19.             this.setBlockName("mariopipe:marioPipe");
  20.     }
  21.  
  22.     //Make sure you set this as your TileEntity class relevant for the block!
  23.     @Override
  24.     public TileEntity createNewTileEntity(World world, int var2) {
  25.             return new TileEntityMarioPipe();
  26.     }
  27.    
  28.     //You don't want the normal render type, or it wont render properly.
  29.     @Override
  30.     public int getRenderType() {
  31.             return -1;
  32.     }
  33.    
  34.     //It's not an opaque cube, so you need this.
  35.     @Override
  36.     public boolean isOpaqueCube() {
  37.             return false;
  38.     }
  39.    
  40.     //It's not a normal block, so you need this too.
  41.     public boolean renderAsNormalBlock() {
  42.             return false;
  43.     }
  44.    
  45.     //This is the icon to use for showing the block in your hand.
  46.     public void registerIcons(IIconRegister icon) {
  47.             this.blockIcon = icon.registerIcon("mariopipe:MarioPipeIcon");
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement