Posted November 16, 20159 yr Hello Guys, I want to make a tool, which can be upgraded and then add another texture on it. Like this: Thanks in advance ^^
November 16, 20159 yr https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/item/ItemArtifact.java#L111-L133 Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 17, 20159 yr Author I've tried it, but it returns just a blank Item package me.benfah.benfahsmod.items.pyrosword; import java.util.Collection; import java.util.HashMap; import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraftforge.client.IItemRenderer; import me.benfah.benfahsmod.Reference; import com.google.common.collect.Multimap; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemPyroSword extends ItemSword{ public ItemPyroSword(ToolMaterial material) { super(material); this.setUnlocalizedName("pyro_sword"); this.setTextureName(Reference.MOD_ID + ":pyro_sword"); } @Override public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) { // TODO Auto-generated method stub } @Override public int getColorFromItemStack(ItemStack stack, int renderPass) { return super.getColorFromItemStack(stack, renderPass); } private HashMap<String, IIcon> textures = new HashMap<String, IIcon>(); private IIcon sword; private IIcon overlay; @Override public IIcon getIcon(ItemStack stack, int pass) { IIcon i = itemIcon; if(pass == 0) { if(stack.stackTagCompound == null) { return itemIcon; } i = (IIcon) textures.get(stack.stackTagCompound.getString("icon").toLowerCase()); if(i == null) { i = itemIcon; } } else { if(stack.stackTagCompound == null) { return (IIcon) textures.get("overlay_upgrade1"); } i = (IIcon) textures.get("overlay_"+stack.stackTagCompound.getString("icon").toLowerCase()); if(i == null) { i = (IIcon) textures.get("overlay_upgrade1"); } } return i; } @Override public IIcon getIconFromDamageForRenderPass(int damage, int pass) { if(pass == 0) { return this.sword; } else { return this.overlay; } } @SideOnly(Side.CLIENT) @Override public int getRenderPasses(int metadata) { return 0; } @SideOnly(Side.CLIENT) @Override public boolean requiresMultipleRenderPasses() { return true; } @Override public void registerIcons(IIconRegister i) { this.sword = i.registerIcon(Reference.MOD_ID + ":pyro_sword"); this.overlay = i.registerIcon(Reference.MOD_ID + ":" + "pyro_sword_t1"); textures.put("overlay_upgrade1", overlay); } } Do anybody know what's wrong?
November 17, 20159 yr Your code never sets the NBT tag to have a value for "icon" Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 17, 20159 yr Well, insert some debugging statements and figure out what the program is doing. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 19, 20159 yr Author Ok, I figured out the problem, but i don't know how to fix it. It seems that the renderPass is the problem, because it renders anything fine "if(pass == 0)", but "if(pass == 1)" just get not called or something like that, pls help
November 19, 20159 yr https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/item/ItemArtifact.java#L106-L108 Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 20, 20159 yr Author Ok, I've fixed it, but another problem occurs, "if(pass == 2)" get not called. Do you know why the problem occurs?
November 20, 20159 yr Ok, I've fixed it, but another problem occurs, "if(pass == 2)" get not called. Do you know why the problem occurs? There are only two passes: pass 0 and pass 1. Pass 2 will never happen. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 21, 20159 yr If you need more than 2 passes, you need to create a custom render class; then you can iterate through and render as many texture layers as you want. E.g. https://github.com/coolAlias/ZeldaSwordSkills/blob/1.7.10/src/main/java/zeldaswordskills/client/render/item/RenderItemBombBag.java#L54-L76 http://i.imgur.com/NdrFdld.png[/img]
November 22, 20159 yr It only renders in the inventory Did you happen to copy my exact code without reading it? Specifically this method: @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return type == ItemRenderType.INVENTORY; } http://i.imgur.com/NdrFdld.png[/img]
November 22, 20159 yr Author I read code of other render classes like EnderZoo, it was inverted. in first Person, It got rendered like I want. but in the inventory it use just two render passes. I've tried other things in the handleRenderType Method. But it don't work
November 22, 20159 yr What did you try, specifically? Just saying 'it don't work' doesn't help anyone figure out why whatever code you are trying isn't working. We're not mind readers here, you have to show us your code. http://i.imgur.com/NdrFdld.png[/img]
November 23, 20159 yr Author I can't show you code, because I have no. In the handleRenderType method I've tried other things "returnType == || type == ItemRenderType.EQUIPPED ItemRenderType.INVENTORY;" but that not worked
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.