Removed color provider

This commit is contained in:
paulevsGitch 2021-07-10 16:25:34 +03:00
parent 2c8862a37b
commit 4040597a6d
475 changed files with 5411 additions and 7521 deletions

View file

@ -53,7 +53,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
public static final EnumProperty<CactusBottom> CACTUS_BOTTOM = EndBlockProperties.CACTUS_BOTTOM;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final DirectionProperty FACING = BlockStateProperties.FACING;
private static final EnumMap<Direction, VoxelShape> BIG_SHAPES_OPEN = Maps.newEnumMap(Direction.class);
private static final EnumMap<Direction, VoxelShape> MEDIUM_SHAPES_OPEN = Maps.newEnumMap(Direction.class);
private static final EnumMap<Direction, VoxelShape> SMALL_SHAPES_OPEN = Maps.newEnumMap(Direction.class);
@ -61,17 +61,17 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
private static final EnumMap<Axis, VoxelShape> MEDIUM_SHAPES = Maps.newEnumMap(Axis.class);
private static final EnumMap<Axis, VoxelShape> SMALL_SHAPES = Maps.newEnumMap(Axis.class);
private static final int MAX_LENGTH = 12;
public NeonCactusPlantBlock() {
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15).randomTicks());
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(FACING, Direction.UP).setValue(SHAPE, TripleShape.TOP));
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateManager) {
stateManager.add(SHAPE, CACTUS_BOTTOM, WATERLOGGED, FACING);
}
@Override
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
LevelAccessor world = ctx.getLevel();
@ -90,22 +90,22 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
}
return state;
}
@Override
public BlockState rotate(BlockState state, Rotation rotation) {
return BlocksHelper.rotateHorizontal(state, rotation, FACING);
}
@Override
public BlockState mirror(BlockState state, Mirror mirror) {
return BlocksHelper.mirrorHorizontal(state, mirror, FACING);
}
@Override
public FluidState getFluidState(BlockState state) {
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
}
@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
world.getBlockTicks().scheduleTick(pos, this, 2);
@ -125,19 +125,19 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
}
return state;
}
@Override
public void tick(BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, Random random) {
if (!blockState.canSurvive(serverLevel, blockPos)) {
serverLevel.destroyBlock(blockPos, true, null, 1);
}
}
@Override
public BCLRenderLayer getRenderLayer() {
return BCLRenderLayer.CUTOUT;
}
@Override
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
TripleShape shape = state.getValue(SHAPE);
@ -157,7 +157,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
return shape == TripleShape.MIDDLE ? MEDIUM_SHAPES_OPEN.get(dir) : SMALL_SHAPES_OPEN.get(dir);
}
}
@Override
public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
Direction dir = state.getValue(FACING);
@ -165,7 +165,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
BlockState support = level.getBlockState(supportPos);
return support.is(this) || support.isFaceSturdy(level, supportPos, dir);
}
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (!this.canSurvive(state, world, pos) || random.nextInt(8) > 0) {
@ -200,11 +200,11 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
BlocksHelper.setWithoutUpdate(world, pos.relative(dir), placement);
mutateStem(placement, world, pos, MAX_LENGTH);
}
public void growPlant(WorldGenLevel world, BlockPos pos, Random random) {
growPlant(world, pos, random, MHelper.randRange(MAX_LENGTH >> 1, MAX_LENGTH, random));
}
public void growPlant(WorldGenLevel world, BlockPos pos, Random random, int iterations) {
BlockState state = defaultBlockState();
BlockState downState = world.getBlockState(pos.below());
@ -230,7 +230,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
}
}
}
private boolean growIteration(WorldGenLevel world, MutableBlockPos pos, Random random, List<MutableBlockPos> ends, int length) {
BlockState state = world.getBlockState(pos);
if (!state.is(this)) {
@ -264,7 +264,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
pos.move(dir);
return true;
}
private Direction getSideDirection(WorldGenLevel world, BlockPos pos, BlockState iterState, Direction dir, Random random) {
MutableBlockPos iterPos = pos.mutable();
Direction startDir = dir;
@ -286,24 +286,24 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
iterPos.move(dir);
iterState = world.getBlockState(iterPos);
}
Direction side = lastDir == null ? BlocksHelper.randomHorizontal(random) : lastDir.getClockWise();
if (side.getOpposite() == startDir) {
side = side.getOpposite();
}
return side;
}
@Override
public boolean isPathfindable(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, PathComputationType pathComputationType) {
return false;
}
@Override
public void entityInside(BlockState blockState, Level level, BlockPos blockPos, Entity entity) {
entity.hurt(DamageSource.CACTUS, 1.0F);
}
private int getLength(BlockState state, ServerLevel world, BlockPos pos, int max) {
int length = 0;
Direction dir = state.getValue(FACING).getOpposite();
@ -322,7 +322,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
}
return length;
}
private int getHorizontal(BlockState state, WorldGenLevel world, BlockPos pos, int max) {
int count = 0;
Direction dir = state.getValue(FACING).getOpposite();
@ -341,7 +341,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
}
return count;
}
private void mutateStem(BlockState state, WorldGenLevel world, BlockPos pos, int max) {
Direction dir = state.getValue(FACING).getOpposite();
MutableBlockPos mut = new MutableBlockPos().set(pos);
@ -360,34 +360,34 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
}
}
}
static {
BIG_SHAPES.put(Axis.X, Block.box(0, 2, 2, 16, 14, 14));
BIG_SHAPES.put(Axis.Y, Block.box(2, 0, 2, 14, 16, 14));
BIG_SHAPES.put(Axis.Z, Block.box(2, 2, 0, 14, 14, 16));
MEDIUM_SHAPES.put(Axis.X, Block.box(0, 3, 3, 16, 13, 13));
MEDIUM_SHAPES.put(Axis.Y, Block.box(3, 0, 3, 13, 16, 13));
MEDIUM_SHAPES.put(Axis.Z, Block.box(3, 3, 0, 13, 13, 16));
SMALL_SHAPES.put(Axis.X, Block.box(0, 4, 4, 16, 12, 12));
SMALL_SHAPES.put(Axis.Y, Block.box(4, 0, 4, 12, 16, 12));
SMALL_SHAPES.put(Axis.Z, Block.box(4, 4, 0, 12, 12, 16));
BIG_SHAPES_OPEN.put(Direction.UP, Block.box(2, 0, 2, 14, 14, 14));
BIG_SHAPES_OPEN.put(Direction.DOWN, Block.box(2, 2, 2, 14, 16, 14));
BIG_SHAPES_OPEN.put(Direction.NORTH, Block.box(2, 2, 2, 14, 14, 16));
BIG_SHAPES_OPEN.put(Direction.SOUTH, Block.box(2, 2, 0, 14, 14, 14));
BIG_SHAPES_OPEN.put(Direction.WEST, Block.box(2, 2, 2, 16, 14, 14));
BIG_SHAPES_OPEN.put(Direction.EAST, Block.box(0, 2, 2, 14, 14, 14));
MEDIUM_SHAPES_OPEN.put(Direction.UP, Block.box(3, 0, 3, 13, 13, 13));
MEDIUM_SHAPES_OPEN.put(Direction.DOWN, Block.box(3, 3, 3, 13, 16, 13));
MEDIUM_SHAPES_OPEN.put(Direction.NORTH, Block.box(3, 3, 3, 13, 13, 16));
MEDIUM_SHAPES_OPEN.put(Direction.SOUTH, Block.box(3, 3, 0, 13, 13, 13));
MEDIUM_SHAPES_OPEN.put(Direction.WEST, Block.box(3, 3, 3, 16, 13, 13));
MEDIUM_SHAPES_OPEN.put(Direction.EAST, Block.box(0, 3, 3, 13, 13, 13));
SMALL_SHAPES_OPEN.put(Direction.UP, Block.box(4, 0, 4, 12, 12, 12));
SMALL_SHAPES_OPEN.put(Direction.DOWN, Block.box(4, 4, 4, 12, 16, 12));
SMALL_SHAPES_OPEN.put(Direction.NORTH, Block.box(4, 4, 4, 12, 12, 16));