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

Getting a strange error on my Item Renderer, first, it renders it at the shoulder, and no matter what I do, it is always on the shoulder. Second It pulls up the minecraft sprite texture sheet instead of the one I gave it... I am not sure what is wrong, here is the Item renderer class though. I can provide a screenie if necessary.

 

 

 

package net.CJCutrone.LegendofZelda.render.Items;

 

import net.CJCutrone.LegendofZelda.common.LegendofZelda;

import net.CJCutrone.LegendofZelda.render.blocks.LegendofZeldaPot;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.ItemRenderer;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

import net.minecraft.entity.Entity;

import net.minecraft.item.ItemStack;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.IItemRenderer;

 

import org.lwjgl.opengl.GL11;

 

public class RenderScroll implements IItemRenderer{

 

private Scroll scroll;

 

private static final ResourceLocation texture = new ResourceLocation(LegendofZelda.modid,"textures/models/Scroll.png");

 

public RenderScroll(){

this.scroll = new Scroll();

}

 

public void renderTileEntityAt(TileEntity e, double x, double y, double z, float f) {

 

 

 

GL11.glScalef(1.4F, 1.4F, 1.4F);

 

GL11.glPushMatrix();

scroll.renderModel(0.0625F);

 

GL11.glPopMatrix();

}

 

@Override

public boolean handleRenderType(ItemStack item, ItemRenderType type) {

switch(type){

case EQUIPPED: return  true;

 

case EQUIPPED_FIRST_PERSON: return true;

 

case INVENTORY: return true;

}

return true;

}

 

@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();

 

this.scroll.renderModel(.0625F);

 

GL11.glTranslatef(0.5F, 20F, 0.5F);

GL11.glRotatef(1, 0F, 50F, 1F);

GL11.glPushMatrix();

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

GL11.glPopMatrix();

GL11.glPopMatrix();

}

default:

break;

 

}

}

 

}

 

 

  • Author

Erm..... Yes?

 

I tried it before I rendered it originally and I had the same results, so I started flipping things and placing them before/after just in case. This was my end result. I'll try having it before again though...

Hi

 

Your posted code there looks pretty messed up I have to say.  Binding texture out of order, extra Pop and Pushes, a very large translate, and a strange looking rotate.  I'd suggest you get rid of all the translates and rotates, see where it renders, then add them back one at a time, a little bit at a time.

 

This link might help to figure out what range of coordinates you should be rendering over

http://greyminecraftcoder.blogspot.com.au/2013/09/custom-item-rendering-using.html

There's also some sample code which might be useful, although it uses Tessellator instead of Model.

http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html

 

-TGG

 

 

 

  • Author

I feel rather stupid now. I had a mess up originally so the render I had after was not rendering, I had a test method I forgot to take out... And a few other things. I fixed it though. Lesson learned: NEVER code when you are this wiped out... Thanks for the help guys! :D

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.