Compare commits
2 commits
85bc6293b1
...
f13546e9b4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f13546e9b4 | ||
![]() |
5dd5d23221 |
2 changed files with 51 additions and 2 deletions
|
@ -4,6 +4,7 @@ import fr.sushi.charmsnfabrics.common.entities.block.FloralWorkstationBlockEntit
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
|
@ -13,17 +14,33 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class FloralWorkstation extends Block implements EntityBlock
|
||||
{
|
||||
public static final EnumProperty<Direction> FACING =
|
||||
HorizontalDirectionalBlock.FACING;
|
||||
|
||||
private static final VoxelShape LEGS =
|
||||
Shapes.or(Block.box(1.0, 0.0, 1.0, 3.0, 12.0, 3.0),
|
||||
Block.box(1.0, 0.0, 13.0, 3.0, 12.0, 15.0),
|
||||
Block.box(13.0, 0.0, 13.0, 15.0, 12.0, 15.0),
|
||||
Block.box(13.0, 0.0, 1.0, 15.0, 12.0, 3.0));
|
||||
private static final VoxelShape TABLE = Block.column(16.0, 12.0, 14.0);
|
||||
private static final VoxelShape SUPPORT = Block.column(12.0, 2.0, 3.0);
|
||||
private static final Map<Direction.Axis, VoxelShape> SHAPES =
|
||||
Shapes.rotateHorizontalAxis(Shapes.or(LEGS, TABLE, SUPPORT));
|
||||
|
||||
public FloralWorkstation(BlockBehaviour.Properties properties)
|
||||
{
|
||||
super(properties);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH));
|
||||
this.registerDefaultState(
|
||||
this.stateDefinition.any().setValue(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,6 +63,13 @@ public class FloralWorkstation extends Block implements EntityBlock
|
|||
return state.setValue(FACING, rot.rotate(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected VoxelShape getShape(BlockState state, BlockGetter level,
|
||||
BlockPos pos, CollisionContext context)
|
||||
{
|
||||
return SHAPES.get(state.getValue(FACING).getAxis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable BlockEntity newBlockEntity(BlockPos pos, BlockState state)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"format_version": "1.21.6",
|
||||
"credit": "Made with Blockbench",
|
||||
"texture_size": [64, 64],
|
||||
"render_type": "minecraft:cutout",
|
||||
"render_type": "minecraft:cutout_mipped",
|
||||
"textures": {
|
||||
"0": "charmsnfabrics:block/floral_workstation",
|
||||
"particle": "minecraft:block/oak_planks"
|
||||
|
@ -153,6 +153,31 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"ground": {
|
||||
"translation": [0, 2, 0],
|
||||
"scale": [0.25, 0.25, 0.25]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [30, 45, 0],
|
||||
"scale": [0.625, 0.625, 0.625]
|
||||
},
|
||||
"head": {
|
||||
"translation": [0, 1, 0]
|
||||
}
|
||||
},
|
||||
"groups": [
|
||||
{
|
||||
"name": "legs",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue