User Tools

Site Tools


tutorial:blockappearance

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:blockappearance [2019/07/25 09:06] – created fudgetutorial:blockappearance [2020/01/17 13:42] – 1.14 fixes juuz
Line 10: Line 10:
     }     }
  
-    //...+    [...]
 } }
  
Line 18: Line 18:
 <code java> <code java>
 class MyBlock extends Block { class MyBlock extends Block {
-     private static Material myMaterial = new Material( +     private static final Material MY_MATERIAL = new Material( 
-            MaterialColor.AIR,   //materialColor, +            MaterialColor.AIR, // materialColor, 
-            false,   //isLiquid,+            false, // isLiquid,
             false, // isSolid,             false, // isSolid,
             true, // blocksMovement,             true, // blocksMovement,
-            false,// blocksLight,  <----- Important part, the other parts change as you wish +            false, // blocksLight,  <----- Important part, the other parts change as you wish 
-            true,//  !requiresTool, +            true, // !requiresTool, 
-            false, //  burnable, +            false, // burnable, 
-            false,//  replaceable, +            false, // replaceable, 
-            PistonBehavior.NORMAL//  pistonBehavior+            PistonBehavior.NORMAL // pistonBehavior
     );     );
  
     public MyBlock() {     public MyBlock() {
-        super(Settings.of(myMaterial);+        super(Settings.of(MY_MATERIAL));
     }     }
  
-    //...+    [...]
 } }
  
Line 48: Line 48:
     }     }
 </code> </code>
-We then need to make our block unselectable by making its `outlineShape` be non-existent. +We then need to make our block unselectable by making its outline shape be non-existent. 
-So override ''getOutlineShape' and return an empty ''VoxelShape'':+So override ''getOutlineShape'' and return an empty ''VoxelShape'':
 <code java> <code java>
     @Override     @Override
     public VoxelShape getOutlineShape(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityContext entityContext) {     public VoxelShape getOutlineShape(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityContext entityContext) {
-       return VoxelShapes.cuboid(0,0,0,0,0,0);+       return VoxelShapes.empty;
     }     }
 </code> </code>
tutorial/blockappearance.txt · Last modified: 2024/02/05 16:03 by haykam