Start migration

This commit is contained in:
Aleksey 2021-04-08 21:55:07 +03:00
parent 6630ce0cab
commit 47ed597358
491 changed files with 12045 additions and 11953 deletions

View file

@ -2,8 +2,8 @@ package ru.betterend.world.features;
import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.Heightmap;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
@ -12,19 +12,21 @@ import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
public abstract class InvertedScatterFeature extends DefaultFeature {
private static final Mutable POS = new Mutable();
private static final MutableBlockPos POS = new MutableBlockPos();
private final int radius;
public InvertedScatterFeature(int radius) {
this.radius = radius;
}
public abstract boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius);
public abstract boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
float radius);
public abstract void generate(StructureWorldAccess world, Random random, BlockPos blockPos);
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center, DefaultFeatureConfig featureConfig) {
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
DefaultFeatureConfig featureConfig) {
int maxY = world.getTopY(Heightmap.Type.WORLD_SURFACE, center.getX(), center.getZ());
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
for (int y = maxY; y > minY; y--) {
@ -37,12 +39,13 @@ public abstract class InvertedScatterFeature extends DefaultFeature {
float theta = random.nextFloat() * MHelper.PI2;
float x = pr * (float) Math.cos(theta);
float z = pr * (float) Math.sin(theta);
POS.set(center.getX() + x, center.getY() - 7, center.getZ() + z);
int up = BlocksHelper.upRay(world, POS, 16);
if (up > 14) continue;
if (up > 14)
continue;
POS.setY(POS.getY() + up);
if (canGenerate(world, random, center, POS, r)) {
generate(world, random, POS);
}