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

I am trying to make a very basic item renderer to work off of, that simply duplicates the vanilla renderer behavior to give me a base to add my stuff to. However, I seem to be failing at even that. My current code is as such:

package SoundLogic.materials.core;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import net.minecraft.client.Minecraft;
import net.minecraft.src.ItemStack;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.Tessellator;
import net.minecraftforge.client.*;

public class HauntedItemRenderer implements IItemRenderer {

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	return type==type.INVENTORY;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
		ItemRendererHelper helper) {
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	{
            Tessellator tes = Tessellator.instance;
            ForgeHooksClient.bindTexture(item.getItem().getTextureFile(), 0);
            int var9=item.getIconIndex();
            double texX=var9 % 16 * 16;
            double texY=var9 / 16 * 16;
            tes.startDrawingQuads();
            tes.addVertexWithUV(0, 0, 0, texX, texY);
            tes.addVertexWithUV(0, 16, 0, texX,texY+16);
            tes.addVertexWithUV(16,16,0,texX+16,texY+16);
            tes.addVertexWithUV(16,0,0,texX+16,texY);
            tes.draw();
        }
}
}

I seem to have registered it correctly, since the function is getting called, and I can confirm that the texture and sprite location are valid since it shows up just fine in my hand (which I have not yet implemented a custom renderer for)

If anyone could help me with this I would greatly appreciate it.

Thank you,

Sound Logic

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.