tutorial:blockappearance
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:blockappearance [2022/01/30 02:43] – [Making a block transparent] solidblock | tutorial:blockappearance [2022/08/14 04:00] – Use Yarn code blocks haykam | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Manipulating a Block' | ====== Manipulating a Block' | ||
- | //This is the 1.15+ (1.16 and 1.17 work fine too) version of this tutorial. For the 1.14 version, see [[tutorial: | + | //This is the 1.15+ (1.16, 1.17, 1.18, and 1.19 work fine too) version of this tutorial. For the 1.14 version, see [[tutorial: |
===== Making a block transparent ===== | ===== Making a block transparent ===== | ||
Line 8: | Line 8: | ||
In a [[documentation: | In a [[documentation: | ||
- | <code java> | ||
- | BlockRenderLayerMap.INSTANCE.putBlock(ExampleMod.MY_BLOCK, | ||
- | // Replace `RenderLayer.getCutout()` with `RenderLayer.getTranslucent()` if you have a translucent texture. | ||
- | </ | ||
- | You probably also want to make your block transparent. To do that, use the '' | + | < |
- | <code java> | + | BlockRenderLayerMap.INSTANCE.putBlock(ExampleMod.MY_BLOCK, |
- | class MyBlock extends | + | // Replace `class_1921.method_23581()` with `class_1921.method_23583()` if you have a translucent texture. |
+ | </ | ||
+ | |||
+ | You probably also want to make your block transparent. To do that, use the '' | ||
+ | |||
+ | <yarncode | ||
+ | class MyBlock extends | ||
public MyBlock() { | public MyBlock() { | ||
- | super(Settings.of(Material.STONE).nonOpaque()); | + | super(class_2251.of(class_3614.field_15914).method_22488()); |
} | } | ||
[...] | [...] | ||
} | } | ||
- | + | </yarncode> | |
- | </code> | + | |
If you do not mark your block as non-opaque like this, then block faces behind the block will not render and you will be able to see through the world. | If you do not mark your block as non-opaque like this, then block faces behind the block will not render and you will be able to see through the world. | ||
- | Be sure to add your client entrypoint to fabric.mod.json. | + | Be sure to add your client entrypoint to fabric.mod.json. You can do this like so: |
- | You can do this like so: | + | |
- | <code json> | + | |
+ | <code json> | ||
" | " | ||
" | " | ||
Line 41: | Line 41: | ||
</ | </ | ||
- | Note: For non-transparent blocks that are not full, you may have to ovverride | + | Note: For non-transparent blocks that are not full, you may have to override |
===== Making a block invisible ===== | ===== Making a block invisible ===== | ||
- | First we need to make the block appear invisible. | + | |
- | To do this we override '' | + | First we need to make the block appear invisible. To do this, we override '' |
- | <code java> | + | |
+ | <yarncode | ||
@Override | @Override | ||
- | public | + | public |
- | return | + | return |
} | } | ||
- | </code> | + | </yarncode> |
- | We then need to make our block unselectable by making its outline shape be non-existent. | + | |
- | So override '' | + | We then need to make our block unselectable by making its outline shape be non-existent. So override '' |
- | <code java> | + | |
+ | <yarncode | ||
@Override | @Override | ||
- | public | + | public |
- | | + | |
} | } | ||
- | </code> | + | </yarncode> |
tutorial/blockappearance.txt · Last modified: 2024/02/05 16:03 by haykam