Guest User

Block

a guest
Jun 6th, 2015
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.28 KB | None | 0 0
  1. package net.roadcraft.mod.blocks;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5. import net.minecraft.block.BlockContainer;
  6. import net.minecraft.block.material.Material;
  7. import net.minecraft.client.renderer.texture.IIconRegister;
  8. import net.minecraft.entity.EntityLivingBase;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.tileentity.TileEntity;
  11. import net.minecraft.util.MathHelper;
  12. import net.minecraft.world.IBlockAccess;
  13. import net.minecraft.world.World;
  14. import net.roadcraft.mod.Roadcraft;
  15. import net.roadcraft.mod.tileentity.TileEntityRoadSignPostBase;
  16.  
  17. public class RoadSignPostBase extends BlockContainer {
  18.  
  19.     public RoadSignPostBase(Material material) {
  20.         super(material);
  21.        
  22.         this.setCreativeTab(Roadcraft.roadcraftTab);
  23.                
  24.     }
  25.    
  26.     public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) {
  27.        return false;
  28.        
  29.     }
  30.    
  31.    
  32.     public int getRenderType() {
  33.         return -1;
  34.        
  35.     }
  36.    
  37.    
  38.     public boolean isOpaqueCube() {
  39.         return false;
  40.        
  41.     }
  42.    
  43.    
  44.     public boolean rederAsNormalBlock() {
  45.         return false;
  46.        
  47.     }
  48.    
  49.     public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
  50.        
  51.         int dir = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
  52.        
  53.         if (dir == 0) {
  54.            
  55.             par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2);
  56.            
  57.         }
  58.        
  59.         if (dir == 1) {
  60.            
  61.             par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2);
  62.            
  63.            
  64.         }
  65.        
  66.         if (dir == 2) {
  67.            
  68.             par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2);
  69.            
  70.         }
  71.        
  72.         if (dir == 3) {
  73.            
  74.             par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2);
  75.            
  76.         }
  77.        
  78.     }
  79.    
  80.  
  81.     @Override
  82.     public TileEntity createNewTileEntity(World var1, int var2) {
  83.         return new TileEntityRoadSignPostBase();
  84.        
  85.     }
  86.    
  87.    
  88.     @SideOnly(Side.CLIENT)
  89.     public void registerBlockIcons(IIconRegister iconRegister) {
  90.         this.blockIcon = iconRegister.registerIcon(Roadcraft.MODID + ":" + this.getUnlocalizedName().substring(5));
  91.     }
  92.    
  93.    
  94.  
  95. }
Advertisement
Add Comment
Please, Sign In to add comment