Crystal grass & small changes

This commit is contained in:
paulevsGitch 2020-10-26 06:03:54 +03:00
parent 4073e0a32c
commit 7de70c9553
22 changed files with 376 additions and 14 deletions

View file

@ -90,6 +90,7 @@ public class BlockRegistry {
public static final Block CREEPING_MOSS = registerBlock("creeping_moss", new BlockGlowingMoss(11));
public static final Block CHORUS_GRASS = registerBlock("chorus_grass", new BlockChorusGrass());
public static final Block CAVE_GRASS = registerBlock("cave_grass", new BlockTerrainPlant(CAVE_MOSS));
public static final Block CRYSTAL_GRASS = registerBlock("crystal_grass", new BlockTerrainPlant(CRYSTAL_MOSS));
public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlockBlueVineSeed());
public static final Block BLUE_VINE = registerBlockNI("blue_vine", new BlockBlueVine());

View file

@ -3,6 +3,7 @@ package ru.betterend.registry;
import net.fabricmc.fabric.api.tag.TagRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.Tag;
import net.minecraft.tag.Tag.Identified;
@ -11,6 +12,7 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.Category;
import net.minecraft.world.gen.surfacebuilder.SurfaceConfig;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.BlockTerrain;
import ru.betterend.util.TagHelper;
public class BlockTagRegistry {
@ -22,14 +24,17 @@ public class BlockTagRegistry {
}
public static void register() {
addSurfaceBlock(BlockRegistry.END_MOSS);
addSurfaceBlock(BlockRegistry.END_MYCELIUM);
addSurfaceBlock(BlockRegistry.CHORUS_NYLIUM);
addSurfaceBlock(BlockRegistry.ENDSTONE_DUST);
addSurfaceBlock(BlockRegistry.CAVE_MOSS);
ItemRegistry.getModBlocks().forEach((item) -> {
Block block = ((BlockItem) item).getBlock();
if (block instanceof BlockTerrain) {
addSurfaceBlock(block);
TagHelper.addTag(BlockTags.NYLIUM, block);
}
});
TagHelper.addTag(GEN_TERRAIN, BlockRegistry.ENDER_ORE, BlockRegistry.FLAVOLITE.stone, BlockRegistry.VIOLECITE.stone);
TagHelper.addTag(BlockTags.NYLIUM, BlockRegistry.END_MOSS, BlockRegistry.END_MYCELIUM, BlockRegistry.CHORUS_NYLIUM, BlockRegistry.CAVE_MOSS);
}
public static void addSurfaceBlock(Block block) {

View file

@ -42,6 +42,7 @@ public class FeatureRegistry {
public static final EndFeature BLUE_VINE = new EndFeature("blue_vine", new BlueVineFeature(), 1);
public static final EndFeature CHORUS_GRASS = new EndFeature("chorus_grass", new SinglePlantFeature(BlockRegistry.CHORUS_GRASS, 4), 5);
public static final EndFeature CAVE_GRASS = new EndFeature("cave_grass", new CavePlantFeature(BlockRegistry.CAVE_GRASS, 7), 7);
public static final EndFeature CRYSTAL_GRASS = new EndFeature("crystal_grass", new SinglePlantFeature(BlockRegistry.CRYSTAL_GRASS, 8, false), 5);
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(BlockRegistry.DENSE_VINE, 24), 3);
@ -75,7 +76,7 @@ public class FeatureRegistry {
if (pos < features.size()) {
List<Supplier<ConfiguredFeature<?, ?>>> list = features.get(pos);
// If only chorus plants are enabled
if (list.size() < 2) {
if (list.size() == 1) {
features.get(pos).clear();
}
}

View file

@ -1,6 +1,5 @@
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;
@ -11,10 +10,11 @@ public class BiomeCrystalMountains extends EndBiome {
public BiomeCrystalMountains() {
super(new BiomeDefinition("crystal_mountains")
.setPlantsColor(255, 133, 211)
.setSurface(BlockRegistry.CRYSTAL_MOSS, Blocks.END_STONE)
.setSurface(BlockRegistry.CRYSTAL_MOSS)
.setMusic(SoundRegistry.MUSIC_CRYSTAL_MOUNTAINS)
.addStructureFeature(StructureRegistry.MOUNTAIN)
.addFeature(FeatureRegistry.ROUND_CAVE)
.addFeature(FeatureRegistry.CRYSTAL_GRASS)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
}
}

View file

@ -39,7 +39,7 @@ public abstract class ScatterFeature extends DefaultFeature {
protected boolean getGroundPlant(StructureWorldAccess world, Mutable pos) {
int down = BlocksHelper.downRay(world, pos, 16);
if (down > 10) {
if (down > Math.abs(getYOffset() * 2)) {
return false;
}
pos.setY(pos.getY() - down);

View file

@ -11,10 +11,21 @@ import ru.betterend.util.BlocksHelper;
public class SinglePlantFeature extends ScatterFeature {
private final Block plant;
private final boolean rawHeightmap;
public SinglePlantFeature(Block plant, int radius) {
this(plant, radius, true);
}
public SinglePlantFeature(Block plant, int radius, boolean rawHeightmap) {
super(radius);
this.plant = plant;
this.rawHeightmap = rawHeightmap;
}
@Override
protected BlockPos getCenterGround(StructureWorldAccess world, BlockPos pos) {
return rawHeightmap ? getPosOnSurfaceWG(world, pos) : getPosOnSurface(world, pos);
}
@Override

View file

@ -104,8 +104,8 @@ public class MountainPiece extends BasePiece {
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++) {
boolean needCover = (noise.eval(px * 0.1, pz * 0.1) + MHelper.randRange(-0.4, 0.4, random) - (maxY - 70) * 0.1) > 0;
for (int y = minY - 1; y < maxY; y++) {
pos.setY(y);
chunk.setBlockState(pos, needCover && y >= cover ? top : Blocks.END_STONE.getDefaultState(), false);
}