Advertisement
Mrolas

ShopStop.java

Dec 28th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.11 KB | None | 0 0
  1. package mrolas.muchMoney.common.block.machines;
  2.  
  3. import cpw.mods.fml.common.network.FMLNetworkHandler;
  4. import cpw.mods.fml.relauncher.Side;
  5. import cpw.mods.fml.relauncher.SideOnly;
  6. import mrolas.muchMoney.common.MuchMoney;
  7. import mrolas.muchMoney.common.lib.Reference;
  8. import mrolas.muchMoney.common.misc.Registry;
  9. import mrolas.muchMoney.common.tileEntities.TileEntityShopStop;
  10. import net.minecraft.block.BlockContainer;
  11. import net.minecraft.block.material.Material;
  12. import net.minecraft.client.renderer.texture.IconRegister;
  13. import net.minecraft.entity.player.EntityPlayer;
  14. import net.minecraft.tileentity.TileEntity;
  15. import net.minecraft.util.Icon;
  16. import net.minecraft.world.World;
  17.  
  18. public class ShopStop
  19.     extends BlockContainer
  20. {
  21.     @SideOnly(Side.CLIENT)
  22.     private Icon topIcon;  
  23.     @SideOnly(Side.CLIENT)
  24.     private Icon bottomIcon;   
  25.     @SideOnly(Side.CLIENT)
  26.     private Icon sideIcon;
  27.    
  28.     public ShopStop (int id)
  29.     {
  30.         super(id, Material.iron);
  31.        
  32.         setCreativeTab(Registry.muchMoneyBlockTab);
  33.         setHardness(3.5F);
  34.         setResistance(2000.0F);
  35.         setStepSound(soundMetalFootstep);
  36.         setUnlocalizedName(Reference.SHOP_ULNAME);
  37.     }
  38.    
  39.     @Override
  40.     @SideOnly(Side.CLIENT)
  41.     public void registerIcons (IconRegister register)
  42.     {
  43.         topIcon     = register.registerIcon(Reference.TEX_LOC + ":" + Reference.SHOP_ICON_TOP);
  44.         bottomIcon  = register.registerIcon(Reference.TEX_LOC + ":" + Reference.SHOP_ICON_BOTTOM);
  45.         sideIcon    = register.registerIcon(Reference.TEX_LOC + ":" + Reference.SHOP_ICON_SIDE);
  46.     }
  47.    
  48.     @Override
  49.     @SideOnly(Side.CLIENT)
  50.     public Icon getIcon (int side, int meta)
  51.     {
  52.         switch (side)
  53.         {
  54.             case 0:
  55.                 return bottomIcon;
  56.             case 1:
  57.                 return topIcon;
  58.             default:
  59.                 return sideIcon;
  60.         }
  61.     }
  62.    
  63.     @Override
  64.     public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
  65.     {
  66.         if (!world.isRemote)
  67.         {
  68.             FMLNetworkHandler.openGui(player, MuchMoney.instance, 3, world, x, y, z);
  69.         }
  70.        
  71.         return true;
  72.     }
  73.  
  74.     @Override
  75.     public TileEntity createNewTileEntity (World world)
  76.     {
  77.         return new TileEntityShopStop();
  78.     }
  79.  
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement