Jump to content

[1.7.10] Trying to scale an item with a custom IItemRenderer


Recommended Posts

Posted

I am having an issue with a custom IItemRenderer I have made.  There are no errors thrown and the game runs fine, but the IItemRenderer simply does not appear to work.  The sole purpose of the IItemRenderer is to scale the size of the texture of any items that are considered a Greatsword.  I have tried searching around for the past few days with queries such as "minecraft 1.7.10 how to scale items", but no no avail.  I am simply trying to scale the texture of items, nothing more, and I am seeking to accomplish this within the code itself, and not external sources such as model creators.

 

Since there are no errors, I believe I am either not passing something properly, or I am possibly calling or defining the wrong things.  Here is my IItemRenderer, "GreatswordRenderer":

 

 

package com.Thalmias.DarkbeastPlayer.render.items;

import org.lwjgl.opengl.GL11;

import com.Thalmias.DarkbeastPlayer.Main;
import com.Thalmias.DarkbeastPlayer.items.ItemModGreatsword;

import net.minecraft.util.ResourceLocation;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

public class GreatswordRenderer implements IItemRenderer {

protected ItemModGreatsword greatsword;
private Minecraft mc;
private static final ResourceLocation greatswordTexture = new ResourceLocation(Main.MODID + ":" + "textures/items/obsidianGreatsword.png");

public GreatswordRenderer(){
	this.greatsword = new ItemModGreatsword(null, null);
	this.mc = Minecraft.getMinecraft();
}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	switch(type){
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		return true;
	default: return false;
	}

}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {

	return false;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

	switch(type){
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		GL11.glPushMatrix();

		//Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Reference.MOD_ID, "textures/items/obsidianGreatsword.png"));
		this.mc.renderEngine.bindTexture(greatswordTexture);
		GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); //X
		GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); //Y
		GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); //Z
		GL11.glTranslatef(0.0f, 0.0f, 0.0f);
		GL11.glScalef(1.5f, 1.5f, 1.5f);

		greatsword.render((Entity)data[1], 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0625f);

		GL11.glPopMatrix();
	default:
		break;
	}

}

}

 

 

If there is a problem here, I believe it is in this section of the code, since I am trying to call my "ItemModGreatsword" constructor in order to create an instance that my GreatswordRenderer will use:

public GreatswordRenderer(){
	this.greatsword = new ItemModGreatsword(null, null);
	this.mc = Minecraft.getMinecraft();
}

 

This is my "ItemModGreatsword", it is simply a new class of tool (specifically, extending ItemSword) that I am using to identify passed items as Greatswords:

 

package com.Thalmias.DarkbeastPlayer.items;

import com.Thalmias.DarkbeastPlayer.Main;

import net.minecraft.entity.Entity;
import net.minecraft.item.ItemSword;


public class ItemModGreatsword extends ItemSword {

public ItemModGreatsword(String unlocalizedName, ToolMaterial material) {
	super(material);
	this.setUnlocalizedName(unlocalizedName);
	this.setTextureName(Main.MODID + ":" + unlocalizedName);
}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
	//super.render(entity, f, f1, f2, f3, f4, f5);

}

}

 

If there is a problem in this code, I believe it is in the "public void render . . .".  I have found remarkably little documentation on what should go where when dealing with the IItemRenderer, so I put that there because a function in my "GreatswordRenderer" called for it.  It is commented out because "render" is undefined in minecraft's "ItemSword". I am not sure what I would need to put in there, I just know that the Fs handle animation (f0-f4 are generally blank for static items) and f5 is used for the thickness of the render.

 

Just for reference, I am calling a "registerRenderers" function inside of my "ClientProxy", which can be seen here:

 

package com.Thalmias.DarkbeastPlayer;

import com.Thalmias.DarkbeastPlayer.items.ModItems;
import com.Thalmias.DarkbeastPlayer.render.items.GreatswordRenderer;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.client.MinecraftForgeClient;

public class ClientProxy extends CommonProxy {

@Override
public void registerRenderers(){
	MinecraftForgeClient.registerItemRenderer(ModItems.obsidianGreatsword, new GreatswordRenderer());
}

@Override
public void preInit(FMLPreInitializationEvent e) {
	// TODO Auto-generated method stub
	super.preInit(e);
}

@Override
public void init(FMLInitializationEvent e) {
	// TODO Auto-generated method stub
	super.init(e);
}

@Override
public void postInit(FMLPostInitializationEvent e) {
	// TODO Auto-generated method stub
	super.postInit(e);
}


}

 

 

Just for additional measure, though I don't think it is needed, here is the file (ModItems) that has all of my items inside of it (note that I am specifically trying to handle the "obsidianGreatsword" texture in my "GreatswordRenderer"):

 

package com.Thalmias.DarkbeastPlayer.items;

import com.Thalmias.DarkbeastPlayer.Main;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraftforge.common.util.EnumHelper;

