NaturesAura/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java

44 lines
1.5 KiB
Java
Raw Normal View History

2019-01-08 01:14:19 +01:00
package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter;
2019-10-20 22:30:49 +02:00
import net.minecraft.block.HorizontalBlock;
2019-01-08 01:14:19 +01:00
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
2019-10-20 22:30:49 +02:00
import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Direction;
2019-01-08 01:14:19 +01:00
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockAutoCrafter extends BlockContainerImpl {
2019-10-20 22:30:49 +02:00
public static final PropertyDirection FACING = HorizontalBlock.FACING;
2019-01-08 01:14:19 +01:00
public BlockAutoCrafter() {
super(Material.WOOD, "auto_crafter", TileEntityAutoCrafter.class, "auto_crafter");
this.setSoundType(SoundType.WOOD);
this.setHardness(1.5F);
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, FACING);
}
@Override
2019-10-20 22:30:49 +02:00
public int getMetaFromState(BlockState state) {
2019-01-08 01:14:19 +01:00
return state.getValue(FACING).getHorizontalIndex();
}
@Override
2019-10-20 22:30:49 +02:00
public BlockState getStateFromMeta(int meta) {
return this.getDefaultState().withProperty(FACING, Direction.byHorizontalIndex(meta));
2019-01-08 01:14:19 +01:00
}
@Override
2019-10-20 22:30:49 +02:00
public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) {
2019-01-08 01:14:19 +01:00
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
}
}