BuildCraft|Core

BuildCraft|Core

7M Downloads

Help with screenshots

andrewminer opened this issue ยท 5 comments

commented

I'm the author of Crafting Guide, and I'm working on a mod to export data from the game directly for use on the website. I've run into a problem where the process I use for making screenshots just shows a magenta & black checkerboard for all facades, pipe plugs, and robots. I was hoping someone here might be able to point me in the right direction for getting things straightened out.

I get all my items by first walking the ItemRegistry's keys, fetching each item, and then checking each item for its subitems (code). Then, I have a custom instance of GuiScreen which takes over the screen, draws each item in a grid, and finally takes a screenshot (code).

The GuiScreen does a lot of set up stuff to get the OpenGL environment set up correctly, and even more to grab the pixels after things are drawn, but the code which actually tells each item to draw is just:

fontRenderer = Minecraft.getMinecraft().fontRenderer;
renderEngine = Minecraft.getMinecraft().renderEngine;
renderer = new RenderItem()
renderer.renderItemIntoGUI(fontRenderer, renderEngine, itemStack, i, j);

This works great for almost all items, but fails with just those few BuildCraft items, for a reason I can't yet figure out. I expect there's some NBT data or something I need to provide and haven't, but I'm not having any luck figuring it out so far. Can anyone point me in the right direction? Thanks!

commented

you might want to dig into the JEI code to see how that handles rendering as that renders the pipes just fine in it's overlay

commented

Unfortunately, that's where I got most of the screenshot code in the first place. I didn't think to check out their code for cataloging items, though. I'll see if that yields anything helpful.

commented

What kind of failure do you get? Do the items crash, or does nothing show up?

commented

What kind of failure do you get? Do the items crash, or does nothing show up?

For pipes I was getting the raw resource texture (i.e., a cross-hatched pattern instead of a 3D object). For robots, pipe plugs and the like, I was getting just a 2x2 magenta and black checkerboard.

commented

Actually, I just figured out the problem. When getting the rendering code for vanilla Minecraft, I ran into a problem where all the potions would render like empty bottles (i.e., no colored contents) and enchanted items wouldn't render at all (e.g., the magical golden apple would be a completely transparent image).

I never did figure out why, but replacing the call to renderItemAndEffectIntoGUI with renderItemIntoGUI did the trick, and all vanilla items rendered properly. On a hunch, I switched back to the ...AndEffect... version, and all the BuildCraft things I was having problems with rendered perfectly.

Of course, now I was back to my original set of problems, so I've added a switch which allows my rendering code to swap between using one or the other depending upon the individual item, so now it seems everything is working.