Jump to content

[UNSOLVED] Experts Only: Individual Block Overlay using OpenGL?


Jaspa_Jones

Recommended Posts

Hi everyone,

 

Basically I'm trying to add a texture overlay to one individual block. Not to a block class, but for example to the block located 50, 50, 50. Whatever type of block it is. My Mod should be able to be installed via a ZIP file, so no changes in original source code.

 

Example: http://www.9minecraft.net/light-level-overlay-mod/

 

--

 

 

My TickHandler:

RenderingRegistry.instance().renderWorldBlock(Minecraft.getMinecraft().renderGlobal.globalRenderBlocks, Minecraft.getMinecraft().renderGlobal.globalRenderBlocks.blockAccess, x, y, z, Block.blocksList[ Minecraft.getMinecraft().theWorld.getBlockId( x, y, z ) ], Mod.instance.blockModel );

 

RenderBlocks.java (I basically disabled normal rendering, and see no more blocks.

public boolean renderBlockByRenderType(Block par1Block, int par2, int par3, int par4)
    {/*
        int l = par1Block.getRenderType();

        if (l == -1)
        {
            return false;
        }
        else
        {
            par1Block.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4);
            this.setRenderBoundsFromBlock(par1Block);

            switch (l)
            {
                //regex: ' : \(l == ([\d]+) \?' replace: ';\ncase \1: return' ::: IMPORTANT: REMEMBER THIS ON FIRST line!
                case 0: return this.renderStandardBlock(par1Block, par2, par3, par4);
                case 4: return this.renderBlockFluids(par1Block, par2, par3, par4);
                case 31: return this.renderBlockLog(par1Block, par2, par3, par4);
                case 1: return this.renderCrossedSquares(par1Block, par2, par3, par4);
                case 2: return this.renderBlockTorch(par1Block, par2, par3, par4);
                case 20: return this.renderBlockVine(par1Block, par2, par3, par4);
                case 11: return this.renderBlockFence((BlockFence)par1Block, par2, par3, par4);
                case 39: return this.renderBlockQuartz(par1Block, par2, par3, par4);
                case 5: return this.renderBlockRedstoneWire(par1Block, par2, par3, par4);
                case 13: return this.renderBlockCactus(par1Block, par2, par3, par4);
                case 9: return this.renderBlockMinecartTrack((BlockRailBase)par1Block, par2, par3, par4);
                case 19: return this.renderBlockStem(par1Block, par2, par3, par4);
                case 23: return this.renderBlockLilyPad(par1Block, par2, par3, par4);
                case 6: return this.renderBlockCrops(par1Block, par2, par3, par4);
                case 3: return this.renderBlockFire((BlockFire)par1Block, par2, par3, par4);
                case 8: return this.renderBlockLadder(par1Block, par2, par3, par4);
                case 7: return this.renderBlockDoor(par1Block, par2, par3, par4);
                case 10: return this.renderBlockStairs((BlockStairs)par1Block, par2, par3, par4);
                case 27: return this.renderBlockDragonEgg((BlockDragonEgg)par1Block, par2, par3, par4);
                case 32: return this.renderBlockWall((BlockWall)par1Block, par2, par3, par4);
                case 12: return this.renderBlockLever(par1Block, par2, par3, par4);
                case 29: return this.renderBlockTripWireSource(par1Block, par2, par3, par4);
                case 30: return this.renderBlockTripWire(par1Block, par2, par3, par4);
                case 14: return this.renderBlockBed(par1Block, par2, par3, par4);
                case 15: return this.renderBlockRepeater((BlockRedstoneRepeater)par1Block, par2, par3, par4);
                case 36: return this.renderBlockRedstoneLogic((BlockRedstoneLogic)par1Block, par2, par3, par4);
                case 37: return this.renderBlockComparator((BlockComparator)par1Block, par2, par3, par4);
                case 16: return this.renderPistonBase(par1Block, par2, par3, par4, false);
                case 17: return this.renderPistonExtension(par1Block, par2, par3, par4, true);
                case 18: return this.renderBlockPane((BlockPane)par1Block, par2, par3, par4);
                case 21: return this.renderBlockFenceGate((BlockFenceGate)par1Block, par2, par3, par4);
                case 24: return this.renderBlockCauldron((BlockCauldron)par1Block, par2, par3, par4);
                case 33: return this.renderBlockFlowerpot((BlockFlowerPot)par1Block, par2, par3, par4);
                case 35: return this.renderBlockAnvil((BlockAnvil)par1Block, par2, par3, par4);
                case 25: return this.renderBlockBrewingStand((BlockBrewingStand)par1Block, par2, par3, par4);
                case 26: return this.renderBlockEndPortalFrame((BlockEndPortalFrame)par1Block, par2, par3, par4);
                case 28: return this.renderBlockCocoa((BlockCocoa)par1Block, par2, par3, par4);
                case 34: return this.renderBlockBeacon((BlockBeacon)par1Block, par2, par3, par4);
                case 38: return this.renderBlockHopper((BlockHopper)par1Block, par2, par3, par4);
                default: return FMLRenderAccessLibrary.renderWorldBlock(this, blockAccess, par2, par3, par4, par1Block, l);
            }
        }*/return false;

 

My BlockRenderer:

System.out.println("RENDERING WORLD BLOCK. " + x + " " + y + " " + z + " " + block + " " + modelId);
       
        //renders the basic block
        renderer.renderStandardBlock(block, x, y + 1, z);

 

It prints to the console every frame. It does not render the standard block.

 

Anyone got a clue?

 

Thanks in advance,

 

Jaspa_Jones  :D

Link to comment
Share on other sites

Are you wanting this to just always be there or are you specifically wanting it to happen when you have another block placed already? If you place a block in order to have the overlay, you could use a custom renderer on that placed block and draw your overlay from there. To make it cover the block that is there in the first place, you could set the block bounds to be just ever so slightly larger than a normal block, so it completely covers the normal block that is there already.

 

If you want it to just exist there, I can't really help you.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Link to comment
Share on other sites

thats just me but instead of disabling normal block rendering id try only rendering the text/wtv "hovering" over the block

 

like 0.01 meter higher so that you dont have intersection with the normal block

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Thank you guys for replying!

 

Well basically, I'm writing a mod that features Area Protection and I would like to highlight the protected areas in red. So I would like to make an partly transparent overlay over all the blocks that are protected. No matter what type of block they are.

 

So I do know which blocks (x, y, z) I would like to replace, but the Custom Render function in Forge is (I think) only designed to override block renderers per block type, not per individual block.

 

I would love to not use this Custom Render function and instead draw some overlay in OpenGL for example. I just don't really know where to start with this.

Link to comment
Share on other sites

not to be a dick but i think ForgeEssential is already making something similar. (as am i but thats another story)

 

suggestion: anyone correct me if its not a good idea

 

try to spawn "entities"  kinda like mobs but they dont attack have hp or wtv, they jsut render the area protection

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Yeah I know, but it's still in Alpha state and for Minecraft 1.4.7. Couldn't wait and started :)

 

That sounds complicated, but I get your idea. Do you have any experience doing things like this? Personally, I've never spawned any mobs. I've tried to stop mobs from moving once, but didn't succeed.

 

Do I need to create a custom mob for this? How can I spawn and kill a mob? And how can I remove its texture?

 

Thanks!

Link to comment
Share on other sites

I have no idea personall i do it with blocks because i want the mayor of the town to be able to change the width/height/length of a plot (plots are "protected area") 

 

i didnt know ForgeEssential was only for 147, mines 152 ready ;)

 

