Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. package com.pam.harvestcraft;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Random;
  5.  
  6. import cpw.mods.fml.relauncher.Side;
  7. import cpw.mods.fml.relauncher.SideOnly;
  8. import net.minecraft.block.Block;
  9. import net.minecraft.block.material.Material;
  10. import net.minecraft.client.renderer.texture.IIconRegister;
  11. import net.minecraft.entity.player.EntityPlayer;
  12. import net.minecraft.item.Item;
  13. import net.minecraft.item.ItemStack;
  14. import net.minecraft.tileentity.TileEntity;
  15. import net.minecraft.util.IIcon;
  16. import net.minecraft.world.IBlockAccess;
  17. import net.minecraft.world.World;
  18. import net.minecraftforge.common.IShearable;
  19.  
  20. public class BlockPamMarket extends Block {
  21.  
  22. private IIcon top;
  23. private IIcon middle;
  24. private IIcon bottom;
  25.  
  26. public BlockPamMarket(Material par2Material) {
  27. super(par2Material);
  28. this.setStepSound(Block.soundTypeWood);
  29. this.setCreativeTab(harvestcraft.tabHarvestCraft);
  30. }
  31.  
  32. public TileEntity createNewTileEntity(World world)
  33. {
  34. return new TileEntityMarket();
  35. }
  36.  
  37. public boolean onBlockActivated(World world, int x, int y, int z,
  38. EntityPlayer player, int side, float xCoord, float yCoord,
  39. float zCoord)
  40. {
  41. final TileEntity tile = world.getTileEntity(x, y, z);
  42.  
  43. if (tile == null || player.isSneaking())
  44. {
  45. return false;
  46. }
  47.  
  48. player.openGui(harvestcraft.instance, 4, world, x, y, z);
  49.  
  50. return true;
  51. }
  52.  
  53. @Override
  54. @SideOnly(Side.CLIENT)
  55. public void registerBlockIcons(IIconRegister par1IconRegister)
  56. {
  57. this.middle = par1IconRegister.registerIcon("harvestcraft:marketside");
  58. this.top = par1IconRegister.registerIcon("harvestcraft:markettop");
  59. this.bottom = par1IconRegister.registerIcon("harvestcraft:marketbottom");
  60. }
  61.  
  62. @SideOnly(Side.CLIENT)
  63.  
  64. /**
  65. * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
  66. */
  67. public IIcon getIcon(int par1, int par2)
  68. {
  69. switch(par1) {
  70.  
  71. case 0:
  72. return this.bottom;
  73. case 1:
  74. return this.top;
  75. default:
  76. return this.middle;
  77. }
  78. }
  79.  
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement