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 [2020/01/04 16:04] – [Next Steps] Classes? jamieswhiteshirttutorial:blocks [2020/04/15 22:32] – Fixed loot table directory darthjake
Line 99: Line 99:
 ==== Adding a block loot table ==== ==== Adding a block loot table ====
  
-The block must have a loot table for any items to drop when the block is broken. Assuming you have created an item for your block and registered it using the same name as the block, the following file will produce regular block drops ''src/main/resources/data/wikitut/loot_tables/blocks/example_block.json''.+The block must have a loot table for any items to drop when the block is broken. Assuming you have created an item for your block and registered it using the same name as the block, the following file will produce regular block drops ''src/main/resources/data/tutorial/loot_tables/blocks/example_block.json''.
  
 <code JavaScript src/main/resources/data/tutorial/loot_tables/blocks/example_block.json> <code JavaScript src/main/resources/data/tutorial/loot_tables/blocks/example_block.json>
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;
tutorial/blocks.txt · Last modified: 2024/04/15 01:52 by solidblock