Jump to content

Shutdown normal rendering system


Reika

Recommended Posts

I am making a machine that needs to fundamentally change the way the world is rendered, from the normal textured quads to my own system. All of it is done except one last part - I need to disable the default system on demand, without editing base classes. Digging through Minecraft, WorldRenderer, RenderGlobal, and RenderBlocks provide no insight.

How would I go about disabling the rendering of blocks on command?

 

Clarification: I want absolute, total nothingness in terms of block rendering, but still want entity, particle, and sky rendering. I need it to look like this (white points are my own):

5PqmHEb.png

Link to comment
Share on other sites

Use ASM - insert "if(MyMod.doRenderBlocks)" to wrap "flag1 |= renderblocks.renderBlockByRenderType(block, k2, i2, j2);" in WorldRenderer (to be precise, it won't be "if" but instruction, I used it just for sake of simplicity). Then change static boolean field in your mod class whenever you want to turn it on/off and you're done.

 

Test of hook's position:

y37qry7jxty7m5c6g.jpg

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

just appending to mmn's solution (he did all the work), you should subscirbe to the net.minecraftforge.client.event.DrawBlockHighlightEvent and set it to cancelled to remove the outlining of blocks, will give the illusion that they aren't there

I think its my java of the variables.

Link to comment
Share on other sites

Use ASM - insert "if(MyMod.doRenderBlocks)" to wrap "flag1 |= renderblocks.renderBlockByRenderType(block, k2, i2, j2);" in WorldRenderer (to be precise, it won't be "if" but instruction, I used it just for sake of simplicity). Then change static boolean field in your mod class whenever you want to turn it on/off and you're done.

You will need to explain that in more depth - what is ASM? And you say "insert "if(MyMod.doRenderBlocks)" to wrap ... in WorldRenderer" - does that not mean editing base classes?

Also, what if I need it done non-statically, i.e., controlled by object variables?

 

you should subscirbe to the net.minecraftforge.client.event.DrawBlockHighlightEvent and set it to cancelled to remove the outlining of blocks, will give the illusion that they aren't there

Like the above, I need elaboration. What do you mean by "subscribe to"?

Link to comment
Share on other sites

No ASM is not editing base classes per say, it is manipulating the bytecode at run time, injecting, removing, chaging values and whatnot... I've had little to no use for it, and default to reflection when i could use it, so mnn would have to help you with the how-

 

and by subscribe I mean

boolean shouldBlocksRender = true;
@ForgeSubscribe
public void renderCanceler(DrawBlockHighlightEvent e){
e.setCanceled(shouldBlocksRender);
}

and then register the class to the Event Bus

I think its my java of the variables.

Link to comment
Share on other sites

No ASM is not editing base classes per say, it is manipulating the bytecode at run time, injecting, removing, chaging values and whatnot... I've had little to no use for it, and default to reflection when i could use it, so mnn would have to help you with the how-

 

and by subscribe I mean

boolean shouldBlocksRender = true;
@ForgeSubscribe
public void renderCanceler(DrawBlockHighlightEvent e){
e.setCanceled(shouldBlocksRender);
}

and then register the class to the Event Bus

 

Again both of these seem beyond my capability. Are these very advanced topics?

Link to comment
Share on other sites

It's quite advanced stuff (and I'm still noob at it myself :D). If you use asmifier tool you don't even need to know too much about java bytecode. If you go the ASM way expect a lot of time spent reading and experimenting. I honestly don't think you have much choices left - IMO it's either editing directly base classes or in a runtime...

 

some links:

http://asm.ow2.org/

http://download.forge.objectweb.org/asm/asm4-guide.pdf

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

It's quite advanced stuff (and I'm still noob at it myself :D). If you use asmifier tool you don't even need to know too much about java bytecode. If you go the ASM way expect a lot of time spent reading and experimenting. I honestly don't think you have much choices left - IMO it's either editing directly base classes or in a runtime...

 

some links:

http://asm.ow2.org/

http://download.forge.objectweb.org/asm/asm4-guide.pdf

 

Or I may just say "Screw it" and decide to render through the terrain instead...

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.



×
×
  • Create New...

Important Information

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