technicly they're not mobs, they are entities, like a higher level in hierarchy. their only point as entities is ... to exists i guess. i do knwo they is a tutorial or 2 on the wiki about this. maybe you could try spawning a custom mob and then removing the "mob" part of the mob

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

I think there will be a problem with this. I only want the client to see the protected area highlighted and not the server. Only the Major should have access to this feature of displaying protected areas.

 

The first attempt I did was replacing Block ID's client side which pretty much did the job. However, my console started throwing lots and lots of errors about wrong synchronization between client and server. That's why I would actually prefer to not change anything gameplay related. I would prefer to just like draw another block that is a little bit bigger over the other block like redria7 said using OpenGL. Wouldn't that be a bit more neat and also better?

 

If I would take that route, I just have to know how to draw a block at that particular point and then increase its size a bit. I know how to access OpenGL from Minecraft, but I don't know how to get the right position and draw a solid color cube right there.

Link to comment
Share on other sites

Tile entity my friend. A tile entity with a gui where you can alter size and... do exactly what flame is doing!

Or try the entity. Mobs, players, TE's, all of these are entities. Items on the ground are entities. Creating one wouldn't be impossible. Maybe make something similar to a spawn egg, except instead of spawning a mob, it spawns an entity that has a set size and shape and covers a large area, with no collision etc. Then your mayor can give each person one egg from creative mode, and the players can throw the egg at a location and it locks that location to them.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Link to comment
Share on other sites

no hold on, tile entities are working in MY case because this how i want the player to interact with their lands. you have to use a tool that fits YOUR needs. maybe eggs are a good idea, maybe they're not.

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

My case is very simple:

 

I simply have the locations of blocks which are protected stored. For example:

