Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi everyone,i made a model for my item,and loaded it.

The problem is it shows INVISIBLE in game...so i think it renders it in a bad way.

 

If you need it, here's the renderer :

 

package DubGun;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.client.FMLClientHandler;

public class ItemRendererWubGun implements IItemRenderer 
{

protected DubGunRender dubgunmodel;

public ItemRendererWubGun()
{
	dubgunmodel = new DubGunRender();
}

@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) {
	// TODO Auto-generated method stub
	return false;
}




@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
	switch(type)
	{
	case EQUIPPED:
		{
			GL11.glPushMatrix();

			Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun","textures/models/dg3d.png"));
			float scale = 1.8F;

			GL11.glScalef(scale, scale, scale);

			GL11.glRotatef(10F, 0.8F, 0.0F, 0.0F); //x
			GL11.glRotatef(-175F, 30.0F, 8.5F, -1.2F);  //y
			GL11.glRotatef(0F, 0.0F, 0.0F, 1.0F);	//z

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

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

}

}

 

 

Here's the Item in Main Class

 

 dubGun = (new ItemWubGun(12905)).setUnlocalizedName("dubgun").setCreativeTab(DubTab).setFull3D();
    GameRegistry.addRecipe(new ItemStack(dubGun), new Object[]{"RRR", "RRR", "RRR", 'R', Block.blockDiamond}); //Temporary test Recipe//

	MinecraftForgeClient.registerItemRenderer(dubGun.itemID, (IItemRenderer)new ItemRendererWubGun());

 

 

Any help is appreciated :)


			Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun","textures/models/dg3d.png"));

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

 

ok so first of all your registering your texture wrong it should this

 

Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun:textures/models/dg3d.png"));

 

or this

 

Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("mac_dubstepgun"+ ":"+"textures/models/dg3d.png"));

 

and as for the render function try replacing data[1] with null and see if that works.

 

 

if (You.likescoding == false){
      You.goaway;
}

No, his texture registering is fine as long as the texture is in:

assets/mac_dubstepgun/textures/models/dg3d.png

 

I'd recommend registering the ItemRenderer on client side only.

you may also want to try having the resource location as a private static final method, then register it

 

like this

 

//this gets the textures
private static final ResourceLocation resourceloc = new (ResourceLocation"mac_dubstepgun", "textures/models/dg3d.png");

// this calls the texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(resourceloc);

 

what this means is that your texture path must look like this

 

"/assets/mac_dubstepgun/textures/models/dg3d.png"

if (You.likescoding == false){
      You.goaway;
}

also try turning this

MinecraftForgeClient.registerItemRenderer(dubGun.itemID, (IItemRenderer)new ItemRendererWubGun());

into this because you dont need (IItemRenderer) it extends it therefore it doesn't need to be cast to it.

MinecraftForgeClient.registerItemRenderer(dubGun.itemID, new ItemRendererWubGun());

 

also try putting it in your clientproxy class

if (You.likescoding == false){
      You.goaway;
}

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.