I need the ability to render any given block or item partially transparent in some of my GUI's. My intention is that when items are put in certain slots of a container, other "ghost" items will show up in other slots, showing the player what needs to be put in those slots. This was originally done by having a subclass of RenderItem, which was instantiated in each GUI object, but now I can't do that because the new constructor requires access to certain private fields (which have no getters).
This feature had to be completely removed in my update to 1.8 because of the big changes in the game's rendering engine. Now I have to re-implement it, and I have no idea where to start. What's the "right" way to do this?
If you want an itemblock, you set the item model's parent to the model of the block it is related to. If that's partially transparent your item will be too. If you want a unique item model, I'm pretty sure that you can design it partially transparent and it will render as such without you needing to do anything else. If you don't know about making json files, greyminecraftcoder.blogspot.co.uk has got your back.
I have made an unofficial port of the spectacular ExRollerCoaster mod, updated for Minecraft 1.12.2.
Build wonderful roller coasters which can go in ANY direction, and the camera will twist and turn with you.
I'm not releasing it through the usual channels but I hope four years on this site makes me a trustworthy modder.
Links:
If you want an itemblock, you set the item model's parent to the model of the block it is related to. If that's partially transparent your item will be too. If you want a unique item model, I'm pretty sure that you can design it partially transparent and it will render as such without you needing to do anything else. If you don't know about making json files, greyminecraftcoder.blogspot.co.uk has got your back.
You misunderstood. I am trying to get a GUI to be able to render any given item or block as partially transparent, so that the when the player puts an item into a certain slot of a certain GUI, other slots in the GUI show the blocks and items (and amounts) needed for the operation to be complete. When the items are put into those slots, the GUI no longer renders the partially transparent one for that slot.
I you can figure out how to make this affect a smaller area of the screen (Probably by changing the values of k and i) and get it to appear where you want, this should serve your purposes. Sorry I can't be of more help, but I'm not experienced in the more complicated parts of modding.
Nope. I tried to implement a simple 1.8-ified version of that for testing, but it seems to crash on startup. Catching the exceptions showed me that they occur nonstop every frame.
I have a version that works just fine in 1.8, but it needs the direct path of the image file, how good are you at making code to read JSON files? All the 1.8 version needs is a way to get the texture names, in 1.7.10 they are hardcoded and you can get them with getIconIndex(), in 1.8 they are in the .json files. I'm currently trying to find the code Minecraft uses to read the texture name so I can use that.
Rollback Post to RevisionRollBack
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
I have a version that works just fine in 1.8, but it needs the direct path of the image file, how good are you at making code to read JSON files? All the 1.8 version needs is a way to get the texture names, in 1.7.10 they are hardcoded and you can get them with getIconIndex(), in 1.8 they are in the .json files. I'm currently trying to find the code Minecraft uses to read the texture name so I can use that.
I'm pretty sure Minecraft uses the gson library to convert JSON text. I'm not familiar with gson, but I've used JSON libraries in .NET before.
The problem with the system you're describing for me is that it seems like it will not be able to render blocks the same way as they are rendered in the inventory (though transparent), only block face textures. I might go with rendering the items using the default RenderItem to render the required items next to the slots in the GUI, instead of on them. I'll need to reposition the slots on the GUI first though.
I'm intending to use the same methods that minecraft uses to read the .json files and create the textures, so the blocks should render isometrically instead of as block faces.
Rollback Post to RevisionRollBack
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
I'm intending to use the same methods that minecraft uses to read the .json files and create the textures, so the blocks should render isometrically instead of as block faces.
OK. Which class(es) should I look into? RenderItem probably is one of them.
RenderItem doesn't seem to contain what we are looking for, but net.minecraft.client.renderer.block.model.ItemModelGenerator's makeItemModel method seems promising.
RenderItem doesn't seem to contain what we are looking for, but net.minecraft.client.renderer.block.model.ItemModelGenerator's makeItemModel method seems promising.
Sorry, I've been busy these past couple months with school, but I have no idea how to use ItemModelGenerator.makeItemModel().
I found a better way, one that I actually managed to get working.
-snip-
That bookshelf in the top left corner was rendered with RenderItem.func_180450_b(), add some GL11 and you should be able to make it transparent.
What kind of GL11 would I need? Which blend and alpha functions and flags do I use to make sure the whole item is rendered partially transparent, despite the fact that the block/item itself is not?
I know GlStateManager.color(1.0f, 1.0f, 1.0f, OPACITY_LEVEL); won't work, since the rendering function probably changes the color for each face when rendering.
I'm bumping this since my issue is still unresolved, and I don't know enough about GL code to make a normally non-transparent item or block render as partially transparent. Does anybody else know how to do this, if it is even possible?
There are multiple ways that could work, one is blending in two passes using the
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) , another way would be to make a new texture with modified alpha channels on every pixel and then displaying that.
Maybe you could take a look at this page but I don't know anything about that function
My understanding is that GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA are used for rendering an already partially transparent texture as such.
As for replacing things pixel-by-pixel, how would this work with items with custom models? What about blocks? They're not rendered as a 2D image, and I don't even think items are rendered that way anymore in 1.8.
I need the ability to render any given block or item partially transparent in some of my GUI's. My intention is that when items are put in certain slots of a container, other "ghost" items will show up in other slots, showing the player what needs to be put in those slots. This was originally done by having a subclass of RenderItem, which was instantiated in each GUI object, but now I can't do that because the new constructor requires access to certain private fields (which have no getters).
This feature had to be completely removed in my update to 1.8 because of the big changes in the game's rendering engine. Now I have to re-implement it, and I have no idea where to start. What's the "right" way to do this?
If you want an itemblock, you set the item model's parent to the model of the block it is related to. If that's partially transparent your item will be too. If you want a unique item model, I'm pretty sure that you can design it partially transparent and it will render as such without you needing to do anything else. If you don't know about making json files, greyminecraftcoder.blogspot.co.uk has got your back.
I have made an unofficial port of the spectacular ExRollerCoaster mod, updated for Minecraft 1.12.2.
Build wonderful roller coasters which can go in ANY direction, and the camera will twist and turn with you.
I'm not releasing it through the usual channels but I hope four years on this site makes me a trustworthy modder.
Links:
original mod homepage
source code of my port
download mod jar here
You misunderstood. I am trying to get a GUI to be able to render any given item or block as partially transparent, so that the when the player puts an item into a certain slot of a certain GUI, other slots in the GUI show the blocks and items (and amounts) needed for the operation to be complete. When the items are put into those slots, the GUI no longer renders the partially transparent one for that slot.
Maybe GL11 can help, I know it can manipulate alpha channels which store the transparency.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
What functions and flags do I use for that? Where in the RenderItem class (which my rendering class is a subclass of) do I call those methods?
Here is some slightly modified code from minecraft's source code.
I you can figure out how to make this affect a smaller area of the screen (Probably by changing the values of k and i) and get it to appear where you want, this should serve your purposes. Sorry I can't be of more help, but I'm not experienced in the more complicated parts of modding.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
Oops didn't realize this was for 1.8.
Take a look at the code in this GitHub repo. It does this:
It can be easily modified to do what you want.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
Nope. I tried to implement a simple 1.8-ified version of that for testing, but it seems to crash on startup. Catching the exceptions showed me that they occur nonstop every frame.
I have a version that works just fine in 1.8, but it needs the direct path of the image file, how good are you at making code to read JSON files? All the 1.8 version needs is a way to get the texture names, in 1.7.10 they are hardcoded and you can get them with getIconIndex(), in 1.8 they are in the .json files. I'm currently trying to find the code Minecraft uses to read the texture name so I can use that.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
I'm pretty sure Minecraft uses the gson library to convert JSON text. I'm not familiar with gson, but I've used JSON libraries in .NET before.
The problem with the system you're describing for me is that it seems like it will not be able to render blocks the same way as they are rendered in the inventory (though transparent), only block face textures. I might go with rendering the items using the default RenderItem to render the required items next to the slots in the GUI, instead of on them. I'll need to reposition the slots on the GUI first though.
I'm intending to use the same methods that minecraft uses to read the .json files and create the textures, so the blocks should render isometrically instead of as block faces.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
OK. Which class(es) should I look into? RenderItem probably is one of them.
RenderItem doesn't seem to contain what we are looking for, but net.minecraft.client.renderer.block.model.ItemModelGenerator's makeItemModel method seems promising.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
Sorry, I've been busy these past couple months with school, but I have no idea how to use ItemModelGenerator.makeItemModel().
I found a better way, one that I actually managed to get working.
That bookshelf in the top left corner was rendered with RenderItem.func_180450_b(), add some GL11 and you should be able to make it transparent.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
What kind of GL11 would I need? Which blend and alpha functions and flags do I use to make sure the whole item is rendered partially transparent, despite the fact that the block/item itself is not?
I know GlStateManager.color(1.0f, 1.0f, 1.0f, OPACITY_LEVEL); won't work, since the rendering function probably changes the color for each face when rendering.
Unfortunately I am not skilled in GL so I'm not quite sure. I am currently investigating func_180450_b in depth.
Please don't PM me asking for help, I will just redirect you to the appropriate forum, where there are others who are far more skilled than me.
This is not the signature you are looking for.
Banners and such things
I'm bumping this since my issue is still unresolved, and I don't know enough about GL code to make a normally non-transparent item or block render as partially transparent. Does anybody else know how to do this, if it is even possible?
My understanding is that GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA are used for rendering an already partially transparent texture as such.
As for replacing things pixel-by-pixel, how would this work with items with custom models? What about blocks? They're not rendered as a 2D image, and I don't even think items are rendered that way anymore in 1.8.