plaguewolf

oh god why

Jan 6th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. package com.plaguewolf.wolfeconomy.blocks.bank;
  2.  
  3. import com.plaguewolf.wolfeconomy.ModObjects;
  4. import com.plaguewolf.wolfeconomy.Strings;
  5.  
  6. import cpw.mods.fml.common.registry.GameRegistry;
  7. import cpw.mods.fml.relauncher.Side;
  8. import cpw.mods.fml.relauncher.SideOnly;
  9. import net.minecraft.block.Block;
  10. import net.minecraft.block.material.Material;
  11. import net.minecraft.client.renderer.texture.IIconRegister;
  12. import net.minecraft.entity.EntityLivingBase;
  13. import net.minecraft.item.ItemStack;
  14. import net.minecraft.util.IIcon;
  15. import net.minecraft.util.MathHelper;
  16. import net.minecraft.world.World;
  17.  
  18. public class ATMBlock extends Block {
  19.  
  20.  
  21. @SideOnly(Side.CLIENT)
  22. public static IIcon faces;
  23. @SideOnly(Side.CLIENT)
  24. public static IIcon front;
  25.  
  26. @SideOnly(Side.CLIENT)
  27. public static void registerIcons(IIconRegister iconRegister){
  28. faces = iconRegister.registerIcon(ModObjects.atmBlock.unlocalisedName + ":atmFaces");
  29. front = iconRegister.registerIcon(ModObjects.atmBlock.unlocalisedName + ":atmFront");
  30. }
  31.  
  32.  
  33. protected void init() {
  34. GameRegistry.registerBlock(this, ModObjects.atmBlock.unlocalisedName);
  35. }
  36.  
  37. static ATMBlock atmBlock = new ATMBlock();
  38.  
  39. public static ATMBlock create() {
  40.  
  41. ATMBlock result = new ATMBlock();
  42. result.init();
  43. return result;
  44. }
  45.  
  46. protected ATMBlock() {
  47. super();
  48. setHardness(5.0F);
  49. setStepSound(soundTypeAnvil);
  50. setResistance(2000.0F);
  51.  
  52. this.setBlockName(ModObjects.atmBlock.unlocalisedName);
  53. this.setBlockTextureName(Strings.MODID + ":" + ModObjects.atmBlock.unlocalisedName);
  54.  
  55. }
  56.  
  57.  
  58. @Override
  59. @SideOnly(Side.CLIENT)
  60. public IIcon getIcon(int side, int metadata){
  61. if (side == 1) return faces;
  62. else if (side == 0) return faces;
  63. else if (metadata == 2 && side == 2) return front;
  64. else if (metadata == 3 && side == 5) return faces;
  65. else if (metadata == 0 && side == 3) return faces;
  66. else if (metadata == 1 && side == 4) return faces;
  67. else return this.blockIcon;
  68. }
  69.  
  70.  
  71. public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLivingBase, ItemStack stack)
  72. {
  73. int whichDirectionFacing = MathHelper.floor_double((double)(entityLivingBase.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
  74. world.setBlockMetadataWithNotify(x, y, z, whichDirectionFacing, 2);
  75.  
  76. System.out.println("faces is: " + faces);
  77. System.out.println("front is: " + front);
  78.  
  79. System.out.println("icon is: " + ModObjects.atmBlock.unlocalisedName + ":atmFaces");
  80.  
  81. System.out.println("metadata for block: " + world.getBlockMetadata(x, y, z));
  82.  
  83.  
  84. }
  85.  
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment