Jump to content

Recommended Posts

Posted

Hi,

 

I'm working on a mod that basically illustrates the TNT charge radius as you place it into the world. In that when you inject a TNT cube into a wall the surrounding cubes have an overlay texture on all sides that have a little explosion icon in the middle, this then signifies the blast radius of that TNT.

 

I'm struggling to navigate my way to making this happen via Forge without hijacking the actual Minecraft source code itself, in that finding the home or approach with this is a lot harder than i anticipated. I started out with just setBlockState but the trouble I have is that i'd have to make mirror copies of each block type (which i'm avoiding) ..i'd rather hook into the actual rendering process of the texture/icon for a block and just swap out the textures or overlay them with my own. That or using worldrenderer addVertexWithUV it somehow... but yeah, I'm struggling with the right or appropriate way to navigate this one.

 

Any pointers / help / example code would be greatly appreciated.

Posted

You will need a custom renderer as part of a client event handler.

If you take a look at my post here you would do something similar.  You'll want to start with the DrawBlockOutlineEvent (sp?), check for TNT in hand, if so, attempt to calculate which blocks need an overlay, then tessellate those cubes.  Do keep in mind that blocks have an explosion resistance, so the radius in dirt is a lot bigger than in stone.

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

You will need a custom renderer as part of a client event handler.

If you take a look at my post here you would do something similar.  You'll want to start with the DrawBlockOutlineEvent (sp?), check for TNT in hand, if so, attempt to calculate which blocks need an overlay, then tessellate those cubes.  Do keep in mind that blocks have an explosion resistance, so the radius in dirt is a lot bigger than in stone.

 

My hope was to somehow hook into an event where the textures get applied on a block itself pseudocode "If BlockModel.Render.Block == Blocks.Dirt && BlockPos == MyIntendedPos THEN insert custom texture...else revert back to normal registry"

 

I suspect as you pointed out that i'll probably have to just encase the existing blocks within a custom block that has a transparent overlay as its sides? (if that's how i'm interpreting your reply correctly)

 

Posted

You will need a custom renderer as part of a client event handler.

If you take a look at my post here you would do something similar.  You'll want to start with the DrawBlockOutlineEvent (sp?), check for TNT in hand, if so, attempt to calculate which blocks need an overlay, then tessellate those cubes.  Do keep in mind that blocks have an explosion resistance, so the radius in dirt is a lot bigger than in stone.

 

My hope was to somehow hook into an event where the textures get applied on a block itself pseudocode "If BlockModel.Render.Block == Blocks.Dirt && BlockPos == MyIntendedPos THEN insert custom texture...else revert back to normal registry"

 

I started looking into that last night before bed via TheyGreyGhost persons github examples but i failed to wrap my head around that logic... i can see symptoms of an answer here...

 

I mean i realise its not a "oh look instant copy paste look mah i'm shipping da mods here" moment hehehe but ...i sure hope it wasn't going to be too hard or painful without injecting hacks into the actual Minecraft client source (which then immediately negates it from being a mod to a whole client / version of mc download)...

 

I suspect as you pointed out that i'll probably have to just encase the existing blocks within a custom block that has a transparent overlay as its sides? (if that's how i'm interpreting your reply correctly)

Posted
My hope was to somehow hook into an event where the textures get applied on a block itself pseudocode "If BlockModel.Render.Block == Blocks.Dirt && BlockPos == MyIntendedPos THEN insert custom texture...else revert back to normal registry"

 

That is, unfortunately, not how textures or rendering works.

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.

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.