Advertisement
Guest User

Untitled

a guest
Jul 12th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. package com.geomancy.common.item;
  2.  
  3. import com.geomancy.common.util.GeomancyCreativeTab;
  4. import com.geomancy.common.util.reference.ReferenceMisc;
  5. import cpw.mods.fml.relauncher.Side;
  6. import cpw.mods.fml.relauncher.SideOnly;
  7. import net.minecraft.client.renderer.texture.IIconRegister;
  8. import net.minecraft.creativetab.CreativeTabs;
  9. import net.minecraft.item.Item;
  10. import net.minecraft.item.ItemStack;
  11. import net.minecraft.util.IIcon;
  12.  
  13. import java.util.List;
  14.  
  15. public class BaseParasiteItem extends Item {
  16.  
  17. public int index;
  18. public int color;
  19. public String name;
  20. @SideOnly(Side.CLIENT)
  21. private IIcon[] baseIcons;
  22. private IIcon[] primaryColorIcons;
  23. private IIcon[] secondaryColorIcons;
  24.  
  25. public BaseParasiteItem(String name, int index) {
  26.  
  27. this.setHasSubtypes(true);
  28. this.setUnlocalizedName(name);
  29. this.setCreativeTab(GeomancyCreativeTab.tabGeomancy);
  30. this.index = index - 1;
  31. baseIcons = new IIcon[index];
  32. primaryColorIcons = new IIcon[index];
  33. secondaryColorIcons = new IIcon[index];
  34. this.name = name;
  35. }
  36.  
  37. @Override
  38. public void registerIcons(IIconRegister register) {
  39. for (int i = 0; i < baseIcons.length; i++) {
  40. this.baseIcons[i] = register.registerIcon(ReferenceMisc.MODID + ":" + name);
  41. this.primaryColorIcons[i] = register.registerIcon(ReferenceMisc.MODID + ":" + name + "_primary");
  42. this.secondaryColorIcons[i] = register.registerIcon(ReferenceMisc.MODID + ":" + name + "_secondary");
  43. }
  44. }
  45.  
  46. @Override
  47. public IIcon getIcon(ItemStack stack, int pass) {
  48. switch (pass) {
  49. case 0:
  50. return this.baseIcons[index];
  51. case 1:
  52. return this.primaryColorIcons[index];
  53. case 2:
  54. return this.secondaryColorIcons[index];
  55. default:
  56. return this.baseIcons[index];
  57. }
  58. }
  59.  
  60. @Override
  61. public void getSubItems(Item item, CreativeTabs tab, List list) {
  62. for (int i = 0; i < baseIcons.length; i++) {
  63. list.add(new ItemStack(item, 1, i));
  64. }
  65. }
  66.  
  67. @Override
  68. public boolean requiresMultipleRenderPasses() {
  69. return true;
  70. }
  71.  
  72. @SideOnly(Side.CLIENT)
  73. public int getColorFromItemStack(ItemStack stack, int renderpass) {
  74.  
  75. switch (this.index - 1) {
  76. case 0:
  77. switch (renderpass) {
  78. case 1:
  79. color = 42;
  80. case 2:
  81. color = 32;
  82. default:
  83. color = 42;
  84. }
  85. case 1:
  86. switch (renderpass) {
  87. case 1:
  88. color = 42;
  89. case 2:
  90. color = 32;
  91. default:
  92. color = 42;
  93. }
  94. }
  95.  
  96. return color;
  97. }
  98.  
  99.  
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement