Jump to content

Recommended Posts

Posted

Hey guys,

 

I was trying to get an item to render in 3D with a custom renderer that implements IItemRenderer, but I am having issues actually getting it to render the Item. I even tried to start over following iChun's tutorial for 1.7 but I guess that it doesn't work for 1.8 anymore. The only thing I am getting is an oversized block covering my whole right hand as shown below:

 

 

1wqiBL5.png

 

 

If needed, here is my code for my renderer and my clientproxy:

 

Renderer:

 

package I_Iz_Shahids_Mods.net.RapierPlus.Render;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.lwjgl.opengl.GL11;

import I_Iz_Shahids_Mods.net.RapierPlus.Main;
import I_Iz_Shahids_Mods.net.RapierPlus.Models.Items.modelRapier;

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

private modelRapier rapierModel;
ResourceLocation resource = new ResourceLocation(Main.MODID + ":" + "textures/items/ironrapier.png");

public ItemRenderIron()
{
	rapierModel = new modelRapier();
}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
	switch(type)
	{
		case EQUIPPED: 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: 
		{
			GL11.glPushMatrix();

			Minecraft.getMinecraft().renderEngine.bindTexture(resource);

			rapierModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

			GL11.glPopMatrix();
		}
		default: break;
	}
}

}

 

 

Proxy:

 

package I_Iz_Shahids_Mods.net.RapierPlus.Proxy;

import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import I_Iz_Shahids_Mods.net.RapierPlus.Main;
import I_Iz_Shahids_Mods.net.RapierPlus.Blocks.Entity.TileEntityBladeMoulder;
import I_Iz_Shahids_Mods.net.RapierPlus.Blocks.Entity.TileEntityPommelMoulder;
import I_Iz_Shahids_Mods.net.RapierPlus.Render.ItemRenderIron;
import I_Iz_Shahids_Mods.net.RapierPlus.Render.TileEntityBladeMoulderRenderer;
import I_Iz_Shahids_Mods.net.RapierPlus.Render.TileEntityPommelMoulderRenderer;

public class ClientProxy
extends CommonProxy
{
@Override
public void registerRenderers()
{
	MinecraftForgeClient.registerItemRenderer(Main.ironRapier, (IItemRenderer)new ItemRenderIron());
}
}

 

if(pain == 0)

{

   gain = 0;

}

Posted

In 1.8 you can no longer (you shouldn't) access GL directly.

Everything is made of models that are pre-baked and eventually put together/modified in runtime.

 

Yes. Using .json models is a good way to start working with it. And yes - .json models allows you to make most of stuff you want.

If that is not enough - look into Forge's model API (SmartItemModel fer example).

1.7.10 is no longer supported by forge, you are on your own.

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.