This commit is contained in:
paulevsGitch 2020-10-26 00:34:04 +03:00
parent bb3a81ebb0
commit 4073e0a32c
11 changed files with 61 additions and 3 deletions

View file

@ -154,4 +154,8 @@ public class BiomeRegistry {
Identifier id = biomeRegistry.getId(biome);
return id == null ? END.getID() : id;
}
public static EndBiome getBiome(Identifier biomeID) {
return ID_MAP.getOrDefault(biomeID, END);
}
}

View file

@ -154,7 +154,7 @@ public class BlocksHelper {
Set<BlockPos> remove = Sets.newHashSet();
ends.add(POS.toImmutable());
while (!ends.isEmpty()) {
for (int i = 0; i < 128 && !ends.isEmpty(); i++) {
ends.forEach((pos) -> {
setWithoutUpdate(world, pos, AIR);
for (Direction dir: HORIZONTAL) {
@ -169,8 +169,8 @@ public class BlocksHelper {
}
remove.add(pos);
});
ends.removeAll(remove);
ends.addAll(add);
ends.removeAll(remove);
remove.clear();
add.clear();
}

View file

@ -1,6 +1,8 @@
package ru.betterend.world.biome;
import net.minecraft.block.Blocks;
import net.minecraft.entity.EntityType;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.SoundRegistry;
import ru.betterend.registry.StructureRegistry;
@ -9,6 +11,7 @@ public class BiomeCrystalMountains extends EndBiome {
public BiomeCrystalMountains() {
super(new BiomeDefinition("crystal_mountains")
.setPlantsColor(255, 133, 211)
.setSurface(BlockRegistry.CRYSTAL_MOSS, Blocks.END_STONE)
.setMusic(SoundRegistry.MUSIC_CRYSTAL_MOUNTAINS)
.addStructureFeature(StructureRegistry.MOUNTAIN)
.addFeature(FeatureRegistry.ROUND_CAVE)

View file

@ -5,6 +5,7 @@ import java.util.Random;
import com.google.common.collect.Maps;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtHelper;
@ -37,6 +38,7 @@ public class MountainPiece extends BasePiece {
private float height;
private float r2;
private Identifier biomeID;
private BlockState top;
public MountainPiece(BlockPos center, float radius, float height, int id, Biome biome) {
super(StructureRegistry.MOUNTAIN_PIECE, id);
@ -46,6 +48,7 @@ public class MountainPiece extends BasePiece {
this.r2 = radius * radius;
this.noise = new OpenSimplexNoise(MHelper.getSeed(534, center.getX(), center.getZ()));
this.biomeID = BiomeRegistry.getBiomeID(biome);
top = biome.getGenerationSettings().getSurfaceConfig().getTopMaterial();
makeBoundingBox();
}
@ -70,6 +73,7 @@ public class MountainPiece extends BasePiece {
biomeID = new Identifier(tag.getString("biome"));
r2 = radius * radius;
noise = new OpenSimplexNoise(MHelper.getSeed(534, center.getX(), center.getZ()));
top = BiomeRegistry.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceConfig().getTopMaterial();
}
@Override
@ -99,9 +103,11 @@ public class MountainPiece extends BasePiece {
maxY *= (float) noise.eval(px * 0.05, pz * 0.05) * 0.3F + 0.7F;
maxY *= (float) noise.eval(px * 0.1, pz * 0.1) * 0.1F + 0.8F;
maxY += 56;
int cover = (int) (maxY - 1);
boolean needCover = noise.eval(px * 0.3, pz * 0.3) > 0 && (noise.eval(px * 0.03, pz * 0.03) - (maxY - 60) * 0.2) > 0;
for (int y = minY; y < maxY; y++) {
pos.setY(y);
chunk.setBlockState(pos, Blocks.END_STONE.getDefaultState(), false);
chunk.setBlockState(pos, needCover && y >= cover ? top : Blocks.END_STONE.getDefaultState(), false);
}
}
}