iguanaman / UndergroundBiomesBlender

Makes ores match the texture of nearby Underground Biomes stone
1 stars 0 forks source link

Idea: override block rendering instead of metadata #1

Open lawremi opened 10 years ago

lawremi commented 10 years ago

Since you left an issue for me, I thought I would throw out a suggestion ;) What about registering a custom renderer that composites the ore pattern (like the coal nodules) on top of the rendering of some adjacent block? The renderer would just look for the closest block with material == Material.stone and request it to render first, and then it would composite the ore-specific texture. Then this would even be independent of UndergroundBiomes, and there would be no metadata restriction. One concern is performance of course, but I would try it first.

iguanaman commented 10 years ago

Hey :) I have thought of doing such a thing but besides from the fact that I have no experience with renderers, there is one other issue. Checking adjacent blocks for other stone wouldn't help ore blocks within a cluster, ore surrounded by ore. At the moment those blocks check ore and stone around them and match the metadata/blockid if it finds an another ore that has already found adjacent stone.

No sure if that can be done with a customer renderer without extending the search for stone beyond just adjacent blocks. But I like the idea and would like the make the mod less "hacky" in its approach to the problem. Also, great work updating custom ore gen, I was really worried it would fall by the wayside with JRoush gone.

lawremi commented 10 years ago

The search would need to be recursive, and it would need to keep track of the visited blocks to prevent infinite recursion. This could be done by passing a set of locations down the stack, adding to it as it descends. There are probably more clever ways. This could get expensive but in most cases recursion would be unnecessary.

The rendering might be straightforward. Just call RenderBlocks.renderStandardBlock() with the stone block, and the ore's location (will need to temporarily change the meta of the ore to match that of the stone). Then call RenderBlocks.renderStandardBlock again with the ore block to render the ore nodules. There are other ways, like using RenderBlocks.setOverrideTexture.

Just want to say that I've had a lot of fun with your mods last weekend. HO makes PHC an interesting challenge, and the TC progression is creative. Looking forward to the sleeping fix for your tweaks mod ;)

ghost commented 10 years ago

Have you seen RWTema's mod? https://github.com/rwtema/DenseOres It may help a bit.