public final class ModItems {

//public static ToolMaterial TUTORIAL = EnumHelper.addToolMaterial("TUTORIAL", harvestLevel, durability, miningSpeed, damageVsEntities, enchantability);
public static ToolMaterial TUTORIAL = EnumHelper.addToolMaterial("TUTORIAL", 3, 1000, 15.0f, 4.0f, 30);

public static ToolMaterial OBSIDIAN_TOOL = EnumHelper.addToolMaterial("OBSIDIAN_TOOL", 4, 2000, 15.0f, 10.0f, 15);
public static ToolMaterial MITHRIL_TOOL = EnumHelper.addToolMaterial("MITHRIL_TOOL", 5, 4000, 17.0f, 13.0f, 25);
public static ToolMaterial ADAMANTIUM_TOOL = EnumHelper.addToolMaterial("ADAMANTIUM_TOOL", 6, 8000, 20.0f, 16.0f, 15);
public static ToolMaterial UNOBTAINIUM_TOOL = EnumHelper.addToolMaterial("UNOBTAINIUM_TOOL", 7, 48000, 23.0f, 19.0f, 30);

//public static ArmorMaterial ARMOR = EnumHelper.addArmorMaterial("TUTORIAL_ARMOR", durability, damageReduction[], enchantability);
public static ArmorMaterial ARMOR = EnumHelper.addArmorMaterial("TUTORIAL_ARMOR", 25, new int[] {4, 8, 6, 4}, 30);

public static ArmorMaterial STONE_ARMOR = EnumHelper.addArmorMaterial("STONE_ARMOR", 10, new int[] {2, 5, 4, 1}, 12);
public static ArmorMaterial OBSIDIAN_ARMOR = EnumHelper.addArmorMaterial("OBSIDIAN_ARMOR", 38, new int[] {5, 9, 8, 5}, 15);
public static ArmorMaterial MITHRIL_ARMOR = EnumHelper.addArmorMaterial("MITHRIL_ARMOR", 40, new int[] {5, 9, 8, 5}, 25);
public static ArmorMaterial ADAMANTIUM_ARMOR = EnumHelper.addArmorMaterial("ADAMANTIUM_ARMOR", 120, new int[] {6, 13, 10, 6}, 15);
public static ArmorMaterial UNOBTAINIUM_ARMOR = EnumHelper.addArmorMaterial("UNOBTAINIUM_ARMOR", 240, new int[] {7, 15, 11, 7}, 30);

//Items
public static Item tutorialItem;
public static Item endsidianIngot;

//
//TOOLS
//

//Tools - Swords
public static Item tutorialSword;
public static Item obsidianSword;
public static Item mithrilSword;
public static Item adamantiumSword;
public static Item unobtainiumSword;

//Tools - Pickaxes
public static Item tutorialPickaxe;
public static Item obsidianPickaxe;
public static Item mithrilPickaxe;
public static Item adamantiumPickaxe;
public static Item unobtainiumPickaxe;

//Tools - Hoes
public static Item tutorialHoe;
public static Item obsidianHoe;
public static Item mithrilHoe;
public static Item adamantiumHoe;
public static Item unobtainiumHoe;

//Tools - Spades
public static Item tutorialSpade;
public static Item obsidianSpade;
public static Item mithrilSpade;
public static Item adamantiumSpade;
public static Item unobtainiumSpade;

//Tools - Axes
public static Item tutorialAxe;
public static Item obsidianAxe;
public static Item mithrilAxe;
public static Item adamantiumAxe;
public static Item unobtainiumAxe;

//Tools - Multitools
public static Item tutorialMultitool;
public static Item woodMultitool;
public static Item stoneMultitool;
public static Item ironMultitool;
public static Item goldMultitool;
public static Item diamondMultitool;
public static Item obsidianMultitool;
public static Item mithrilMultitool;
public static Item adamantiumMultitool;
public static Item unobtainiumMultitool;

//Tools - Greatswords
public static Item obsidianGreatsword;

//
//ARMOR
//

//Armor - Helmets
public static Item tutorialHelmet;
public static Item stoneHelmet;
public static Item obsidianHelmet;
public static Item mithrilHelmet;
public static Item adamantiumHelmet;
public static Item unobtainiumHelmet;

//Armor - Chestplates
public static Item tutorialChestplate;
public static Item stoneChestplate;
public static Item obsidianChestplate;
public static Item mithrilChestplate;
public static Item adamantiumChestplate;
public static Item unobtainiumChestplate;

//Armor - Leggings
public static Item tutorialLeggings;
public static Item stoneLeggings;
public static Item obsidianLeggings;
public static Item mithrilLeggings;
public static Item adamantiumLeggings;
public static Item unobtainiumLeggings;

//Armor - Boots
public static Item tutorialBoots;
public static Item stoneBoots;
public static Item obsidianBoots;
public static Item mithrilBoots;
public static Item adamantiumBoots;
public static Item unobtainiumBoots;

public static final void init() {

	tutorialItem = new Item().setUnlocalizedName("tutorialItem").setCreativeTab(CreativeTabs.tabMisc).setTextureName(Main.MODID + ":tutorialItem");
	endsidianIngot = new Item().setUnlocalizedName("endsidianIngot").setCreativeTab(CreativeTabs.tabMaterials).setTextureName(Main.MODID + ":endsidianIngot");

	//
	//ITEM DEFINITIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//


	//Tutorial/Practice items
	GameRegistry.registerItem(tutorialItem, "tutorialItem");
	GameRegistry.registerItem(endsidianIngot, "endsidianIngot");

	//
	//TOOL DEFINITIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//


	//Tutorial/Practice tools
	GameRegistry.registerItem(tutorialPickaxe = new ItemModPickaxe("tutorialPickaxe", TUTORIAL), "tutorialPickaxe");
	GameRegistry.registerItem(tutorialAxe = new ItemModAxe("tutorialAxe", TUTORIAL), "tutorialAxe");
	GameRegistry.registerItem(tutorialSpade = new ItemModSpade("tutorialSpade", TUTORIAL), "tutorialSpade");
	GameRegistry.registerItem(tutorialHoe = new ItemModHoe("tutorialHoe", TUTORIAL), "tutorialHoe");
	GameRegistry.registerItem(tutorialSword = new ItemModSword("tutorialSword", TUTORIAL), "tutorialSword");
	GameRegistry.registerItem(tutorialMultitool = new ItemModMultitool("tutorialMultitool", TUTORIAL), "tutorialMultitool");

	//Wood Tools
	GameRegistry.registerItem(woodMultitool = new ItemModMultitool("woodMultitool", ToolMaterial.WOOD), "woodMultitool");

	//Stone Tools
	GameRegistry.registerItem(stoneMultitool = new ItemModMultitool("stoneMultitool", ToolMaterial.STONE), "stoneMultitool");

	//Iron Tools
	GameRegistry.registerItem(ironMultitool = new ItemModMultitool("ironMultitool", ToolMaterial.IRON), "ironMultitool");

	//Gold Tools
	GameRegistry.registerItem(goldMultitool = new ItemModMultitool("goldMultitool", ToolMaterial.GOLD), "goldMultitool");

	//Diamond Tools
	GameRegistry.registerItem(diamondMultitool = new ItemModMultitool("diamondMultitool", ToolMaterial.EMERALD), "diamondMultitool");

	//Obsidian Tools
	GameRegistry.registerItem(obsidianPickaxe = new ItemModPickaxe("obsidianPickaxe", OBSIDIAN_TOOL), "obsidianPickaxe");
	GameRegistry.registerItem(obsidianAxe = new ItemModAxe("obsidianAxe", OBSIDIAN_TOOL), "obsidianAxe");
	GameRegistry.registerItem(obsidianSpade = new ItemModSpade("obsidianSpade", OBSIDIAN_TOOL), "obsidianSpade");
	GameRegistry.registerItem(obsidianHoe = new ItemModHoe("obsidianHoe", OBSIDIAN_TOOL), "obsidianHoe");
	GameRegistry.registerItem(obsidianSword = new ItemModSword("obsidianSword", OBSIDIAN_TOOL), "obsidianSword");
	GameRegistry.registerItem(obsidianMultitool = new ItemModMultitool("obsidianMultitool", OBSIDIAN_TOOL), "obsidianMultitool");
	GameRegistry.registerItem(obsidianGreatsword = new ItemModGreatsword("obsidianGreatsword", OBSIDIAN_TOOL), "obsidianGreatsword");

	//Mithril Tools
	GameRegistry.registerItem(mithrilPickaxe = new ItemModPickaxe("mithrilPickaxe", MITHRIL_TOOL), "mithrilPickaxe");
	GameRegistry.registerItem(mithrilAxe = new ItemModAxe("mithrilAxe", MITHRIL_TOOL), "mithrilAxe");
	GameRegistry.registerItem(mithrilSpade = new ItemModSpade("mithrilSpade", MITHRIL_TOOL), "mithrilSpade");
	GameRegistry.registerItem(mithrilHoe = new ItemModHoe("mithrilHoe", MITHRIL_TOOL), "mithrilHoe");
	GameRegistry.registerItem(mithrilSword = new ItemModSword("mithrilSword", MITHRIL_TOOL), "mithrilSword");
	GameRegistry.registerItem(mithrilMultitool = new ItemModMultitool("mithrilMultitool", MITHRIL_TOOL), "mithrilMultitool");

	//Adamantium Tools
	GameRegistry.registerItem(adamantiumPickaxe = new ItemModPickaxe("adamantiumPickaxe", ADAMANTIUM_TOOL), "adamantiumPickaxe");
	GameRegistry.registerItem(adamantiumAxe = new ItemModAxe("adamantiumAxe", ADAMANTIUM_TOOL), "adamantiumAxe");
	GameRegistry.registerItem(adamantiumSpade = new ItemModSpade("adamantiumSpade", ADAMANTIUM_TOOL), "adamantiumSpade");
	GameRegistry.registerItem(adamantiumHoe = new ItemModHoe("adamantiumHoe", ADAMANTIUM_TOOL), "adamantiumHoe");
	GameRegistry.registerItem(adamantiumSword = new ItemModSword("adamantiumSword", ADAMANTIUM_TOOL), "adamantiumSword");
	GameRegistry.registerItem(adamantiumMultitool = new ItemModMultitool("adamantiumMultitool", ADAMANTIUM_TOOL), "adamantiumMultitool");

	//Unobtainium Tools
	GameRegistry.registerItem(unobtainiumPickaxe = new ItemModPickaxe("unobtainiumPickaxe", UNOBTAINIUM_TOOL), "unobtainiumPickaxe");
	GameRegistry.registerItem(unobtainiumAxe = new ItemModAxe("unobtainiumAxe", UNOBTAINIUM_TOOL), "unobtainiumAxe");
	GameRegistry.registerItem(unobtainiumSpade = new ItemModSpade("unobtainiumSpade", UNOBTAINIUM_TOOL), "unobtainiumSpade");
	GameRegistry.registerItem(unobtainiumHoe = new ItemModHoe("unobtainiumHoe", UNOBTAINIUM_TOOL), "unobtainiumHoe");
	GameRegistry.registerItem(unobtainiumSword = new ItemModSword("unobtainiumSword", UNOBTAINIUM_TOOL), "unobtainiumSword");
	GameRegistry.registerItem(unobtainiumMultitool = new ItemModMultitool("unobtainiumMultitool", UNOBTAINIUM_TOOL), "unobtainiumMultitool");

	//
	//ARMOR DEFINITIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//


	//Tutorial/Practice armor
	GameRegistry.registerItem(tutorialHelmet = new ItemModArmor("tutorialHelmet", ARMOR, "tutorial", 0), "tutorialHelmet"); //0 for helmet
	GameRegistry.registerItem(tutorialChestplate = new ItemModArmor("tutorialChestplate", ARMOR, "tutorial", 1), "tutorialChestplate"); // 1 for chestplate
	GameRegistry.registerItem(tutorialLeggings = new ItemModArmor("tutorialLeggings", ARMOR, "tutorial", 2), "tutorialLeggings"); // 2 for leggings
	GameRegistry.registerItem(tutorialBoots = new ItemModArmor("tutorialBoots", ARMOR, "tutorial", 3), "tutorialBoots"); // 3 for boots

	//Stone Armor
	GameRegistry.registerItem(stoneHelmet = new ItemModArmor("stoneHelmet", STONE_ARMOR, "stone", 0), "stoneHelmet"); //0 for helmet
	GameRegistry.registerItem(stoneChestplate = new ItemModArmor("stoneChestplate", STONE_ARMOR, "stone", 1), "stoneChestplate"); // 1 for chestplate
	GameRegistry.registerItem(stoneLeggings = new ItemModArmor("stoneLeggings", STONE_ARMOR, "stone", 2), "stoneLeggings"); // 2 for leggings
	GameRegistry.registerItem(stoneBoots = new ItemModArmor("stoneBoots", STONE_ARMOR, "stone", 3), "stoneBoots"); // 3 for boots

	//Obsidian Armor
	GameRegistry.registerItem(obsidianHelmet = new ItemModArmor("obsidianHelmet", OBSIDIAN_ARMOR, "obsidian", 0), "obsidianHelmet"); //0 for helmet
	GameRegistry.registerItem(obsidianChestplate = new ItemModArmor("obsidianChestplate", OBSIDIAN_ARMOR, "obsidian", 1), "obsidianChestplate"); // 1 for chestplate
	GameRegistry.registerItem(obsidianLeggings = new ItemModArmor("obsidianLeggings", OBSIDIAN_ARMOR, "obsidian", 2), "obsidianLeggings"); // 2 for leggings
	GameRegistry.registerItem(obsidianBoots = new ItemModArmor("obsidianBoots", OBSIDIAN_ARMOR, "obsidian", 3), "obsidianBoots"); // 3 for boots

	//Mithril Armor
	GameRegistry.registerItem(mithrilHelmet = new ItemModArmor("mithrilHelmet", MITHRIL_ARMOR, "mithril", 0), "mithrilHelmet"); //0 for helmet
	GameRegistry.registerItem(mithrilChestplate = new ItemModArmor("mithrilChestplate", MITHRIL_ARMOR, "mithril", 1), "mithrilChestplate"); // 1 for chestplate
	GameRegistry.registerItem(mithrilLeggings = new ItemModArmor("mithrilLeggings", MITHRIL_ARMOR, "mithril", 2), "mithrilLeggings"); // 2 for leggings
	GameRegistry.registerItem(mithrilBoots = new ItemModArmor("mithrilBoots", MITHRIL_ARMOR, "mithril", 3), "mithrilBoots"); // 3 for boots

	//Adamantium Armor
	GameRegistry.registerItem(adamantiumHelmet = new ItemModArmor("adamantiumHelmet", ADAMANTIUM_ARMOR, "adamantium", 0), "adamantiumHelmet"); //0 for helmet
	GameRegistry.registerItem(adamantiumChestplate = new ItemModArmor("adamantiumChestplate", ADAMANTIUM_ARMOR, "adamantium", 1), "adamantiumChestplate"); // 1 for chestplate
	GameRegistry.registerItem(adamantiumLeggings = new ItemModArmor("adamantiumLeggings", ADAMANTIUM_ARMOR, "adamantium", 2), "adamantiumLeggings"); // 2 for leggings
	GameRegistry.registerItem(adamantiumBoots = new ItemModArmor("adamantiumBoots", ADAMANTIUM_ARMOR, "adamantium", 3), "adamantiumBoots"); // 3 for boots

	//Unobtainium Armor
	GameRegistry.registerItem(unobtainiumHelmet = new ItemModArmor("unobtainiumHelmet", UNOBTAINIUM_ARMOR, "unobtainium", 0), "unobtainiumHelmet"); //0 for helmet
	GameRegistry.registerItem(unobtainiumChestplate = new ItemModArmor("unobtainiumChestplate", UNOBTAINIUM_ARMOR, "unobtainium", 1), "unobtainiumChestplate"); // 1 for chestplate
	GameRegistry.registerItem(unobtainiumLeggings = new ItemModArmor("unobtainiumLeggings", UNOBTAINIUM_ARMOR, "unobtainium", 2), "unobtainiumLeggings"); // 2 for leggings
	GameRegistry.registerItem(unobtainiumBoots = new ItemModArmor("unobtainiumBoots", UNOBTAINIUM_ARMOR, "unobtainium", 3), "unobtainiumBoots"); // 3 for boots

}

}

 

 

If anyone can help with this, it would be greatly appreciated.  This has been bugging me for the past 4 days and is starting to drive me mad.  Such simple concepts make such big problems, eh?

 

 

Posted

Don't create a new instance of your item - use the ItemStack passed to the render method:

// push matrix here
// translate here
// scale here
IIcon icon = stack.getItem().getIcon(stack, 0);
Tessellator tessellator = Tessellator.instance;
ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
// pop matrix here

With that, you don't even need to hard-code your resource location, so you can use it for any item that you want to render large. You'll have to play around a little with the translation values to get your item in the correct location, depending on the scale you use.

Posted

Thanks, that simplifies identifying the Greatswords by quite a bit!  I was planning on getting the held item, then translating the localized name to the unlocalized name and getting the material through a series of ifs and elses, but this just lets me identify each new Greatsword to render by simply registering each Greatsword in the ClientProxy!

 

Unfortunately, the Greatsword still does not scale in size so I probably have a few mistakes elsewhere that I cannot find, or I am missing some key components for rendering.  My new code is as follows:

 

GreatswordRenderer:

 

package com.Thalmias.DarkbeastPlayer.render.items;

import org.lwjgl.opengl.GL11;

import net.minecraft.util.IIcon;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

public class GreatswordRenderer implements IItemRenderer {


@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		return true;
	default: return false;
	}

}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		return true;

	default: return false;
	//return false;
	}
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:

		GL11.glPushMatrix();

		//IIcon icon = item.getItem().getIcon(item, 0);
		//Tessellator tessellator = Tessellator.instance;

		GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); //X
		GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); //Y
		GL11.glRotatef(0.0f, 0.0f, 0.0f, 0.0f); //Z
		GL11.glTranslatef(0.0f, 0.0f, 0.0f);
		GL11.glScalef(1.50f, 1.5f, 1.5f);

		IIcon icon = item.getItem().getIcon(item, 0);
		Tessellator tessellator = Tessellator.instance;

		ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

		GL11.glPopMatrix();
	default:
		break;
	}

}

}

 

