001package net.minecraft.block; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import net.minecraft.client.renderer.texture.IconRegister; 006import net.minecraft.util.Icon; 007import net.minecraft.world.World; 008 009public class BlockRail extends BlockRailBase 010{ 011 @SideOnly(Side.CLIENT) 012 private Icon theIcon; 013 014 protected BlockRail(int par1) 015 { 016 super(par1, false); 017 } 018 019 @SideOnly(Side.CLIENT) 020 021 /** 022 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata 023 */ 024 public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) 025 { 026 return par2 >= 6 ? this.theIcon : this.blockIcon; 027 } 028 029 @SideOnly(Side.CLIENT) 030 031 /** 032 * When this method is called, your block should register all the icons it needs with the given IconRegister. This 033 * is the only chance you get to register icons. 034 */ 035 public void registerIcons(IconRegister par1IconRegister) 036 { 037 super.registerIcons(par1IconRegister); 038 this.theIcon = par1IconRegister.registerIcon("rail_turn"); 039 } 040 041 protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, int par7) 042 { 043 if (par7 > 0 && Block.blocksList[par7].canProvidePower() && (new BlockBaseRailLogic(this, par1World, par2, par3, par4)).func_94505_a() == 3) 044 { 045 this.refreshTrackShape(par1World, par2, par3, par4, false); 046 } 047 } 048}