diff --git a/src/main/java/ru/betterend/registry/BiomeRegistry.java b/src/main/java/ru/betterend/registry/BiomeRegistry.java index 640b157e..ba365492 100644 --- a/src/main/java/ru/betterend/registry/BiomeRegistry.java +++ b/src/main/java/ru/betterend/registry/BiomeRegistry.java @@ -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); + } } diff --git a/src/main/java/ru/betterend/util/BlocksHelper.java b/src/main/java/ru/betterend/util/BlocksHelper.java index fac2a596..f835bdba 100644 --- a/src/main/java/ru/betterend/util/BlocksHelper.java +++ b/src/main/java/ru/betterend/util/BlocksHelper.java @@ -154,7 +154,7 @@ public class BlocksHelper { Set 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(); } diff --git a/src/main/java/ru/betterend/world/biome/BiomeCrystalMountains.java b/src/main/java/ru/betterend/world/biome/BiomeCrystalMountains.java index e6b94857..fb4584d6 100644 --- a/src/main/java/ru/betterend/world/biome/BiomeCrystalMountains.java +++ b/src/main/java/ru/betterend/world/biome/BiomeCrystalMountains.java @@ -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) diff --git a/src/main/java/ru/betterend/world/structures/piece/MountainPiece.java b/src/main/java/ru/betterend/world/structures/piece/MountainPiece.java index 736eda01..1384023b 100644 --- a/src/main/java/ru/betterend/world/structures/piece/MountainPiece.java +++ b/src/main/java/ru/betterend/world/structures/piece/MountainPiece.java @@ -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); } } } diff --git a/src/main/resources/assets/betterend/blockstates/crystal_moss.json b/src/main/resources/assets/betterend/blockstates/crystal_moss.json new file mode 100644 index 00000000..ddf93100 --- /dev/null +++ b/src/main/resources/assets/betterend/blockstates/crystal_moss.json @@ -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 } + ] + } +} diff --git a/src/main/resources/assets/betterend/blockstates/crystal_moss_path.json b/src/main/resources/assets/betterend/blockstates/crystal_moss_path.json new file mode 100644 index 00000000..2218e820 --- /dev/null +++ b/src/main/resources/assets/betterend/blockstates/crystal_moss_path.json @@ -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 } + ] + } +} diff --git a/src/main/resources/assets/betterend/models/block/crystal_moss.json b/src/main/resources/assets/betterend/models/block/crystal_moss.json new file mode 100644 index 00000000..a64db84a --- /dev/null +++ b/src/main/resources/assets/betterend/models/block/crystal_moss.json @@ -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" + } +} diff --git a/src/main/resources/assets/betterend/models/block/crystal_moss_path.json b/src/main/resources/assets/betterend/models/block/crystal_moss_path.json new file mode 100644 index 00000000..ae4d6b55 --- /dev/null +++ b/src/main/resources/assets/betterend/models/block/crystal_moss_path.json @@ -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" + } +} diff --git a/src/main/resources/assets/betterend/models/item/crystal_moss.json b/src/main/resources/assets/betterend/models/item/crystal_moss.json new file mode 100644 index 00000000..d31083f2 --- /dev/null +++ b/src/main/resources/assets/betterend/models/item/crystal_moss.json @@ -0,0 +1,3 @@ +{ + "parent": "betterend:block/crystal_moss" +} diff --git a/src/main/resources/assets/betterend/models/item/crystal_moss_path.json b/src/main/resources/assets/betterend/models/item/crystal_moss_path.json new file mode 100644 index 00000000..801db548 --- /dev/null +++ b/src/main/resources/assets/betterend/models/item/crystal_moss_path.json @@ -0,0 +1,3 @@ +{ + "parent": "betterend:block/crystal_moss_path" +} diff --git a/src/main/resources/assets/betterend/textures/block/crystal_moss_path_top.png b/src/main/resources/assets/betterend/textures/block/crystal_moss_path_top.png new file mode 100644 index 00000000..830aaf75 Binary files /dev/null and b/src/main/resources/assets/betterend/textures/block/crystal_moss_path_top.png differ