I removed the public GreatswordRenderer() method, changed the public void renderItem() method to use your Tessellator, and removed a lot of now-unnecessary imports.

ItemModGreatsword:

 

package com.Thalmias.DarkbeastPlayer.items;

import com.Thalmias.DarkbeastPlayer.Main;

import net.minecraft.item.ItemSword;


public class ItemModGreatsword extends ItemSword {

public ItemModGreatsword(String unlocalizedName, ToolMaterial material) {

	super(material);
	this.setUnlocalizedName(unlocalizedName);
	this.setTextureName(Main.MODID + ":" + unlocalizedName);

}

}

 

Here the only thing that changed was getting rid of that unnecessary public void render() method and a few imports.  All of my other code has remained the same.

 

Right now I'm messing around with the Tessalator and looking up more information on it, as well as trying to figure out what else I need to put where.  I think I''m also going to try and see if I can get it to work on something that isn't a Greatsword (IE: a Sword).  Again, thanks!  I feel like I'm right on the edge of having this done.

 

EDIT:

Just tried setting the public void registerRenderers() method in the ClientProxy to handle a regular Sword instead of a Greatsword, but nothing changed.  There's probably still something missing in my GreatswordRenderer class somewhere.

 

EDIT2:

 

I have found some people both registering an Icon and getting the IconIndex in some of their custom items, so I changed my ItemModGreatsword to this:

 

