Some placeholder blocks.

This commit is contained in:
Florian Nücke
2020-10-27 15:53:46 +01:00
parent ae7c22f3bd
commit fdfd11e4a8
36 changed files with 128 additions and 24 deletions

View File

@@ -16,48 +16,35 @@ import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
import javax.annotation.Nullable;
public final class ComputerBlock extends Block {
public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING;
public final class ComputerBlock extends HorizontalBlock {
public ComputerBlock() {
super(Properties.create(Material.IRON).sound(SoundType.METAL));
setDefaultState(getStateContainer().getBaseState().with(FACING, Direction.NORTH));
setDefaultState(getStateContainer().getBaseState().with(HORIZONTAL_FACING, Direction.NORTH));
}
@Override
protected void fillStateContainer(final StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(FACING);
builder.add(HORIZONTAL_FACING);
}
@Override
public BlockState getStateForPlacement(final BlockItemUseContext context) {
return super.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
}
@Override
public BlockState rotate(final BlockState state, final IWorld world, final BlockPos pos, final Rotation direction) {
return state.with(FACING, direction.rotate(state.get(FACING)));
}
@SuppressWarnings("deprecation")
@Override
public BlockState mirror(final BlockState state, final Mirror mirrorIn) {
return state.rotate(mirrorIn.toRotation(state.get(FACING)));
return super.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite());
}
@Override