Posted August 20, 201213 yr I know how to declare a variable to a stand alone png like this: public static int WiC = ModLoader.addOverride("/terrain.png", "/Witches/WiC.png"); How would you do so for a sprite on a sprite sheet in forge? I will be using this in my custom block renderer similar to the following: renderer.overrideBlockTexture = ClientProxy.WIC; There are many pieces and therefore many times I will need to call the same or different texture. Thank you in advance for any help.
August 20, 201213 yr Author Would I simply put this in my render block class: public String getTextureFile() { return "/Witches/WitchesTerrain.png"; } then define it as such: public int WIC = 23; then call it as such: renderer.overrideBlockTexture = WIC; ? I cannot test this by itself right now as I have alot of code to rewrite still. Any constructive guidance would be much appreciated. Thank you.
August 20, 201213 yr 1) DO NOT use override texture 2) Use setTextureFile() instead of overriding getTextureFile, its cleaner. 3) You declare the INDEX of your texture by looking at your damn texture sheet. 0 is the top left, 255 is the bottom right. Fairly easy to determine from there. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 20, 201213 yr Author Thank you for your reply Just a few things though... 1) If you are refering to overrideBlockTexture it is part of the method for rendering blocks and is used as such: public static boolean renderBlockPaintedFern(Block var0, int var1, int var2, int var3, RenderBlocks var4) { var4.overrideBlockTexture = "texturelocation"; var0.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 0.2F, 0.6F); var4.renderStandardBlock(var0, var1, var2, var3); var4.overrideBlockTexture = -1; var4.overrideBlockTexture = "texturelocation"; var0.setBlockBounds(0.4F, 0.0F, 0.4F, 0.6F, 0.1F, 0.4F); var4.renderStandardBlock(var0, var1, var2, var3); var4.overrideBlockTexture = -1; . . . return true; } If you look at Minecraft's RenderBlocks class you will see further how it is used. 2) I am using getTextureFile() to retreive the texture that I am using for the above method. 3)Declaring the index of the texture is not the question. How to assign it to a variable or label for its use in the above method is. The reason for doing this is to make the code as easy to follow and understand as possible especially if I have to go back through it to change something later. I am sorry if you did not understand the question but thank you for your reply.
August 20, 201213 yr 1) I know how overrideBlockTexture works, And I know that you do not need it, you need to just implement the getTexture functions properly in your block. 3) Are you SERIOUSLY asking how to assign a value, to a variable? But, anyways, if you look into renderStandardBlock you will see that it calls block.getTexture() and uses that for it's texture index, unless you use overrideTexture, hence, using overrideTexture should not be used. It should only be used when you are hard coding it to debug things. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 21, 201213 yr Author I'm sorry you still dont seem to understand the question, but thank you again for the response. Any information is better than none.
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.