package com.Thalmias.DarkbeastPlayer.items;

import com.Thalmias.DarkbeastPlayer.Main;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.IIcon;


public class ItemModGreatsword extends ItemSword {

public ItemModGreatsword(String unlocalizedName, ToolMaterial material) {

	super(material);
	this.setUnlocalizedName(unlocalizedName);
	this.setTextureName(Main.MODID + ":" + unlocalizedName);


}


public void registerIcons(IIconRegister iconRegister, ItemStack item) {
	itemIcon = iconRegister.registerIcon(Main.MODID + ":" + getUnlocalizedName(item));
}
@Override
public IIcon getIconIndex(ItemStack item) {
	return this.getIcon(item,0);
}

}

 

I know that the public void registerIcons() and public IIcon getIconIndex() are working properly because giving them garbage data causes the texture on the Greatsword to become the null purple and black texture.  However, this has produced no change and it feels like I'm manually implementing something that is done automatically.

 

EDIT3:

Last edit for this post, methinks.  Anywho, I have implemented a TextureManager in my GreatswordRenderer's public void renderItem() function to bind the Texture of any Greatsword passed to it.  I have also encased the entire class in a @SideOnly(Side.CLIENT) for extra measure.  The changes can be seen here:

 

package com.Thalmias.DarkbeastPlayer.render.items;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.util.IIcon;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;



