Jump to content

Recommended Posts

Posted

I am wanting to render a block (currently held item) as if it had been placed in the world at a certain location *without* actually placing it in the world.

 

I have no problem with the currently held item and setting the location I'm just unsure the proper way to get the block's renderer?

 

I've looked at MinecraftForgeClient.getItemRenderer but there doesn't seem to be a suitable render type and I'm not too sure how to get the require data params.

I've also looked at RenderBlocks but I'm not clear on how to get the correct instance of it.

Posted

For the rendering I would try RenderBlocks.renderBlockByRenderType(...)

 

Access to the RenderBlocks instance you could get either via a CustomBlockRenderer (you would have to place a block where you would like to render stuff)

RenderingRegistry.registerBlockHandler(...);

 

Or you could try it with the RenderWorldLastEvent (access to RenderBlocks)

 

Or try this:

http://www.minecraftforge.net/forum/index.php?topic=1882.0

Posted

I'm trying RenderBlock.renderBlockByRenderType inside of a RenderWorldLastEvent but nothing renders.

 

I can't seem to see a RenderBlocks instance in RenderWorldLastEvent, I only see RenderGlobal instance?

Posted

I'm trying RenderBlock.renderBlockByRenderType inside of a RenderWorldLastEvent but nothing renders.

 

I can't seem to see a RenderBlocks instance in RenderWorldLastEvent, I only see RenderGlobal instance?

 

Sorry didn't see that

renderGlobal.renderBlocksRg

is a private field...

 

I am really not sure how you SHOULD do this but maybe hook a RenderTickEvent or RenderWorldLastEvent and then make renderBlocksRg public via reflection or something :P

I definitely think there's a different way...

Posted

I am looking at the source for WorldRenderer.updateRenderer in the hopes to shine some light on the subject.

 

It just creates a new renderer blocks with the current chunk being rendered. Some I'm pretty sure I should be okay just doing:

 

RenderBlocks renderer = new RenderBlocks(/* get player's worldobj*/);

 

Looking through it does some setting up, then calls RenderBlocks.renderBlockByRenderType. I'm going to see if I can at least imitate drawing a stone block then expand from there.

Posted

Looking through it does some setting up, then calls RenderBlocks.renderBlockByRenderType. I'm going to see if I can at least imitate drawing a stone block then expand from there.

 

Would be nice if you post your solution here, for others to see :) (including me)

Posted

Okay to my understanding what I'm intending to do it not currently possible in the current implementation of Forge.

 

It all dissolves down to ISimpleBlockRenderingHandler.renderWorldBlock for custom blocks or RenderBlocks.renderXXX for vanilla blocks.

 

These expect the block to exist at the passed position in the given IBlockAccess as they do things like world.getBlockMetadata(x, y, z). The problem with that is when the block doesn't actually exist you're not going to fetch relevant metadata.

 

I toyed with the idea of creating a fake world and setting the block at the position to the block that's wanting to be imitated so that it can get any relevant information it wants but I don't like the idea of duplicating the world.

 

I thought about making the fake world a wrapper for the real world that checks if the block being accessed is a "fake block" and so we don't duplicate the world just trick the accessor into believing the block actually exists.

 

Ultimately I'm going to stop here because a lot of the rendering code I've looked at sets textures and colours inside it's rendering method which will prevent me from doing what I wanted to do. I was hoping for a way to just get a block to populate the tessellator with vertices.

Posted

Look at the RenderFallingSand code and how it did it.

 

You can adopt the code with some changes in your block renderer.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

That uses an Entity and uses the block info of the block that's being made to fall.

 

Like I said the block doesn't exist in the world so I can't rely on renderXXX

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.