About

Ads Here

Kamis, 18 Juli 2013

Block Rendering

Minecraft renders Blocks in different ways depending on the type of the block (see diagram below).
  • Standard blocks (full cubes) can all be drawn the same way -i.e. using a square texture for each of the six sides.  More Info
  • Unusual blocks in vanilla minecraft (eg doors, pistons, bed, etc) are rendered using the corresponding .renderBlock#### method in RenderBlocks, for example renderBlockBed().
  • Forge has added a hook for rendering custom blocks.  If you create a new type of Block which needs special rendering, you need to define a custom renderer class for it:
  1. Create a class MyRenderer which implements ISimpleBlockRenderingHandler.  
  2. Assign it a myRenderID using RenderingRegistry.getNextAvailableRenderID()
  3. Register myRenderer with RenderingRegistry.registerBlockHandler().
  4. Ensure your myBlock.getRenderType() returns myRenderID.
  5. Put your custom rendering code in MyRenderer.renderWorldBlock().
One of the trickier parts of rendering custom blocks can be figuring out the folder where you need to place your custom icons.  For block textures this is constructed as 
{base path}/assets/{mod name}/textures/blocks/{Icon name}.png

In my case, during development this was (eg)
C:\Documents and Settings\TheGreyGhost\My Documents\IDEAprojects\ForgeCurrent\out\production\testitemrendering\assets\testitemrendering\textures\blocks\myIcon.png

Some more details here. 




Tidak ada komentar:

Posting Komentar