Continue mapping migration

This commit is contained in:
Aleksey 2021-04-12 21:38:22 +03:00
parent 99ade39404
commit f03fd03bd0
499 changed files with 12567 additions and 12723 deletions

View file

@ -1,7 +1,6 @@
package ru.betterend.world.features;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.WorldGenLevel;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
@ -11,25 +10,24 @@ import ru.betterend.util.MHelper;
public class BlueVineFeature extends ScatterFeature {
private boolean small;
public BlueVineFeature() {
super(5);
}
@Override
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
float d = MHelper.length(center.getX() - blockPos.getX(), center.getZ() - blockPos.getZ()) / radius * 0.6F
+ random.nextFloat() * 0.4F;
float d = MHelper.length(center.getX() - blockPos.getX(), center.getZ() - blockPos.getZ()) / radius * 0.6F + random.nextFloat() * 0.4F;
small = d > 0.5F;
return EndBlocks.BLUE_VINE_SEED.canPlaceAt(AIR, world, blockPos);
return EndBlocks.BLUE_VINE_SEED.canSurvive(AIR, world, blockPos);
}
@Override
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
public void generate(WorldGenLevel world, Random random, BlockPos blockPos) {
if (small) {
BlocksHelper.setWithoutUpdate(world, blockPos,
EndBlocks.BLUE_VINE_SEED.defaultBlockState().with(EndPlantWithAgeBlock.AGE, random.nextInt(4)));
} else {
BlocksHelper.setWithoutUpdate(world, blockPos, EndBlocks.BLUE_VINE_SEED.defaultBlockState().setValue(EndPlantWithAgeBlock.AGE, random.nextInt(4)));
}
else {
EndPlantWithAgeBlock seed = ((EndPlantWithAgeBlock) EndBlocks.BLUE_VINE_SEED);
seed.growAdult(world, random, blockPos);
}