User Tools

Site Tools


tutorial:blockappearance

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:blockappearance [2020/01/17 13:42] – 1.14 fixes juuztutorial:blockappearance [2020/01/17 13:53] – 1.15 juuz
Line 1: Line 1:
 ====== Manipulating a Block's appearance ====== ====== Manipulating a Block's appearance ======
 +
 +//This is the 1.15 version of this tutorial. For the 1.14 version, see [[tutorial:1.14:blockappearance|Manipulating a Block's appearance (1.14)]].//
 +
 ===== Making a block transparent ===== ===== Making a block transparent =====
 You may have noticed that even if your block's texture is transparent, it still looks opaque. You may have noticed that even if your block's texture is transparent, it still looks opaque.
-To fix this, override ''getRenderLayer'' and return ''BlockRenderLayer.TRANSLUCENT'': +To fix this, you need to set your block's render layer to cutout or transparent.
-<code java> +
-class MyBlock extends Block { +
-    @Override +
-    public BlockRenderLayer getRenderLayer() { +
-        return BlockRenderLayer.TRANSLUCENT; +
-    } +
- +
-    [...+
-}+
  
 +In a client-sided mod initializer, add:
 +<code java>
 +BlockRenderLayerMap.INSTANCE.putBlock(ExampleMod.MY_BLOCK, RenderLayer.getCutout());
 +// Replace `RenderLayer.getCutout()` with `RenderLayer.getTranslucent()` if you have a translucent texture.
 </code> </code>
  
tutorial/blockappearance.txt · Last modified: 2024/02/05 16:03 by haykam