X, Y, Z

50, 50, 50

50, 51, 51

51, 50, 51

 

Then when the Mayor presses P, these protected blocks will highlight. And when he presses P again they will return to normal. The blocks stay the same, it's just the way the user sees them that changes.

Link to comment
Share on other sites

yeah but the question is, how are these blocks are selected/created, do you have to enter a command? do you have to right click them ? have you tought about air block, block placing etc etc.

 

 

 

 

 

 

 

btw the answer to "do you have to enter a command" better be no

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

*sight*

 

we have forge.... we have user interfaces...... we should be able to make mods that are 100% command free, its way more interactive and fun to interact with beautiful menu then to type

 

"/hur dur create area protected set group=admin 51, 51, 51, 100, 100, 100"

 

i know you're just using whats already there. but i think I'm getting cancer from these.

 

honestly I'm really excited to release my mod because we can finally start getting rid of those sign shop ....

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

no hold on, tile entities are working in MY case because this how i want the player to interact with their lands. you have to use a tool that fits YOUR needs. maybe eggs are a good idea, maybe they're not.

Sorry, tile entity is my thought for this on how it would work easiest. By pointing out that that's exactly what you were doing already I was (not very clearly) pointing out that that method was already being done, so using a different method would probably be a good idea.

I respect the fact that you are willing to help someone doing something similar to what you are doing when you haven't released yet. :)

I plan on going open source the moment I release, but I am trying to hide my more fun features until I release just in case someone else likes the idea and releases first. I'm a little selfish that way.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Link to comment
Share on other sites

im a bit.. special.. and very confident/positive that my mod will be one of the best in its genre.

 

But hey, we'll see in 2 month if people like what I've done.

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

plus, people here are usually very new to coding in general. they're not a threat to the popularity of my mod. IF i ahve somethign to fear. it would be people who are working in secret. (kinda like me)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

im a bit.. special.. and very confident/positive that my mod will be one of the best in its genre.

 

But hey, we'll see in 2 month if people like what I've done.

I'm pretty confident in what I've done, but I also want that reveal moment. Where I have everything finished and I get to just show everything at once. So, you know, a couple spotlighters can say "oh wow" and no one else notices and life continues as normal...

 

I don't think there is really anything to fear: I think most people go into modding because they have a specific idea in mind to start with, but I play my little games.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Link to comment
Share on other sites

you have to go out with a bang like:

 

hey i made this its new its fresh nobody has done thsi before.

 

unless you're doign somethign dull like "obsidian tools" generally people will like what you've done

 

compatibility is important too. If your mod isnt compatible with the "mainstream" mods you will have problem ;)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

I understand that you really think I shouldn't use commands. Well, I was planning to extend the Mod of course and this would be my first step into the next direction. I like to take small steps. Also, I'm not that new to programming. I'm just not that used to making Minecraft Mods (yet).

 

Now I hope my question is a bit more clear and it would be nice if someone could point me into the right direction. I've heard about TileEntities, adding Mobs, Drawing blocks over blocks, etc. I don't really know which way to go. I mean, I'd probably find out. It's just that I prefer asking for advice prior to reinventing the wheel :)

Link to comment
Share on other sites

I, uh, may have obsidian tools.

BUT

That is one of the things I did when I was learning how to mod. And I made it interesting. Kind of.

I have lots of other stuff that is part of my pack. And I plan on calling it a mini mod pack because I'll have several independent mod sections that can be turned on and off through config if someone cares enough.

Anyway, I'll let this thread continue. I've hijacked it long enough.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Link to comment
Share on other sites

I'm not that new to programming.

i wasn't necessarily referring to you, sorry :P

 

Tile Entity are basically extra information about a block, for example, sign have a tile entity that contains the text they are suppose to show

,beacon block contains information about their state (on off) and which buff they are giving

 

it is important to note that you cant place tile entities on block that dont support them, aka dirt, stone air, flower etc, etc

 

in my case i am using a new block called the plotblock. its tile entity contains the information about the width/height/length of the plot, this way i can use these information to draw a frame to visualize what are the limits that the plot owner can build in (as well as extra information like the cost of the plot etc etc)

 

the difference between using TE (tile entities) and entities is that tile entities are tied to a bloc. while entities are free to be placed anywhere.

you could technicly make an invisible entity that has information about the width/height/length of the protected area and x, y,z  and use this entity to draw a big box that represents the limit of the area.

 

for TE they're are good tutorial on the wiki about how why when to use them. as for entitiy i am not sure as i am not using them (yet).

 

@redria7, ahaha, sorry xD, but you understand what i mean?

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
  • Topics

×
×
  • Create New...

Important Information

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