mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +01:00
Fixed oats not quite growing consistently
This commit is contained in:
parent
ed22f638ae
commit
0a31fee280
1 changed files with 17 additions and 2 deletions
|
@ -103,9 +103,24 @@ public class SegmentedCropBlock extends CropBlock implements SegmentedBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||||
super.randomTick(state, world, pos, random);
|
BlockPos tip = getTip(world, pos);
|
||||||
|
BlockPos base = getRoot(world, pos);
|
||||||
|
|
||||||
|
if (base.getY() != pos.getY()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world.getBaseLightLevel(tip, 0) >= 9) {
|
||||||
|
int age = getAge(state);
|
||||||
|
if (age < getMaxAge()) {
|
||||||
|
float moisture = CropBlock.getAvailableMoisture(world.getBlockState(base).getBlock(), world, base);
|
||||||
|
if (random.nextInt((int)(25F / moisture) + 1) == 0) {
|
||||||
|
world.setBlockState(pos, withAge(age + 1), Block.NOTIFY_LISTENERS);
|
||||||
propagateGrowth(world, pos, state);
|
propagateGrowth(world, pos, state);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void propagateGrowth(World world, BlockPos pos, BlockState state) {
|
private void propagateGrowth(World world, BlockPos pos, BlockState state) {
|
||||||
int oldAge = getAge(state);
|
int oldAge = getAge(state);
|
||||||
|
|
Loading…
Reference in a new issue