Jump to content

Recommended Posts

Posted

Hello,

I m trying to use it in my code in 1.8 but i get errors like:

 

java:824: error: cannot find symbol IIcon icon = item.getIconIndex();

^

symbol: class IIcon

location: class NPC_BattleaxeRender

 

and

 

java:849: error: instance has private access in Tessellator

 

This is the code lines i used in 1.7.x to render a custom item.

It used to work then but not now of course.

 

 

 

public static class NPC_BattleaxeRender

implements IItemRenderer{

 

public boolean handleRenderType(ItemStack itemStack, IItemRenderer.ItemRenderType type){return true;}

public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper){return false;}

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

 

IIcon icon = item.getIconIndex();

 

if (type == IItemRenderer.ItemRenderType.ENTITY){

GL11.glPushMatrix();

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

GL11.glRotatef(0.0F, 1.0F, 0.0F, 0.0F);

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

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();} if (type == IItemRenderer.ItemRenderType.INVENTORY){

GL11.glPushMatrix();

GL11.glTranslatef(15.0F, 1.0F, 0.0F);

GL11.glRotatef(225.0F, 0.0F, 1.0F, 0.0F);

GL11.glScalef(21.0F, 15.0F, 2.0F);

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();} if (type == IItemRenderer.ItemRenderType.EQUIPPED){

 

GL11.glPushMatrix();

GL11.glTranslatef(1.0F, -0.02F, -0.05F);

GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

GL11.glRotatef(0.0F, 0.0F, 0.0F, 1.0F);

GL11.glScalef(1.0F, 1.0F, 1.5F);

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();} if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON){

GL11.glPushMatrix();

GL11.glTranslatef(30.0F, -45.0F, 35.0F);

GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

GL11.glRotatef(80.0F, 0.0F, 0.0F, 1.0F);

GL11.glScalef(70.0F, 70.0F, 100.0F);

ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 16F / 256F);

GL11.glPopMatrix();} }}

 

 

 

 

Posted

Code from 1.7 needs major overhauling before you have something that will work in 1.8. There are many threads here that already answer the issues you're displaying. However, they can be difficult to find using the site's own search (it tends to turn up massive logs). Try to Google as much as you can about:

 

Minecraft Forge "1.8"...

 

1) + blockstates

 

2) + tesselator

 

3) + mesher

 

And be ready to do the common and client proxies... they're now essential to all mods with items (including nearly all blocks, because they can drop or appear in inventory as items.

 

Finally, read about Forge's advanced blockstate format.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Psh, that looks awesome.  Keep it. :D

(ok, ok, it only looks awesome to me)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Actually the code didnt had problems. The textures had some transparent pixels around the item and the 1.8 machine recognized them as empty space. In 1.7.10 there wasnt any problem like that. The thing i did was to use gimp to make a black border around my items and fill that empty space. I got 2 goods from that, 1 fixed the item appearance and 2 my items look more cartoon and awsome.

 

Solved!

Posted

1.7.10 doesn't allow for transparent pixels.  The png file gets thresholded (above a certain alpha -> 1, else -> 0).  1.8 looks like it'll allow for partial transparency in items, which is really cool.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Reminds me of time when I was like: "Wtf, why is this blade see-through?" Took me some time to actually look into .png, rather than my GL calls.

 

And indeed- it is pretty cool, you can make glassy-stuff. :)

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.