Jump to content

Recommended Posts

Posted

Hi, I'm trying to make a transparent block with an item inside. I want the item to have the same animation as a dropped item. I made the model and a tesr for it so I can render the item but I have no clue how do what I want. I tried looking into the TileEntityItemStackRenderer class to see how they are rendering the items on the ground (I believe it's the right class) and the only thing I found is this line:

 

 

            else if (block != Blocks.CHEST) net.minecraftforge.client.ForgeHooksClient.renderTileItem(itemStackIn.getItem(), itemStackIn.getMetadata());

 

 

So I went into the ForgeHooksClient class and found the above function but I couldn't find where the render is done.

 

 

An image of the block:

 

  Reveal hidden contents

 

 

 

My classes:

 

Block:

 

  Reveal hidden contents

 

 

 

TileEntitySpecialRenderer:

 

  Reveal hidden contents

 

Posted

Look at

RenderEntityItem

to see how it renders items on the ground.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Or if you want to be super lazy, create an item entity (don't spawn it) and tell the render engine to render it normally.

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

I would you do that? I created a new instance of EntityItem but how do I render it? I never did this before, sorry if it seems obvious to you.

 

 

 

  Reveal hidden contents

 

Posted

Ok so I looked at the RenderEntityItem class and tried to make something from this.

 

 

What it looks like:

  Reveal hidden contents

 

 

Tesr:

  Reveal hidden contents

 

 

Even if the apple is dark, we can see that the texture is applied. Also, I can't show you with a picture but the apple is shaking a bit. It looks like it's trying to rotate but due to the fact that the function is called every tick, the position is reset. I should be able to fix this by myself but I'm going to need help to fix the color of the apple as I don't even know where to look.

Posted

Ok, so I tried to look into the RenderEntityItem to see how they animate the entity but I couldn't find anything about the animation. Now, my item is rendering in the block but the problem is that it's shacking. It looks like the item is trying to animate but the position is reset every tick so I guess the animation is achieved by modifying the x y z but I couldn't find where the doRender function is called. Any ideas?

 

 

My code:

 

  Reveal hidden contents

 

 

 

What it looks like:

Posted

What are you trying to animate exactly the rotation or the up and down motion. Because the rotation is messing with the yaw/pitch, and the up and down can be handled using the motionY. And don't set the position every tick when you create it is when you should set it.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I'm trying to make the same animation as a dropped item, I used the exact same code as in the RenderEntityItem but the item is not spinning up and down, it's shacking like I showed you in the video. I'm trying to find a way to fix this.

Posted

The render code doesn't handle the yaw/pitch changes or the motion changes it grabs those from the EntityItem. Create the EntityItem in your TileEntity and call EntityItem.update in your TE's update method.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

So I tried to copy the update method of the EntityItem class and modify it to adapt it to my needs. I also tried to only set the position once but it didn't work, the item is following me and I don't even know why it does. I don't understand why the item is attached to the player but whatever. Also, I don't know if it's related but I can't take screenshots anymore, I'm getting an error:

 

[20:31:54] [Client thread/ERROR]: ########## GL ERROR ##########
[20:31:54] [Client thread/ERROR]: @ Pre render
[20:31:54] [Client thread/ERROR]: 1282: Invalid operation

 

My code:

 

  Reveal hidden contents

 

 

 

Screenshot:

  Reveal hidden contents

 

Posted

The entity item bobbing motion is handled by the entity's age.

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

I did what you asked me and my EntityItem is now in my TE, but that didn't fix my problem. Also, you told me to set the position only once but I can't, that's the reason the item was following me. I found out that the xyz of renderTileEntityAt are dynamic and depends on the position of the player. The animation is not working and I honestly don't know what to do now.

 

 

TESR:

 

  Reveal hidden contents

 

 

 

Tile Entity:

  Reveal hidden contents

 

EDIT: Thanks to everyone, I finally found out why the item wasn't moving: the render uses the age of the item to animate it but the age of my item wasn't updating so I just created a int and I add 1 every tick.

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.