2019-01-08 01:14:19 +01:00
|
|
|
package de.ellpeck.naturesaura.blocks;
|
|
|
|
|
2020-01-22 01:32:26 +01:00
|
|
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter;
|
2020-01-29 01:34:58 +01:00
|
|
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
|
|
|
import de.ellpeck.naturesaura.reg.ICustomBlockState;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.BlockState;
|
2019-01-08 01:14:19 +01:00
|
|
|
import net.minecraft.block.SoundType;
|
|
|
|
import net.minecraft.block.material.Material;
|
2019-11-04 19:08:49 +01:00
|
|
|
import net.minecraft.item.BlockItemUseContext;
|
|
|
|
import net.minecraft.state.DirectionProperty;
|
|
|
|
import net.minecraft.state.StateContainer;
|
|
|
|
import net.minecraft.state.properties.BlockStateProperties;
|
2019-01-08 01:14:19 +01:00
|
|
|
|
2020-01-29 01:34:58 +01:00
|
|
|
public class BlockAutoCrafter extends BlockContainerImpl implements ICustomBlockState {
|
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() {
|
2020-10-17 21:13:45 +02:00
|
|
|
super("auto_crafter", TileEntityAutoCrafter::new, Properties.create(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD));
|
2019-01-08 01:14:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
2020-02-05 14:30:17 +01:00
|
|
|
super.fillStateContainer(builder);
|
2019-11-04 19:08:49 +01:00
|
|
|
builder.add(FACING);
|
2019-01-08 01:14:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-11-04 19:08:49 +01:00
|
|
|
public BlockState getStateForPlacement(BlockItemUseContext context) {
|
2020-02-05 14:30:17 +01:00
|
|
|
return super.getStateForPlacement(context).with(FACING, context.getPlayer().getHorizontalFacing());
|
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
|
|
|
}
|