Guest User

Untitled

a guest
Oct 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. public class BlockPiggyBank extends Block {
  4. public BlockPiggyBank(int i, int j) {
  5. super(i, j, Material.wood);
  6. }
  7. public void onEntityWalking(World world, int x, int y, int z, Entity entity){
  8. //entity.attackEntityFrom(null, 10000);
  9. }
  10. public int getBlockTextureFromSideAndMetadata(int i, int j)
  11. {
  12. return getBlockTextureFromSide(i);
  13. }
  14.  
  15. public int getBlockTextureFromSide(int i)
  16. {
  17. if (i == 0)
  18. {
  19. return mod_CoinMod.PiggyBankSide;
  20. }
  21. if (i == 1)
  22. {
  23. return mod_CoinMod.PiggyBankTop;
  24. }
  25. if (i == 3)
  26. {
  27. return mod_CoinMod.PiggyBankFace;
  28. }
  29. if (i == 2)
  30. {
  31. return mod_CoinMod.PiggyBankBack;
  32. }
  33. else
  34. {
  35. return mod_CoinMod.PiggyBankSide;
  36. }
  37. }
  38.  
  39. public void onBlockAdded(World par1World, int par2, int par3, int par4)
  40. {
  41. super.onBlockAdded(par1World, par2, par3, par4);
  42. setDefaultDirection(par1World, par2, par3, par4);
  43. }
  44. private void setDefaultDirection(World par1World, int par2, int par3, int par4)
  45. {
  46. if (par1World.isRemote)
  47. {
  48. return;
  49. }
  50.  
  51. int i = par1World.getBlockId(par2, par3, par4 - 1);
  52. int j = par1World.getBlockId(par2, par3, par4 + 1);
  53. int k = par1World.getBlockId(par2 - 1, par3, par4);
  54. int l = par1World.getBlockId(par2 + 1, par3, par4);
  55. byte byte0 = 3;
  56.  
  57. if (Block.opaqueCubeLookup[i] && !Block.opaqueCubeLookup[j])
  58. {
  59. byte0 = 3;
  60. }
  61.  
  62. if (Block.opaqueCubeLookup[j] && !Block.opaqueCubeLookup[i])
  63. {
  64. byte0 = 2;
  65. }
  66.  
  67. if (Block.opaqueCubeLookup[k] && !Block.opaqueCubeLookup[l])
  68. {
  69. byte0 = 5;
  70. }
  71.  
  72. if (Block.opaqueCubeLookup[l] && !Block.opaqueCubeLookup[k])
  73. {
  74. byte0 = 4;
  75. }
  76.  
  77. par1World.setBlockMetadataWithNotify(par2, par3, par4, byte0);
  78. }
  79. }
Add Comment
Please, Sign In to add comment