Code style changes, entities fixes
This commit is contained in:
parent
9d604b2d25
commit
44962e18b6
377 changed files with 5038 additions and 4914 deletions
|
@ -1,9 +1,6 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -32,28 +29,30 @@ import ru.bclib.client.render.BCLRenderLayer;
|
|||
import ru.bclib.interfaces.IRenderTyped;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlock, IRenderTyped {
|
||||
public static final EnumProperty<Direction> FACING = BlockStateProperties.FACING;
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
public static final BooleanProperty LEAF = BooleanProperty.create("leaf");
|
||||
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
||||
private static final Map<Axis, VoxelShape> SHAPES = Maps.newEnumMap(Axis.class);
|
||||
|
||||
|
||||
public EndLotusStemBlock() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS));
|
||||
this.registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(SHAPE, TripleShape.MIDDLE).setValue(LEAF, false).setValue(FACING, Direction.UP));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return state.getValue(LEAF) ? SHAPES.get(Axis.Y) : SHAPES.get(state.getValue(FACING).getAxis());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
||||
builder.add(FACING, WATERLOGGED, SHAPE, LEAF);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
|
||||
|
@ -65,7 +64,7 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
|
|||
BlockPos blockPos = ctx.getClickedPos();
|
||||
return this.defaultBlockState().setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER).setValue(FACING, ctx.getClickedFace());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockState rotate(BlockState state, Rotation rotation) {
|
||||
return BlocksHelper.rotateHorizontal(state, rotation, FACING);
|
||||
|
@ -83,12 +82,12 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
|
|||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BCLRenderLayer getRenderLayer() {
|
||||
return BCLRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
SHAPES.put(Axis.X, Block.box(0, 6, 6, 16, 10, 10));
|
||||
SHAPES.put(Axis.Y, Block.box(6, 0, 6, 10, 16, 10));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue