Shadow Forest plants

This commit is contained in:
paulevsGitch 2020-11-01 15:48:44 +03:00
parent 063e3fe465
commit adcb576a37
16 changed files with 125 additions and 2 deletions

View file

@ -86,6 +86,7 @@ public class CraftingRecipes {
GridRecipe.make("creeping_moss_dye", Items.CYAN_DYE).setList("#").addMaterial('#', EndBlocks.CREEPING_MOSS).build(); GridRecipe.make("creeping_moss_dye", Items.CYAN_DYE).setList("#").addMaterial('#', EndBlocks.CREEPING_MOSS).build();
GridRecipe.make("umbrella_moss_dye", Items.YELLOW_DYE).setList("#").addMaterial('#', EndBlocks.UMBRELLA_MOSS).build(); GridRecipe.make("umbrella_moss_dye", Items.YELLOW_DYE).setList("#").addMaterial('#', EndBlocks.UMBRELLA_MOSS).build();
GridRecipe.make("umbrella_moss_tall_dye", Items.YELLOW_DYE).setList("#").addMaterial('#', EndBlocks.UMBRELLA_MOSS_TALL).build(); GridRecipe.make("umbrella_moss_tall_dye", Items.YELLOW_DYE).setList("#").addMaterial('#', EndBlocks.UMBRELLA_MOSS_TALL).build();
GridRecipe.make("shadow_plant_dye", Items.BLACK_DYE).setList("#").addMaterial('#', EndBlocks.SHADOW_PLANT).build();
GridRecipe.make("paper", Items.PAPER).setShape("###").addMaterial('#', EndItems.END_LILY_LEAF_DRIED).setOutputCount(3).build(); GridRecipe.make("paper", Items.PAPER).setShape("###").addMaterial('#', EndItems.END_LILY_LEAF_DRIED).setOutputCount(3).build();

View file

@ -113,6 +113,7 @@ public class EndBlocks {
public static final Block CHORUS_GRASS = registerBlock("chorus_grass", new BlockChorusGrass()); 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 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 CRYSTAL_GRASS = registerBlock("crystal_grass", new BlockTerrainPlant(CRYSTAL_MOSS));
public static final Block SHADOW_PLANT = registerBlock("shadow_plant", new BlockTerrainPlant(SHADOW_GRASS));
public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlockBlueVineSeed()); public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlockBlueVineSeed());
public static final Block BLUE_VINE = registerBlockNI("blue_vine", new BlockBlueVine()); public static final Block BLUE_VINE = registerBlockNI("blue_vine", new BlockBlueVine());

View file

@ -12,6 +12,7 @@ import net.minecraft.world.gen.feature.ConfiguredFeature;
import ru.betterend.world.features.BlueVineFeature; import ru.betterend.world.features.BlueVineFeature;
import ru.betterend.world.features.CavePlantFeature; import ru.betterend.world.features.CavePlantFeature;
import ru.betterend.world.features.DoublePlantFeature; import ru.betterend.world.features.DoublePlantFeature;
import ru.betterend.world.features.DragonTreeBushFeature;
import ru.betterend.world.features.DragonTreeFeature; import ru.betterend.world.features.DragonTreeFeature;
import ru.betterend.world.features.EndFeature; import ru.betterend.world.features.EndFeature;
import ru.betterend.world.features.EndLakeFeature; import ru.betterend.world.features.EndLakeFeature;
@ -37,6 +38,7 @@ public class EndFeatures {
// Bushes // // Bushes //
public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new PythadendronBushFeature(), 4); public static final EndFeature PYTHADENDRON_BUSH = new EndFeature("pythadendron_bush", new PythadendronBushFeature(), 4);
public static final EndFeature DRAGON_TREE_BUSH = new EndFeature("dragon_tree_bush", new DragonTreeBushFeature(), 4);
// Plants // // Plants //
public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(EndBlocks.UMBRELLA_MOSS, EndBlocks.UMBRELLA_MOSS_TALL, 5), 5); public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(EndBlocks.UMBRELLA_MOSS, EndBlocks.UMBRELLA_MOSS_TALL, 5), 5);
@ -45,6 +47,7 @@ public class EndFeatures {
public static final EndFeature CHORUS_GRASS = new EndFeature("chorus_grass", new SinglePlantFeature(EndBlocks.CHORUS_GRASS, 4), 5); public static final EndFeature CHORUS_GRASS = new EndFeature("chorus_grass", new SinglePlantFeature(EndBlocks.CHORUS_GRASS, 4), 5);
public static final EndFeature CAVE_GRASS = new EndFeature("cave_grass", new CavePlantFeature(EndBlocks.CAVE_GRASS, 7), 7); public static final EndFeature CAVE_GRASS = new EndFeature("cave_grass", new CavePlantFeature(EndBlocks.CAVE_GRASS, 7), 7);
public static final EndFeature CRYSTAL_GRASS = new EndFeature("crystal_grass", new SinglePlantFeature(EndBlocks.CRYSTAL_GRASS, 8, false), 5); public static final EndFeature CRYSTAL_GRASS = new EndFeature("crystal_grass", new SinglePlantFeature(EndBlocks.CRYSTAL_GRASS, 8, false), 5);
public static final EndFeature SHADOW_PLANT = new EndFeature("shadow_plant", new SinglePlantFeature(EndBlocks.SHADOW_PLANT, 4), 7);
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3); public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);

