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

Hello all.

 

I am trying to use a .obj in my mod as 3d rendered item. The reason for it is because Techne isn't really great for high detailed models.

 

I tried to follow this http://www.minecraftforge.net/wiki/Using_wavefront_model tutorial but that is for blocks and not for items. The things I tried don't works because it always crashed on de model.renderAll() function

 

Here is my test code

TESRnowball

 

 

package starglas.dsremake.renderer;

 

import net.minecraft.client.Minecraft;

import net.minecraft.item.ItemStack;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.IItemRenderer;

import net.minecraftforge.client.IItemRenderer.ItemRenderType;

import net.minecraftforge.client.model.AdvancedModelLoader;

import net.minecraftforge.client.model.IModelCustom;

 

import org.lwjgl.opengl.GL11;

 

import starglas.dsremake.common.block.TESnowball;

import starglas.dsremake.common.helpers.Reference;

import starglas.dsremake.common.models.paladinglaive;

 

public class TESRSnowball implements IItemRenderer {

IModelCustom model;

ResourceLocation texture = new ResourceLocation(Reference.MODID,

"textures/items/testtexture.png");

 

public TESRSnowball(){

IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation(

Reference.MODID, "obj/lance.obj"));

}

 

@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) {

// TODO Auto-generated method stub

return false;

}

@Override

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

 

GL11.glPushMatrix();

//Minecraft.getMinecraft().renderEngine.bindTexture(texture);

GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

GL11.glTranslatef(0F, 0F, 0F);

 

model.renderAll();

GL11.glPopMatrix();

}

}

 

 

 

ClientProxy

 

 

package starglas.dsremake.client;

 

import net.minecraft.item.Item;

import net.minecraftforge.client.IItemRenderer;

import net.minecraftforge.client.MinecraftForgeClient;

import starglas.dsremake.common.CommonProxy;

import starglas.dsremake.common.block.ModBlocks;

import starglas.dsremake.common.block.TileEntityBonfire;

import starglas.dsremake.common.helpers.RegisterHelper;

import starglas.dsremake.common.items.ModItems;

import starglas.dsremake.renderer.ItemRendererBlockBonfire;

import starglas.dsremake.renderer.ItemRendererLongSword;

import starglas.dsremake.renderer.ItemRendererPaladinGlaive;

import starglas.dsremake.renderer.RendererBonfire;

import starglas.dsremake.renderer.TESRSnowball;

import cpw.mods.fml.client.registry.ClientRegistry;

import cpw.mods.fml.common.registry.GameRegistry;

 

public class ClientProxy extends CommonProxy {

public void registerRenderers(){

MinecraftForgeClient.registerItemRenderer(ModItems.longSword, (IItemRenderer)new ItemRendererLongSword());

MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.blockBonfire), (IItemRenderer)new ItemRendererBlockBonfire());

GameRegistry.registerTileEntity(TileEntityBonfire.class, "blockBonfire");

ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBonfire.class, new RendererBonfire());

RegisterHelper.registerRender(ModItems.PaladinGlaive, new ItemRendererPaladinGlaive());

MinecraftForgeClient.registerItemRenderer(ModItems.MK1BloodStone, new TESRSnowball());

 

}

}

 

 

I hope someone can help me because it will be really nice to have 3D textures

 

EDIT. Welp, I removed some coded and now it works strangly enough, so mods this threat can be deleted

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.