diff --git a/src/main/java/ru/betterend/recipe/CraftingRecipes.java b/src/main/java/ru/betterend/recipe/CraftingRecipes.java index fdc9bf44..f84d6694 100644 --- a/src/main/java/ru/betterend/recipe/CraftingRecipes.java +++ b/src/main/java/ru/betterend/recipe/CraftingRecipes.java @@ -86,6 +86,7 @@ public class CraftingRecipes { 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_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(); diff --git a/src/main/java/ru/betterend/registry/EndBlocks.java b/src/main/java/ru/betterend/registry/EndBlocks.java index 93506d33..93502967 100644 --- a/src/main/java/ru/betterend/registry/EndBlocks.java +++ b/src/main/java/ru/betterend/registry/EndBlocks.java @@ -113,6 +113,7 @@ public class EndBlocks { 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 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 = registerBlockNI("blue_vine", new BlockBlueVine()); diff --git a/src/main/java/ru/betterend/registry/EndFeatures.java b/src/main/java/ru/betterend/registry/EndFeatures.java index 41f5d3ed..08414699 100644 --- a/src/main/java/ru/betterend/registry/EndFeatures.java +++ b/src/main/java/ru/betterend/registry/EndFeatures.java @@ -12,6 +12,7 @@ import net.minecraft.world.gen.feature.ConfiguredFeature; import ru.betterend.world.features.BlueVineFeature; import ru.betterend.world.features.CavePlantFeature; import ru.betterend.world.features.DoublePlantFeature; +import ru.betterend.world.features.DragonTreeBushFeature; import ru.betterend.world.features.DragonTreeFeature; import ru.betterend.world.features.EndFeature; import ru.betterend.world.features.EndLakeFeature; @@ -37,6 +38,7 @@ public class EndFeatures { // Bushes // 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 // 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 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 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); diff --git a/src/main/java/ru/betterend/registry/EndSounds.java b/src/main/java/ru/betterend/registry/EndSounds.java index 0686f6c2..9b7db73e 100644 --- a/src/main/java/ru/betterend/registry/EndSounds.java +++ b/src/main/java/ru/betterend/registry/EndSounds.java @@ -11,6 +11,7 @@ public class EndSounds { public static final SoundEvent MUSIC_CRYSTAL_MOUNTAINS = register("music", "crystal_mountains"); public static final SoundEvent MUSIC_MEGALAKE = register("music", "megalake"); public static final SoundEvent DUST_WASTELANDS = register("music", "dust_wastelands"); + public static final SoundEvent SHADOW_FOREST = register("music", "shadow_forest"); // Ambient public static final SoundEvent AMBIENT_FOGGY_MUSHROOMLAND = register("ambient", "foggy_mushroomland"); diff --git a/src/main/java/ru/betterend/world/biome/BiomeShadowForest.java b/src/main/java/ru/betterend/world/biome/BiomeShadowForest.java index b16a83ed..2fcbf120 100644 --- a/src/main/java/ru/betterend/world/biome/BiomeShadowForest.java +++ b/src/main/java/ru/betterend/world/biome/BiomeShadowForest.java @@ -16,10 +16,11 @@ public class BiomeShadowForest extends EndBiome { .setSurface(EndBlocks.SHADOW_GRASS) .setParticles(ParticleTypes.MYCELIUM, 0.01F) .setLoop(EndSounds.AMBIENT_CHORUS_FOREST) - //.setMusic(EndSounds.MUSIC_CHORUS_FOREST) + .setMusic(EndSounds.SHADOW_FOREST) .addFeature(EndFeatures.END_LAKE_RARE) .addFeature(EndFeatures.DRAGON_TREE) - //.addFeature(EndFeatures.PYTHADENDRON_BUSH) + .addFeature(EndFeatures.DRAGON_TREE_BUSH) + .addFeature(EndFeatures.SHADOW_PLANT) .addStructureFeature(ConfiguredStructureFeatures.END_CITY) .addMobSpawn(EntityType.ENDERMAN, 80, 1, 4)); } diff --git a/src/main/java/ru/betterend/world/features/DragonTreeBushFeature.java b/src/main/java/ru/betterend/world/features/DragonTreeBushFeature.java new file mode 100644 index 00000000..0fa3b34e --- /dev/null +++ b/src/main/java/ru/betterend/world/features/DragonTreeBushFeature.java @@ -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 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(); + }; + } +} diff --git a/src/main/resources/assets/betterend/blockstates/shadow_plant.json b/src/main/resources/assets/betterend/blockstates/shadow_plant.json new file mode 100644 index 00000000..df6e7636 --- /dev/null +++ b/src/main/resources/assets/betterend/blockstates/shadow_plant.json @@ -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" } + ] + } +} diff --git a/src/main/resources/assets/betterend/models/block/shadow_plant_01.json b/src/main/resources/assets/betterend/models/block/shadow_plant_01.json new file mode 100644 index 00000000..7b732b2e --- /dev/null +++ b/src/main/resources/assets/betterend/models/block/shadow_plant_01.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cross", + "textures": { + "cross": "betterend:block/shadow_plant" + } +} diff --git a/src/main/resources/assets/betterend/models/block/shadow_plant_02.json b/src/main/resources/assets/betterend/models/block/shadow_plant_02.json new file mode 100644 index 00000000..513fa3a5 --- /dev/null +++ b/src/main/resources/assets/betterend/models/block/shadow_plant_02.json @@ -0,0 +1,6 @@ +{ + "parent": "betterend:block/cross_inverted", + "textures": { + "cross": "betterend:block/shadow_plant" + } +} diff --git a/src/main/resources/assets/betterend/models/block/shadow_plant_03.json b/src/main/resources/assets/betterend/models/block/shadow_plant_03.json new file mode 100644 index 00000000..227f92e3 --- /dev/null +++ b/src/main/resources/assets/betterend/models/block/shadow_plant_03.json @@ -0,0 +1,6 @@ +{ + "parent": "betterend:block/crop_block", + "textures": { + "texture": "betterend:block/shadow_plant" + } +} diff --git a/src/main/resources/assets/betterend/models/block/shadow_plant_04.json b/src/main/resources/assets/betterend/models/block/shadow_plant_04.json new file mode 100644 index 00000000..cedb03ef --- /dev/null +++ b/src/main/resources/assets/betterend/models/block/shadow_plant_04.json @@ -0,0 +1,6 @@ +{ + "parent": "betterend:block/crop_block_inverted", + "textures": { + "texture": "betterend:block/shadow_plant" + } +} diff --git a/src/main/resources/assets/betterend/models/item/shadow_plant.json b/src/main/resources/assets/betterend/models/item/shadow_plant.json new file mode 100644 index 00000000..b7b531f5 --- /dev/null +++ b/src/main/resources/assets/betterend/models/item/shadow_plant.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "betterend:block/shadow_plant" + } +} diff --git a/src/main/resources/assets/betterend/sounds.json b/src/main/resources/assets/betterend/sounds.json index cff22d24..c21b4b9f 100644 --- a/src/main/resources/assets/betterend/sounds.json +++ b/src/main/resources/assets/betterend/sounds.json @@ -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": { "category": "ambient", diff --git a/src/main/resources/assets/betterend/sounds/music/i_think_i_can_help_you-the_six_realms.ogg b/src/main/resources/assets/betterend/sounds/music/i_think_i_can_help_you-the_six_realms.ogg new file mode 100644 index 00000000..fb051d82 Binary files /dev/null and b/src/main/resources/assets/betterend/sounds/music/i_think_i_can_help_you-the_six_realms.ogg differ diff --git a/src/main/resources/assets/betterend/sounds/music/jesse_gallagher-maestro_tlakaelel.ogg b/src/main/resources/assets/betterend/sounds/music/jesse_gallagher-maestro_tlakaelel.ogg new file mode 100644 index 00000000..437a52b8 Binary files /dev/null and b/src/main/resources/assets/betterend/sounds/music/jesse_gallagher-maestro_tlakaelel.ogg differ diff --git a/src/main/resources/assets/betterend/textures/block/shadow_plant.png b/src/main/resources/assets/betterend/textures/block/shadow_plant.png new file mode 100644 index 00000000..4a139457 Binary files /dev/null and b/src/main/resources/assets/betterend/textures/block/shadow_plant.png differ