tutorial:directionalblock
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:directionalblock [2019/12/22 09:02] – created bitman | tutorial:directionalblock [2022/01/31 01:23] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Directional | + | ====== Making a Directional |
Line 5: | Line 5: | ||
This example describes a vertical version of the andesite slab. | This example describes a vertical version of the andesite slab. | ||
- | < | + | {{: |
- | public class PolishedAndesiteSideBlock extends HorizontalFacingBlock | + | |
- | public | + | <code java> |
+ | public | ||
+ | |||
+ | public VerticalSlabBlock(Settings settings) { | ||
super(settings); | super(settings); | ||
setDefaultState(this.stateManager.getDefaultState().with(Properties.HORIZONTAL_FACING, | setDefaultState(this.stateManager.getDefaultState().with(Properties.HORIZONTAL_FACING, | ||
Line 19: | Line 21: | ||
@Override | @Override | ||
- | public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, EntityContext | + | public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext |
Direction dir = state.get(FACING); | Direction dir = state.get(FACING); | ||
switch(dir) { | switch(dir) { | ||
Line 35: | Line 37: | ||
} | } | ||
+ | @Override | ||
public BlockState getPlacementState(ItemPlacementContext ctx) { | public BlockState getPlacementState(ItemPlacementContext ctx) { | ||
- | return (BlockState)this.getDefaultState().with(FACING, ctx.getPlayerFacing()); | + | return (BlockState)this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getPlayerFacing().getOpposite()); |
} | } | ||
Line 43: | Line 46: | ||
- | ==== Defining Blockstate ==== | + | ===== Defining Blockstate |
- | polished_andesite_side_block.json | + | <code javascript src/ |
- | <code> | + | |
{ | { | ||
" | " | ||
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
} | } | ||
} | } | ||
Line 58: | Line 60: | ||
- | ==== Defining Block Models ==== | + | ===== Defining Block Models |
- | side.json | + | <code javascript src/ |
- | <code> | + | |
{ " | { " | ||
" | " | ||
Line 71: | Line 72: | ||
" | " | ||
" | " | ||
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
" | " | ||
" | " | ||
Line 83: | Line 84: | ||
</ | </ | ||
- | polished_andesite_side_block.json | + | <code javascript src/ |
- | <code> | + | |
{ | { | ||
- | " | + | " |
" | " | ||
" | " | ||
Line 94: | Line 94: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== Defining rotation and mirroring of blocks ===== | ||
+ | For directional blocks, you may have to override '' |
tutorial/directionalblock.txt · Last modified: 2023/09/26 05:43 by poopooracoocoo