View file

@ -11,6 +11,7 @@ public class EndSounds {
public static final SoundEvent MUSIC_CRYSTAL_MOUNTAINS = register("music", "crystal_mountains"); public static final SoundEvent MUSIC_CRYSTAL_MOUNTAINS = register("music", "crystal_mountains");
public static final SoundEvent MUSIC_MEGALAKE = register("music", "megalake"); public static final SoundEvent MUSIC_MEGALAKE = register("music", "megalake");
public static final SoundEvent DUST_WASTELANDS = register("music", "dust_wastelands"); public static final SoundEvent DUST_WASTELANDS = register("music", "dust_wastelands");
public static final SoundEvent SHADOW_FOREST = register("music", "shadow_forest");
// Ambient // Ambient
public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland"); public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland");

View file

@ -16,10 +16,11 @@ public class BiomeShadowForest extends EndBiome {
.setSurface(EndBlocks.SHADOW_GRASS) .setSurface(EndBlocks.SHADOW_GRASS)
.setParticles(ParticleTypes.MYCELIUM, 0.01F) .setParticles(ParticleTypes.MYCELIUM, 0.01F)
.setLoop(EndSounds.AMBIENT_CHORUS_FOREST) .setLoop(EndSounds.AMBIENT_CHORUS_FOREST)
//.setMusic(EndSounds.MUSIC_CHORUS_FOREST) .setMusic(EndSounds.SHADOW_FOREST)
.addFeature(EndFeatures.END_LAKE_RARE) .addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(EndFeatures.DRAGON_TREE) .addFeature(EndFeatures.DRAGON_TREE)
//.addFeature(EndFeatures.PYTHADENDRON_BUSH) .addFeature(EndFeatures.DRAGON_TREE_BUSH)
.addFeature(EndFeatures.SHADOW_PLANT)
.addStructureFeature(ConfiguredStructureFeatures.END_CITY) .addStructureFeature(ConfiguredStructureFeatures.END_CITY)
.addMobSpawn(EntityType.ENDERMAN, 80, 1, 4)); .addMobSpawn(EntityType.ENDERMAN, 80, 1, 4));
} }

View file

@ -0,0 +1,61 @@
package ru.betterend.world.features;
import java.util.Random;
import java.util.function.Function;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.util.sdf.SDF;
import ru.betterend.util.sdf.operator.SDFDisplacement;
import ru.betterend.util.sdf.operator.SDFScale3D;
import ru.betterend.util.sdf.operator.SDFSubtraction;
import ru.betterend.util.sdf.operator.SDFTranslate;
import ru.betterend.util.sdf.primitive.SDFSphere;
public class DragonTreeBushFeature extends DefaultFeature {
private static final Function<BlockState, Boolean> REPLACE;
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
if (world.getBlockState(pos.down()).getBlock() != EndBlocks.SHADOW_GRASS) return false;
BlockState leaves = EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1);
float radius = MHelper.randRange(1.8F, 4.5F, random);
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt());
SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1));
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere));
sphere.setReplaceFunction(REPLACE);
sphere.fillRecursive(world, pos);
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.DRAGON_TREE.bark);
for (Direction d: Direction.values()) {
BlockPos p = pos.offset(d);
if (world.isAir(p)) {
BlocksHelper.setWithoutUpdate(world, p, leaves);
}
}
return true;
}
static {
REPLACE = (state) -> {
if (state.getMaterial().equals(Material.PLANT)) {
return true;
}
return state.getMaterial().isReplaceable();
};
}
}

View file

@ -0,0 +1,10 @@
{
"variants": {
"": [
{ "model": "betterend:block/shadow_plant_01" },
{ "model": "betterend:block/shadow_plant_02" },
{ "model": "betterend:block/shadow_plant_03" },
{ "model": "betterend:block/shadow_plant_04" }
]
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/cross",
"textures": {
"cross": "betterend:block/shadow_plant"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "betterend:block/cross_inverted",
"textures": {
"cross": "betterend:block/shadow_plant"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "betterend:block/crop_block",
"textures": {
"texture": "betterend:block/shadow_plant"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "betterend:block/crop_block_inverted",
"textures": {
"texture": "betterend:block/shadow_plant"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:block/shadow_plant"
}
}

View file

@ -74,6 +74,21 @@
} }
] ]
}, },
"betterend.music.shadow_forest": {
"category": "music",
"sounds": [
{
"name": "betterend:music/i_think_i_can_help_you-the_six_realms",
"volume": 0.2,
"stream": false
},
{
"name": "betterend:music/jesse_gallagher-maestro_tlakaelel",
"volume": 0.2,
"stream": false
}
]
},
"betterend.ambient.foggy_mushroomland": { "betterend.ambient.foggy_mushroomland": {
"category": "ambient", "category": "ambient",

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B