Jump to content

[Un-solved] How are blocks rendered


Zealock

Recommended Posts

Hey, i'm looking for a way to modify blocks being rendered on a client.

 

For instance i want to make certain blocks become invisible until someone gets close, a good example of what i'm trying to do is to place a barrier on the ground and change your held item to something else until the barrier on the ground goes invisible, thats what i'm going for.

 

A few things have crossed my mind and one was using a core mod and modify the BlockBarrier.class and override the (getRenderType()) method to return a variable for dynamic modification (like when a player gets close i can set it to either 3 or -1). (i believe -1 ignores rendering, 3 renders like a normal block please confirm this :) ) 

 

Whats the best way to achieve this? I'm currently using minecraft forge 1.8.9

Edited by Zealock
Going to use TESR to achieve my goal, thanks all :)
Link to comment
Share on other sites

8 hours ago, Zealock said:

A few things have crossed my mind and one was using a core mod and modify the BlockBarrier.class and override the (getRenderType()) method to return a variable for dynamic modification (like when a player gets close i can set it to either 3 or -1). (i believe -1 ignores rendering, 3 renders like a normal block please confirm this :) )

This is a horrible idea. Bad modder, no cookie.  Core mods are not allowed here.

 

I suspect the easiest way to do what you want to do will be to use a TESR, although I don't know if it would be possible using a FastTESR, but if so, that would be better.

  • Like 1

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.

Link to comment
Share on other sites

14 hours ago, Zealock said:

core mod and modify the BlockBarrier.class

You might have missed a pillar of Forge ideology: simply extend the class, override what methods you want to change, and use this new class...

You don't HAVE to use Barrier blocks, you WANT to use something that works like Barrier blocks.
ASM is incredibly bad if you don't know what you are doing, and as time and time again has been proven by countless users in the MC modding community, unless you have a few years of expertise, chances are that you do not.
In fact, countless core-mods could do what was stated above, and look at that, no ASM needed at all.
 

To make something go invisible, a FastTESR could be used. Override getMaxRenderDistanceSquared in the TE to return the cutoff-point for (rendering->not-rendering)². Default is 4096 (64 block / 4 chunks distance)

Simple, yet effective way of turning invisible, with minimal code required.

  • Like 1

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

Got it, coremods are a no-go thanks for clearing that up :)

 

Wont using TESR for something like this become laggy if there are a lot of blocks? if so my main goal is really to just switch the texture of a block dynamically (and don't need any animation either) when a player walks too close to zones they're not allowed in yet.

 

I couldn't really find anything that suggests I can override a vanilla block which is kind of why I walked closer towards the dark arts of core mods O.o

 

I also want to keep the server vanilla, This way I can still allow vanilla clients along with an enhanced experience if people want to try out Forge.

Link to comment
Share on other sites

2 hours ago, Zealock said:

Wont using TESR for something like this become laggy if there are a lot of blocks? if so my main goal is really to just switch the texture of a block dynamically (and don't need any animation either) when a player walks too close to zones they're not allowed in yet.

Not as bad as you're thinking. You need thousands of them.  All being rendered at the same time. If the TE itself isn't ticking, it doesn't apply any impact.

2 hours ago, Zealock said:

I couldn't really find anything that suggests I can override a vanilla block which is kind of why I walked closer towards the dark arts of core mods O.o

You're not overriding a vanilla block, you're extending it.

2 hours ago, Zealock said:

I also want to keep the server vanilla, This way I can still allow vanilla clients along with an enhanced experience if people want to try out Forge.

Hahaha no.

While you could certainly tell Forge, "the client doesn't need my mod" and the client will connect, they're not going to see all the special blocks and items you've added.  This custom barrier block thing-a-jig you're making? That requires the code to exist on the client for it to work.

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.

Link to comment
Share on other sites

Quote

I also want to keep the server vanilla, This way I can still allow vanilla clients along with an enhanced experience if people want to try out Forge.

Hahaha no.

While you could certainly tell Forge, "the client doesn't need my mod" and the client will connect, they're not going to see all the special blocks and items you've added.  This custom barrier block thing-a-jig you're making? That requires the code to exist on the client for it to work.

Well, this is just an enhancement mod for a vanilla server minigame, which is why i wanted to modify Barriers and various other things on the forge client to behave differently to vanilla (who dont see them at all).

 

Ill use TESR/FastTESR, it does sound like the easiest way so far.

 

Sorry for mixing the terms overriding and extending you're right (extending the class, and overriding the methods), it was just my heads way of explaining what i was doing :P

 

Thanks for alerting me to TESR i probably would have done some unnecessary work if i didnt get told, saved me some future headaches 

 

Edited by Zealock
I submitted the response early, added the rest of the reply
Link to comment
Share on other sites

On 6/16/2017 at 11:53 PM, Zealock said:

Hey, i'm looking for a way to modify blocks being rendered on a client.

 

For instance i want to make certain blocks become invisible until...

Sounds like an X-ray cheat in the making. I'm surprised this thread hasn't been locked already.

Edited by jeffryfisher

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

26 minutes ago, jeffryfisher said:

Sounds like an X-ray cheat in the making. I'm surprised this thread hasn't been locked already.

Nah, he's trying to do something else. I think.

  • Like 1

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.

Link to comment
Share on other sites

3 hours ago, jeffryfisher said:

Sounds like an X-ray cheat in the making. I'm surprised this thread hasn't been locked already.

Quite the opposite, I'm giving barrier blocks a forcefield view/sound upon reaching close proximity.


It's an enhancement mod for a vanilla mini game I'm working on.

Link to comment
Share on other sites

So im having troubles on where to begin, i just need help getting started, i can do all the render code my self im just a little unsure on what the procedure is..

 

Is it possible to render an overlay on the barrier block using an existing block texture, such as: Rendering the overlay obsidian over the barrier using tesr?

thanks

Edited by Zealock
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.

Announcements



×
×
  • Create New...

Important Information

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