@SideOnly(Side.CLIENT)
public class GreatswordRenderer implements IItemRenderer {

Minecraft mc = Minecraft.getMinecraft();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		return true;
	default: return false;
	}

}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		return true;

	default: return false;
	//return false;
	}
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
	{

		GL11.glPushMatrix();
		TextureManager textureManager = this.mc.getTextureManager();
		textureManager.bindTexture(textureManager.getResourceLocation(item.getItemSpriteNumber()));

		//IIcon icon = item.getItem().getIcon(item, 0);
		//Tessellator tessellator = Tessellator.instance;

		GL11.glRotatef(0.0f, 1.0f, 0.0f, 0.0f); //X
		GL11.glRotatef(0.0f, 0.0f, 1.0f, 0.0f); //Y
		GL11.glRotatef(0.0f, 0.0f, 0.0f, 1.0f); //Z
		GL11.glTranslatef(0.0f, 0.0f, 0.0f);
		GL11.glScalef(10.0f, 10.0f, 10.0f);

		IIcon icon = item.getItem().getIcon(item, 0);
		Tessellator tessellator = Tessellator.instance;

		ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

		GL11.glPopMatrix();
	}
	default:
		break;

	}

}

}

 

I also encased the functions that register the icons inside of @SideOnly(Side.CLIENT) in the ItemModGreatsword class, which can be seen here:

 

package com.Thalmias.DarkbeastPlayer.items;

import com.Thalmias.DarkbeastPlayer.Main;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.IIcon;


public class ItemModGreatsword extends ItemSword {

public ItemModGreatsword(String unlocalizedName, ToolMaterial material) {

	super(material);
	this.setUnlocalizedName(unlocalizedName);
	this.setTextureName(Main.MODID + ":" + unlocalizedName);


}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister, ItemStack item) {
	itemIcon = iconRegister.registerIcon(Main.MODID + ":" + getUnlocalizedName(item));
}

@SideOnly(Side.CLIENT)
@Override
public IIcon getIconIndex(ItemStack item) {
	return this.getIcon(item,0);
}

}

 

 

Unfortunately no results, and I can't tell if I am making progress or not, but it at least seems to be adding a few layers of redundancy checking to these two classes.

Posted

The only registerRenderers() calls functions (whoops :3) that I have (I assume you are talking about these) are from the public void registerRenderers() functions in the Common and ClientProxy, which are here:

 

ClientProxy:

 

package com.Thalmias.DarkbeastPlayer;

import com.Thalmias.DarkbeastPlayer.items.ModItems;
import com.Thalmias.DarkbeastPlayer.render.items.GreatswordRenderer;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.client.MinecraftForgeClient;

public class ClientProxy extends CommonProxy {

@Override
public void registerRenderers(){
	MinecraftForgeClient.registerItemRenderer(ModItems.woodGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.stoneGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.ironGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.goldGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.diamondGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.obsidianGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.mithrilGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.adamantiumGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.unobtainiumGreatsword, new GreatswordRenderer());
}

@Override
public void preInit(FMLPreInitializationEvent e) {
	// TODO Auto-generated method stub
	super.preInit(e);
}

@Override
public void init(FMLInitializationEvent e) {
	// TODO Auto-generated method stub
	super.init(e);
}

@Override
public void postInit(FMLPostInitializationEvent e) {
	// TODO Auto-generated method stub
	super.postInit(e);
}


}

 

 

CommonProxy:

 

package com.Thalmias.DarkbeastPlayer;

import com.Thalmias.DarkbeastPlayer.block.ModBlocks;
import com.Thalmias.DarkbeastPlayer.crafting.ModCrafting;
import com.Thalmias.DarkbeastPlayer.items.ModItems;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

public class CommonProxy {

public void registerRenderers() {

}

public void preInit(FMLPreInitializationEvent e) {
	ModItems.init();
	ModBlocks.init();
	ModCrafting.init();
}

public void init(FMLInitializationEvent e) {

}

public void postInit(FMLPostInitializationEvent e) {

}



}

 

 

