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
tutorial:blockappearance [2025/12/06 21:44] cassiancctutorial:blockappearance [2026/03/05 19:25] (current) – Mojang mappings cassiancc
Line 11: Line 11:
 //For version 1.21.5 and before:// //For version 1.21.5 and before://
 <yarncode java ExampleModClient.java> <yarncode java ExampleModClient.java>
-@Environment(EnvType.CLIENT) 
 public class ExampleModClient implements ClientModInitializer { public class ExampleModClient implements ClientModInitializer {
     public void onInitializeClient() {     public void onInitializeClient() {
         // To make some parts of the block transparent (like glass, saplings and doors):         // To make some parts of the block transparent (like glass, saplings and doors):
-        BlockRenderLayerMap.INSTANCE.putBlock(TutorialBlocks.MY_BLOCK, RenderLayer.getCutout());+        BlockRenderLayerMap.INSTANCE.putBlock(TutorialBlocks.MY_BLOCK, RenderLayer.cutout());
                  
         // To make some parts of the block translucent (like ice, stained glass and portal)         // To make some parts of the block translucent (like ice, stained glass and portal)
-        BlockRenderLayerMap.INSTANCE.putBlock(TutorialBlocks.MY_BLOCK, RenderLayer.getTranslucent());+        BlockRenderLayerMap.INSTANCE.putBlock(TutorialBlocks.MY_BLOCK, RenderLayer.translucent());
     }     }
 } }
Line 25: Line 24:
 //For version 1.21.6 and after: // //For version 1.21.6 and after: //
 <yarncode java ExampleModClient.java> <yarncode java ExampleModClient.java>
-@Environment(EnvType.CLIENT) 
 public class ExampleModClient implements ClientModInitializer { public class ExampleModClient implements ClientModInitializer {
     public void onInitializeClient() {     public void onInitializeClient() {
         // To make some parts of the block transparent (like glass, saplings and doors):         // To make some parts of the block transparent (like glass, saplings and doors):
-        BlockRenderLayerMap.putBlock(TutorialBlocks.MY_BLOCK, BlockRenderLayer.CUTOUT);+        BlockRenderLayerMap.putBlock(TutorialBlocks.MY_BLOCK, RenderType.CUTOUT);
                  
         // To make some parts of the block translucent (like ice, stained glass and portal)         // To make some parts of the block translucent (like ice, stained glass and portal)
-        BlockRenderLayerMap.putBlock(TutorialBlocks.MY_BLOCK, BlockRenderLayer.TRANSLUCENT);+        BlockRenderLayerMap.putBlock(TutorialBlocks.MY_BLOCK, RenderType.TRANSLUCENT);
     }     }
 } }
 </yarncode> </yarncode>
  
-You probably also want to make your block non-opaque. To do that, use the ''<yarn method_22488>'' method on your block settings. This will also make sides render inside.+You probably also want to make your block non-opaque. To do that, use the ''noOcclusion'' method on your block settings. This will also make sides render inside.
  
 <yarncode java> <yarncode java>
-     public static final Block MY_BLOCK = new Block(AbstractBlock.Settings.create().method_22488());+     public static final Block MY_BLOCK = new Block(BlockBehaviour.Properties.of().noOcclusion());
 </yarncode> </yarncode>
  
Line 69: Line 67:
 <yarncode java> <yarncode java>
     @Override     @Override
-    public class_2464 method_9604(class_2680 state) { +    public RenderShape getRenderShape(BlockState state) { 
-        return class_2464.field_11455;+        return RenderShape.INVISIBLE;
     }     }
 </yarncode> </yarncode>
Line 78: Line 76:
 <yarncode java> <yarncode java>
     @Override     @Override
-    public class_265 method_9530(class_2680 state, class_1922 blockView, class_2338 pos, class_3726 context) { +    public VoxelShape getShape(BlockState state, BlockGetter blockView, BlockPos pos, CollisionContext context) { 
-       return class_259.method_1073();+       return Shapes.empty();
     }     }
 </yarncode> </yarncode>
tutorial/blockappearance.txt · Last modified: 2026/03/05 19:25 by cassiancc