benfah Posted November 16, 2015 Posted November 16, 2015 Hello Guys, I want to make a tool, which can be upgraded and then add another texture on it. Like this: Thanks in advance ^^ Quote
Draco18s Posted November 16, 2015 Posted November 16, 2015 https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/item/ItemArtifact.java#L111-L133 Quote 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.
benfah Posted November 17, 2015 Author Posted November 17, 2015 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? Quote
Draco18s Posted November 17, 2015 Posted November 17, 2015 Your code never sets the NBT tag to have a value for "icon" Quote 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.
Draco18s Posted November 17, 2015 Posted November 17, 2015 Well, insert some debugging statements and figure out what the program is doing. Quote 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.
benfah Posted November 19, 2015 Author Posted November 19, 2015 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 Quote
Draco18s Posted November 19, 2015 Posted November 19, 2015 https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/item/ItemArtifact.java#L106-L108 Quote 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.
benfah Posted November 20, 2015 Author Posted November 20, 2015 Ok, I've fixed it, but another problem occurs, "if(pass == 2)" get not called. Do you know why the problem occurs? Quote
Draco18s Posted November 20, 2015 Posted November 20, 2015 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. Quote 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.
coolAlias Posted November 21, 2015 Posted November 21, 2015 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 Quote http://i.imgur.com/NdrFdld.png[/img]
benfah Posted November 22, 2015 Author Posted November 22, 2015 It only renders in the inventory Quote
coolAlias Posted November 22, 2015 Posted November 22, 2015 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; } Quote http://i.imgur.com/NdrFdld.png[/img]
benfah Posted November 22, 2015 Author Posted November 22, 2015 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 Quote
coolAlias Posted November 22, 2015 Posted November 22, 2015 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. Quote http://i.imgur.com/NdrFdld.png[/img]
benfah Posted November 23, 2015 Author Posted November 23, 2015 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 Quote
benfah Posted November 24, 2015 Author Posted November 24, 2015 Ok, I know the sword gets rendered, but a bit buggy: Quote
Recommended Posts
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.