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);
}
}
}

View file

@ -0,0 +1,10 @@
{
"variants": {
"": [
{ "model": "betterend:block/crystal_moss" },
{ "model": "betterend:block/crystal_moss", "y": 90 },
{ "model": "betterend:block/crystal_moss", "y": 180 },
{ "model": "betterend:block/crystal_moss", "y": 270 }
]
}
}

View file

@ -0,0 +1,10 @@
{
"variants": {
"": [
{ "model": "betterend:block/crystal_moss_path" },
{ "model": "betterend:block/crystal_moss_path", "y": 90 },
{ "model": "betterend:block/crystal_moss_path", "y": 180 },
{ "model": "betterend:block/crystal_moss_path", "y": 270 }
]
}
}

View file

@ -0,0 +1,12 @@
{
"parent": "block/cube",
"textures": {
"down": "block/end_stone",
"east": "betterend:block/crystal_moss_side",
"north": "betterend:block/crystal_moss_side",
"particle": "betterend:block/crystal_moss_side",
"south": "betterend:block/crystal_moss_side",
"up": "betterend:block/crystal_moss_top",
"west": "betterend:block/crystal_moss_side"
}
}

View file

@ -0,0 +1,7 @@
{ "parent": "betterend:block/path",
"textures": {
"top": "betterend:block/crystal_moss_path_top",
"side": "betterend:block/crystal_moss_side",
"bottom": "block/end_stone"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "betterend:block/crystal_moss"
}

View file

@ -0,0 +1,3 @@
{
"parent": "betterend:block/crystal_moss_path"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB