User Tools

Site Tools


tutorial:blocks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:blocks [2019/12/21 08:46] – [Creating a Block class] bitmantutorial:blocks [2020/03/30 17:35] – [Creating a Block class] liach
Line 138: Line 138:
 </code> </code>
  
-Just like we did in the item tutorial, you can override methods in the block class for custom functionality. Say you want your block to be transparent:+Just like we did in the item tutorial, you can override methods in the block class for custom functionality. 
 + 
 +If you want your block to be transparent, in your client mod initializer code, do: 
 +<code java> 
 +    BlockRenderLayerMap.putBlock(/* your block */, RenderLayer.getTranslucent()); 
 +</code> 
 + 
 +In versions before 1.15/Blaze3D, you override a method in Block class instead:
  
 <code java> <code java>
     @Environment(EnvType.CLIENT)     @Environment(EnvType.CLIENT)
 +    @Override
     public BlockRenderLayer getRenderLayer() {     public BlockRenderLayer getRenderLayer() {
         return BlockRenderLayer.TRANSLUCENT;         return BlockRenderLayer.TRANSLUCENT;
Line 184: Line 192:
 [[tutorial:blockstate|Adding simple state to a block, like ints and booleans]].  [[tutorial:blockstate|Adding simple state to a block, like ints and booleans]]. 
  
-[[tutorial:blockentity|Giving blocks a block entity so they can have advanced state like inventories and classes]]. Also needed for many things like GUI and custom block rendering.+[[tutorial:blockentity|Giving blocks a block entity so they can have advanced state like inventories]]. Also needed for many things like GUI and custom block rendering.
tutorial/blocks.txt · Last modified: 2024/04/15 01:52 by solidblock