There is a good chance that I am mucking something up somewhere, most of my coding for this particular endeavor has been pretty hectic and piecemeal at best, so I'm pretty sure there's a bunch of pieces I'm missing.  Are there any additional places you are supposed to use registerRenderers(), or perhaps anything else you are supposed to put into those functions?  I just know that registerRenderers() shouldn't be done server side since it uses Minecraft game code.

 

EDIT:

 

Oh wait, I wouldn't happen to have to make a call to the registerRenderers() function inside of Main?  my Main doesn't have one, so I guess it wouldn't hurt to try it out.

 

Main:

 

package com.Thalmias.DarkbeastPlayer;


import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Main.MODID, name = Main.MODNAME, version = Main.VERSION)
public class Main {

public static final String MODID = "darkbeastplayer";
public static final String MODNAME = "Darkbeast Player Mod";
public static final String VERSION = "1.0.0";

@Instance
public static Main instance = new Main();

@SidedProxy(clientSide="com.Thalmias.DarkbeastPlayer.ClientProxy", serverSide="com.Thalmias.DarkbeastPlayer.ServerProxy")
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent e) {
	System.out.println("Starting method: preInit");
	proxy.preInit(e);

}

@EventHandler
public void init(FMLInitializationEvent e) {
	System.out.println("Starting method: init");
	proxy.init(e);

}

@EventHandler
public void postInit(FMLPostInitializationEvent e) {
	System.out.println("Starting method: postInit");
	proxy.postInit(e);

}
}

 

Posted

The only registerRenderers() calls that I have (I assume you are talking about these) are from the public void registerRenderers() functions in the Common and ClientProxy, which are here:

 

Call != method

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.

Posted

Eureka!  That was the problem.  Now I have to muck with translates, since I have an awkwardly large sword slanted sideways, but still.  Figures that I've been running around trying to make something work that couldn't work because I didn't call the proxy.registerRenderers() function in the public void preInit(FMLPreInitializationEvent e) function inside of Main.  Sheesh!  Anywho, for those interested, I am going to copy-pasta my code here for anyone experiencing similar issues.  Thanks a lot for your help, coolAlias, definitely pointed me in the right direction!

 

Main:

 

package com.Thalmias.DarkbeastPlayer;


import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Main.MODID, name = Main.MODNAME, version = Main.VERSION)
public class Main {

public static final String MODID = "darkbeastplayer";
public static final String MODNAME = "Darkbeast Player Mod";
public static final String VERSION = "1.0.0";

@Instance
public static Main instance = new Main();

@SidedProxy(clientSide="com.Thalmias.DarkbeastPlayer.ClientProxy", serverSide="com.Thalmias.DarkbeastPlayer.ServerProxy")
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent e) {
	System.out.println("Starting method: preInit");
	proxy.preInit(e);
	proxy.registerRenderers();

}

@EventHandler
public void init(FMLInitializationEvent e) {
	System.out.println("Starting method: init");
	proxy.init(e);

}

@EventHandler
public void postInit(FMLPostInitializationEvent e) {
	System.out.println("Starting method: postInit");
	proxy.postInit(e);

}
}

 

 

CommonProxy:

 

package com.Thalmias.DarkbeastPlayer;

import com.Thalmias.DarkbeastPlayer.block.ModBlocks;
import com.Thalmias.DarkbeastPlayer.crafting.ModCrafting;
import com.Thalmias.DarkbeastPlayer.items.ModItems;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

public class CommonProxy {

public void registerRenderers() {

}

public void preInit(FMLPreInitializationEvent e) {
	ModItems.init();
	ModBlocks.init();
	ModCrafting.init();
}

public void init(FMLInitializationEvent e) {

}

public void postInit(FMLPostInitializationEvent e) {

}



}

 

 

ClientProxy:

 

package com.Thalmias.DarkbeastPlayer;

import com.Thalmias.DarkbeastPlayer.items.ModItems;
import com.Thalmias.DarkbeastPlayer.render.items.GreatswordRenderer;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.client.MinecraftForgeClient;

public class ClientProxy extends CommonProxy {

@Override
public void registerRenderers(){
	MinecraftForgeClient.registerItemRenderer(ModItems.woodGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.stoneGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.ironGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.goldGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.diamondGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.obsidianGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.mithrilGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.adamantiumGreatsword, new GreatswordRenderer());
	MinecraftForgeClient.registerItemRenderer(ModItems.unobtainiumGreatsword, new GreatswordRenderer());
}

@Override
public void preInit(FMLPreInitializationEvent e) {
	// TODO Auto-generated method stub
	super.preInit(e);
}

@Override
public void init(FMLInitializationEvent e) {
	// TODO Auto-generated method stub
	super.init(e);
}

@Override
public void postInit(FMLPostInitializationEvent e) {
	// TODO Auto-generated method stub
	super.postInit(e);
}


}

 

 

ItemModGreatsword:

 

package com.Thalmias.DarkbeastPlayer.items;

