2019-01-08 01:14:19 +01:00
|
|
|
package de.ellpeck.naturesaura.blocks;
|
|
|
|
|
2021-12-04 15:40:09 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.BlockEntityAutoCrafter;
|
2020-01-29 01:34:58 +01:00
|
|
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
|
|
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
2021-12-15 14:26:42 +01:00
|
|
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
|
|
|
import net.minecraft.world.level.block.Block;
|
|
|
|
import net.minecraft.world.level.block.SoundType;
|
|
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
import net.minecraft.world.level.block.state.StateDefinition;
|
|
|
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
|
|
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
2019-01-08 01:14:19 +01:00
|
|
|
|
2020-01-29 01:34:58 +01:00
|
|
|
public class BlockAutoCrafter extends BlockContainerImpl implements ICustomBlockState {
|
2021-12-15 14:26:42 +01:00
|
|
|
|
2019-11-04 19:08:49 +01:00
|
|
|
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
2019-01-08 01:14:19 +01:00
|
|
|
|
|
|
|
public BlockAutoCrafter() {
|
2023-07-08 12:32:27 +02:00
|
|
|
super("auto_crafter", BlockEntityAutoCrafter.class, Properties.of().strength(1.5F).sound(SoundType.WOOD));
|
2019-01-08 01:14:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 14:26:42 +01:00
|
|
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
|
|
|
super.createBlockStateDefinition(builder);
|
2022-06-27 15:24:04 +02:00
|
|
|
builder.add(BlockAutoCrafter.FACING);
|
2019-01-08 01:14:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-15 14:26:42 +01:00
|
|
|
public BlockState getStateForPlacement(BlockPlaceContext context) {
|
2022-06-27 15:24:04 +02:00
|
|
|
return super.getStateForPlacement(context).setValue(BlockAutoCrafter.FACING, context.getPlayer().getDirection());
|
2019-01-08 01:14:19 +01:00
|
|
|
}
|
2020-01-29 01:34:58 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void generateCustomBlockState(BlockStateGenerator generator) {
|
|
|
|
generator.horizontalBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
|
|
|
|
generator.modLoc("block/" + this.getBaseName()),
|
|
|
|
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
|
|
|
|
generator.modLoc("block/" + this.getBaseName() + "_top")));
|
|
|
|
}
|
2019-01-08 01:14:19 +01:00
|
|
|
}
|