Jump to content

[1.7.10] Help! Weird entity rendering bug.


Cleverpanda

Recommended Posts

Okay, here's my problem. Basically my entity will "jump" up a block when any of these happen: Touched by arrow, player, thrown item, eggs, or snowballs. Basically, when any other entity touches it. I've been trying to fix this for a few weeks now with no success. All I can tell is that its a rendering problem because the hit box stays in the correct spot. The entity is supposed to be a totem of sorts that attracts passive mobs and should be collideable and immovable. Here's a few classes: My Entity- http://pastebin.com/Anv6ufp8 Renderer- http://pastebin.com/L0mzjW3Y Model- http://pastebin.com/77PWYkR1 I think it might be my glTranslated line in the renderer but that needs to be there to offset the model correctly. I'm not sure.

 

Any ideas guys?

Link to comment
Share on other sites

Hi

 

Your render code looks ok to me.  That symptom is weird, I'm not sure what might be causing it.

 

I'd suggest trying something to narrow it down a bit:

Add

System.out.println("render at [x,y,z] = [" + p_76986_2_ + "," + p_76986_4_ + ", " + p_76986_6_+"]");

to your doRender.

 

Then watch what happens when you throw a snowball at it.

 

-TGG

Link to comment
Share on other sites

Okay so I added that and I found that those variables change when I walk around. I think the values it's reporting are the entity position relative to me. I also added a print statement in onCollideWithPlayer in my entity class.

 

Here's some results. Iv'e removed a bunch of lines with insignificant changes for legibility.

 

When I was moving around and towards it.

render at [x,y,z] = [-0.0688205783826561,-0.6200000047683716, 1.8603158817116423]
render at [x,y,z] = [-0.06856183817012607,-0.6200000047683716, 1.9326404313910075]
render at [x,y,z] = [-0.06830309795759604,-0.6200000047683716, 2.0049649810703727]
render at [x,y,z] = [-0.06556813480119672,-1.6200000047683716, 2.735793783717895]
//Big cut out 
render at [x,y,z] = [0.14993124868499308,-1.6200000047683716, 2.6901420373826]
render at [x,y,z] = [0.1494137597773033,-1.6200000047683716, 2.616952694172994]
render at [x,y,z] = [0.14891149117158875,-1.6200000047683716, 2.5169638530804264]
render at [x,y,z] = [0.1484092225658742,-1.6200000047683716, 2.404049388770545]
render at [x,y,z] = [0.14789173365818442,-1.6200000047683716, 2.279212722030593]
render at [x,y,z] = [0.14737424479574202,-1.6200000047683716, 2.1454823556259157]
render at [x,y,z] = [0.1468719761446664,-1.6200000047683716, 2.0116582882938587]
COLLIDED WITH PLAYER
render at [x,y,z] = [0.14636970753895184,-1.6200000047683716, 1.875531413200008]
render at [x,y,z] = [0.14585221867662312,-1.6200000047683716, 1.7326454368743498]
render at [x,y,z] = [0.1468719761446664,-1.6200000047683716, 2.0116582882938587]
COLLIDED WITH PLAYER
render at [x,y,z] = [0.14636970753895184,-1.6200000047683716, 1.875531413200008]
render at [x,y,z] = [0.14585221867662312,-1.6200000047683716, 1.7326454368743498]

 

When I hit it with a snowball. I opened the main menu right as the glitch occurred.

render at [x,y,z] = [-1.0521818682104822,-1.6200000047683716, 3.2085209891840236]
[21:44:55] [server thread/INFO]: Saving and pausing game...
[21:44:55] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
render at [x,y,z] = [-1.0521818682104822,-0.6200000047683716, 3.2085209891840236]
render at [x,y,z] = [-1.0521818682104822,-0.6200000047683716, 3.2085209891840236]

Link to comment
Share on other sites

Hmmm

 

well it's for sure not your renderer.

 

My guess is that the collision is causing your entity's position to be updated.  You could confirm that by adding a System.out.println of the entity position to the onUpdate() method, posX, posY, posZ.

Maybe you are using the collision boxes wrongly - eg vanilla uses this method below for all Entities except boats and Minecarts, so maybe yours should return null as well.

 

    /**
     * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
     * pushable on contact, like boats or minecarts.
     */
    public AxisAlignedBB getCollisionBox(Entity p_70114_1_)
    {
        return null;
    }

 

-TGG

 

Link to comment
Share on other sites

Thanks guys! A combination of both of those seems to have fixed the jumping problem. And my hit box lines up in the Y direction. I guess that method is for rigid bodies that are supposed to be affected when they collide. My only problem now is that arrows bounce off the sides when I shoot at it and get stuck in the top and do the glitchy dance.

Link to comment
Share on other sites

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.