Posted October 2, 201312 yr So as I started modding using forge, I got started by following some tutorials. Now as I work through the tutorial that explains how to create and add blocks to the game that contain metadata (so the block has a different texture depending on the metadata value), I messed up and the textures didn't load. In the end I got it to work but while searching for an answer I found out something of which I question it's necessity. My block class has the following method: @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { System.out.println(icons[par2].getIconName()); return icons[par2]; } As it turns out, under the following conditions, this console print happened a lot as if this method got called every render: -The block was visible in the GUI (hotbar, inventory, creative tabs) -The block was on the floor as a (hovering) item (as in: not plonked down in the world) and within vision Yet it seems this method didn't need to be called at all, if the block only needed to be rendered as a block that is a part of the world instead of being an item. Now what I wonder is, why would this method have to be called so much when all it(forge?) gets from the call is a Icon object that won't change at all during the entire life-cycle? Does this have anything to do with item animations? Or could there be a optimization possible here? (Yes I know it gets called once for rendering every side of the block, I found that out by printing par1 ) edit: typo fix
October 2, 201312 yr First: If it is not placed on the world grid, it is not a block. It is an Item (ItemBlock by default) or an EntityItem. Second: It needs to be called that much, since the renderer doesn't know when the texture is going to change. Because, yes, it can change. You can return a random icon if you like.
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.