import com.Thalmias.DarkbeastPlayer.Main;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
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.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;


public class ItemModGreatsword extends ItemSword {

private float field_150934_a;

@Override
public void onUpdate(ItemStack item, World world, Entity entity, int i, boolean flag) {
	super.onUpdate(item, world, entity, i, flag);
	{
		EntityPlayer player = (EntityPlayer) entity;
		ItemStack equipped = player.getCurrentEquippedItem();
		if(equipped == item){
			player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 5, 3));
		}
		else{

		}
	}
}

public Multimap getItemAttributeModifiers()
{
	Multimap multimap = HashMultimap.create(); // this part, you need to create a new hash-multimap!
	multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.field_150934_a, 0));
	return multimap;
}

public ItemModGreatsword(String unlocalizedName, ToolMaterial material) {

	super(material);
	this.setUnlocalizedName(unlocalizedName);
	this.setTextureName(Main.MODID + ":" + unlocalizedName);
	this.field_150934_a = 8.0F + material.getDamageVsEntity();



}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister, ItemStack item) {
	itemIcon = iconRegister.registerIcon(Main.MODID + ":" + getUnlocalizedName(item));
}

@SideOnly(Side.CLIENT)
@Override
public IIcon getIconIndex(ItemStack item) {
	return this.getIcon(item,0);
}

}

 

 

GreatswordRenderer

 

package com.Thalmias.DarkbeastPlayer.render.items;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.util.IIcon;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;



@SideOnly(Side.CLIENT)
public class GreatswordRenderer implements IItemRenderer {

Minecraft mc = Minecraft.getMinecraft();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		return true;
	default: return false;
	}

}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
		return true;

	default: return false;
	//return false;
	}
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

	switch(type){
	case ENTITY:
	case EQUIPPED:
	case EQUIPPED_FIRST_PERSON:
	{

		GL11.glPushMatrix();
		TextureManager textureManager = this.mc.getTextureManager();
		textureManager.bindTexture(textureManager.getResourceLocation(item.getItemSpriteNumber()));

		//IIcon icon = item.getItem().getIcon(item, 0);
		//Tessellator tessellator = Tessellator.instance;

		GL11.glRotatef(0.0f, 1.0f, 0.0f, 0.0f); //X
		GL11.glRotatef(0.0f, 0.0f, 1.0f, 0.0f); //Y
		GL11.glRotatef(0.0f, 0.0f, 0.0f, 1.0f); //Z
		GL11.glTranslatef(0.0f, 0.0f, 0.0f);
		GL11.glScalef(10.0f, 10.0f, 10.0f);

		IIcon icon = item.getItem().getIcon(item, 0);
		Tessellator tessellator = Tessellator.instance;

		ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

		GL11.glPopMatrix();
	}
	default:
		break;

	}

}

}

 

 

Posted

Now that you've got it working, I'll show you mine ;)

 

If you don't plan to pass any arguments to your render class, you may as well just make one instance of it and pass it to each of your registrations:

IItemRenderer renderer = new GreatswordRenderer();
MinecraftForgeClient.registerItemRenderer(ModItems.woodGreatsword, renderer);
MinecraftForgeClient.registerItemRenderer(ModItems.stoneGreatsword, renderer);
MinecraftForgeClient.registerItemRenderer(ModItems.ironGreatsword, renderer);
MinecraftForgeClient.registerItemRenderer(ModItems.goldGreatsword, renderer);
// etc.

Posted

Oh wow, love your code.  Efficient, clean, and I would have never thought to multiply the scale by values inside of the translate to offset the scaling.  Seriously, thanks for your help ^^

Posted

Most certainly.  It just needed a few bits and pieces to handle ENTITY rendering in the shouldUseRenderHelper() and renderItem() functions, and a new function that rendered it in the case of ENTITY

 

for those interested, here's a snippet of the code that I needed to add:

 

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.ENTITY;

}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	switch (type){
	case ENTITY:
		return (helper == ItemRendererHelper.ENTITY_BOBBING ||
            helper == ItemRendererHelper.ENTITY_ROTATION);

	default:
		return false;
	}
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	switch (type){
	case ENTITY:
		renderEntityItem(item);
		break;
	case EQUIPPED_FIRST_PERSON:
		renderEquippedItem(item, (EntityLivingBase) data[1], true);
		break;
	case EQUIPPED:
		renderEquippedItem(item, (EntityLivingBase) data[1], false);
		break;
	default:
	}

}

private void renderEntityItem(ItemStack item) {


	GL11.glPushMatrix();


	GL11.glScaled(2.0f, 2.0f, 1.0f);
	GL11.glTranslatef(-0.5F, 0.0F, 0.0F);

	IIcon icon = item.getItem().getIcon(item, 0);
	Tessellator tessellator = Tessellator.instance;

	ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

	GL11.glPopMatrix();

}

 

 

for those interested in the finished product, here's some screenies (I used a 32x32 texture for the Greatswords so when they scaled up, the size of the pixels would be the same size as the pixels on any other item):

 

 

 

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.