Jump to content

Recommended Posts

Posted

Straight to the point. I'm trying to render flowers translated -0.5 on the Y axis if the flower is on top of my grass slab. What I currently have in mind is that I should probably use a drawing event and check if the flower block is being drawn and then translate the drawing start point by -0.5 and probably not cancel the event as it would then make a random XZ offset and draw the flower model. Now this the idea I have, but can someone tell me what the event I should call is called, werther it's pre- or normal drawing event and basically help me move in the right direction.

Posted

Hi

 

I don't think there is an event that fires every time a block is drawn.

 

What I'd suggest you try instead:

1) Create your own MyBlockRedFlower that extends BlockRedFlower, with an extra unlisted property called "AboveHalfSlab" or similar

2) Overwrite BlockRedFlower in the registry with your MyBlockRedFlower. 

  (see Block class - registerBlock(38, "red_flower", (new

    BlockRedFlower()).setHardness(0.0F).setSoundType(SoundType.PLANT).setUnlocalizedName("flower2"));

3) In the ModelBakeEvent, replace the red flower block model(s) with your own IBakedModel.

4) In the getActualState of your MyBlockRedFlower, check for whether the flower is above your half slab or not

5) In your IBakedModel getQuads, translate the quads depending on whether AboveHalfSlab is true or not.

 

It's pretty complicated and you would need some experience and persistence to make it work.  I think it's possible and I've done all of the individual steps but I haven't ever tried all of them working together like that.

 

This tutorial project has similar examples of the steps above - except step 2.

https://github.com/TheGreyGhost/MinecraftByExample

in particular look at mbe04

 

-TGG

 

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.