Guest User

Custom Table Block Class

a guest
Dec 15th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. package net.stolenchristmas.mods.blocks;
  2.  
  3. import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
  4. import net.minecraft.block.BlockContainer;
  5. import net.minecraft.block.material.Material;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.tileentity.TileEntity;
  8. import net.minecraft.world.World;
  9. import net.stolenchristmas.mods.stolenchristmas;
  10. import net.stolenchristmas.mods.tileentity.TileEntityXmasTable;
  11.  
  12. public class XmasTable extends BlockContainer{
  13.  
  14. public XmasTable(Material material) {
  15.         super(material);
  16.         this.setHardness(2.0F);
  17.         this.setResistance(10.0F);
  18.        
  19.         this.setCreativeTab(stolenchristmas.xmasTab);
  20.     }
  21.  
  22.     public int getRenderType(){
  23.         return -1;
  24.     }
  25.    
  26.     public boolean isOpaqueCube(){
  27.         return false;
  28.     }
  29.  
  30.     public boolean renderAsNormalBlock(){
  31.         return false;
  32.     }
  33.    
  34.     @Override
  35.     public TileEntity createNewTileEntity(World var1, int var2) {
  36.         return new TileEntityXmasTable();
  37.     }
  38.  
  39.    
  40.     @Override
  41.     public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
  42.        
  43.         if (!player.isSneaking()) {
  44.             player.openGui(stolenchristmas.instance, stolenchristmas.guiIDWorkSurface, world, x, y, z);
  45.             return true;
  46.         }else{
  47.             return false;
  48.         }
  49.     }}
Advertisement
Add Comment
Please, Sign In to add comment