Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.geomancy.common.item;
- import com.geomancy.common.util.GeomancyCreativeTab;
- import com.geomancy.common.util.reference.ReferenceMisc;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.minecraft.client.renderer.texture.IIconRegister;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.IIcon;
- import java.util.List;
- public class BaseParasiteItem extends Item {
- public int index;
- public int color;
- public String name;
- @SideOnly(Side.CLIENT)
- private IIcon[] baseIcons;
- private IIcon[] primaryColorIcons;
- private IIcon[] secondaryColorIcons;
- public BaseParasiteItem(String name, int index) {
- this.setHasSubtypes(true);
- this.setUnlocalizedName(name);
- this.setCreativeTab(GeomancyCreativeTab.tabGeomancy);
- this.index = index - 1;
- baseIcons = new IIcon[index];
- primaryColorIcons = new IIcon[index];
- secondaryColorIcons = new IIcon[index];
- this.name = name;
- }
- @Override
- public void registerIcons(IIconRegister register) {
- for (int i = 0; i < baseIcons.length; i++) {
- this.baseIcons[i] = register.registerIcon(ReferenceMisc.MODID + ":" + name);
- this.primaryColorIcons[i] = register.registerIcon(ReferenceMisc.MODID + ":" + name + "_primary");
- this.secondaryColorIcons[i] = register.registerIcon(ReferenceMisc.MODID + ":" + name + "_secondary");
- }
- }
- @Override
- public IIcon getIcon(ItemStack stack, int pass) {
- switch (pass) {
- case 0:
- return this.baseIcons[index];
- case 1:
- return this.primaryColorIcons[index];
- case 2:
- return this.secondaryColorIcons[index];
- default:
- return this.baseIcons[index];
- }
- }
- @Override
- public void getSubItems(Item item, CreativeTabs tab, List list) {
- for (int i = 0; i < baseIcons.length; i++) {
- list.add(new ItemStack(item, 1, i));
- }
- }
- @Override
- public boolean requiresMultipleRenderPasses() {
- return true;
- }
- @SideOnly(Side.CLIENT)
- public int getColorFromItemStack(ItemStack stack, int renderpass) {
- switch (this.index - 1) {
- case 0:
- switch (renderpass) {
- case 1:
- color = 42;
- case 2:
- color = 32;
- default:
- color = 42;
- }
- case 1:
- switch (renderpass) {
- case 1:
- color = 42;
- case 2:
- color = 32;
- default:
- color = 42;
- }
- }
- return color;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement