Jump to content

Recommended Posts

Posted

I've got a strange issue I can't even figure out where to look.

 

My custom staff renders fine in a custom mob's hand, but not in mine.  In particular, I have a red semi-transparent cube in the middle that bounces around to simulate a particle effect.  This is true whether it is 1st person or 3rd person.

 

Code Snipet

 

 

GL11.glPushMatrix();

GL11.glEnable(GL11.GL_CULL_FACE);

GL11.glEnable(GL11.GL_BLEND);

GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

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

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

float scale = 2.0F;

GL11.glScalef(scale, scale, scale);

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

GL11.glRotatef(90, -1, 0, 0);

GL11.glRotatef(-15, 0, 0, 1); // left/right rotation

GL11.glRotatef(180, 0, 1, 0);

GL11.glRotatef(75, 1, 0, 0); // forward rotation

GL11.glTranslatef(-0.15F, -0.25F, -0.15F); // Left-Right Forward-Backwards Up-Down

// Make jewel oscillate

int rand_position = instance.properties().random().nextInt(4);

float range = 0.05f;

staff.jewel().offsetX = range * (instance.properties().random().nextInt(201) - 100) / 100;

staff.jewel().offsetY = range * (instance.properties().random().nextInt(201) - 100) / 100;

staff.jewel().offsetZ = range * (instance.properties().random().nextInt(201) - 100) / 100;

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

GL11.glPopMatrix();

GL11.glDisable(GL11.GL_CULL_FACE);

GL11.glDisable(GL11.GL_BLEND);

 

 

 

I'm sure someone will point out there is a more efficient way to draw it and that would be appreciated, but my main interest is why does the jewel render bouncing around in a mob's hand, but doesn't even render in mine?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Hi

 

My first guess would be that it's drawing somewhere offscreen or underground where you can't see it, i.e. the origin is in a different spot.  One of these days I plan to systematically go through and figure out the origin for each place in the code you might want to render.  (But not today).  Sometimes it's the player's eyes, sometimes it's their hand.

 

This link might be a bit of help for 1st and 3rd person rendering, it's 1.6.4 but still mostly relevant

http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html

See the sections on Item Rendering

 

-TGG

Posted

I'll do that and see what I find, but I'm struggling with that being the cause.

 

Also, this worked perfectly on 1.6.4.  Didn't change anything.

 

Why would it work perfect in the mobs hand but not mine in 3rd?  It is basically using the same reference at that point, isn't it?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Hmmm

 

In that case, yeah it's unlikely to be the problem.

 

This class might be of interest to you

https://github.com/TheGreyGhost/SpeedyTools/blob/Working/src/speedytools/common/Utilities/OpenGLdebugging.java

 

I've used it in the past to check what the OpenGL settings are; it's not complete, but dumpAllIsEnabled() works and has showed up problems for me before- dump for a good render, dump for a bad render, and spot the difference.

 

Apart from that I'm clueless, sorry!

 

-TGG

Posted

I'll give that a shot and see if anything jumps out.

 

Thank you for the advice.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

New Twist, but it sorta makes sense.

 

Its not only if a mob is holding the item that the moving render works, its if another player is holding it as well.

 

The only time, it doesn't work right is if you are holding it.

Long time Bukkit & Forge Programmer

Happy to try and help

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.