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 [2020/01/17 13:42] – 1.14 fixes juuz | tutorial:blockappearance [2022/08/12 13:08] – fix typo juuz | ||
---|---|---|---|
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: | ||
+ | |||
===== Making a block transparent ===== | ===== Making a block transparent ===== | ||
You may have noticed that even if your block' | You may have noticed that even if your block' | ||
- | To fix this, override | + | To fix this, you need to set your block's render layer to cutout or transparent. |
+ | |||
+ | 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> | <code java> | ||
class MyBlock extends Block { | class MyBlock extends Block { | ||
- | | + | public |
- | | + | |
- | | + | |
} | } | ||
Line 15: | Line 25: | ||
</ | </ | ||
- | You probably also want to make your block transparent. To do that, use the '' | + | If you do not mark your block as non-opaque like this, then block faces behind |
- | <code java> | + | |
- | class MyBlock extends Block { | + | |
- | | + | |
- | MaterialColor.AIR, | + | |
- | false, // isLiquid, | + | |
- | false, // isSolid, | + | |
- | true, // blocksMovement, | + | |
- | false, // blocksLight, | + | |
- | true, // !requiresTool, | + | |
- | false, // burnable, | + | |
- | false, // replaceable, | + | |
- | PistonBehavior.NORMAL // pistonBehavior | + | |
- | ); | + | |
- | public MyBlock() { | + | Be sure to add your client entrypoint to fabric.mod.json. |
- | super(Settings.of(MY_MATERIAL)); | + | You can do this like so: |
- | } | + | <code json> |
- | + | ||
- | [...] | + | |
- | } | + | |
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | ] | ||
+ | }, | ||
</ | </ | ||
+ | Note: For non-transparent blocks that are not full, you may have to override the '' | ||
===== Making a block invisible ===== | ===== Making a block invisible ===== | ||
First we need to make the block appear invisible. | First we need to make the block appear invisible. | ||
Line 53: | Line 56: | ||
@Override | @Override | ||
public VoxelShape getOutlineShape(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityContext entityContext) { | public VoxelShape getOutlineShape(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityContext entityContext) { | ||
- | | + | |
} | } | ||
</ | </ |
tutorial/blockappearance.txt · Last modified: 2024/02/05 16:03 by haykam