Cultures spawning

This commit is contained in:
paulevsGitch 2021-03-20 09:26:23 +03:00
parent 945a322b53
commit a549f52527
9 changed files with 45 additions and 0 deletions

View file

@ -14,6 +14,7 @@ import ru.betterend.BetterEnd;
import ru.betterend.world.biome.EndBiome;
import ru.betterend.world.biome.land.BiomeDefinition;
import ru.betterend.world.features.BlueVineFeature;
import ru.betterend.world.features.CavePumpkinFeature;
import ru.betterend.world.features.CharniaFeature;
import ru.betterend.world.features.CrashedShipFeature;
import ru.betterend.world.features.DefaultFeature;
@ -124,6 +125,9 @@ public class EndFeatures {
public static final EndFeature GLOBULAGUS = new EndFeature("globulagus", new SinglePlantFeature(EndBlocks.GLOBULAGUS, 5, 3), 6);
public static final EndFeature CLAWFERN = new EndFeature("clawfern", new SinglePlantFeature(EndBlocks.CLAWFERN, 5, 4), 5);
public static final EndFeature BOLUX_MUSHROOM = new EndFeature("bolux_mushroom", new SinglePlantFeature(EndBlocks.BOLUX_MUSHROOM, 5, 5), 2);
public static final EndFeature CHORUS_MUSHROOM = new EndFeature("chorus_mushroom", new SinglePlantFeature(EndBlocks.CHORUS_MUSHROOM, 5, 5), 1);
public static final EndFeature AMBER_ROOT = new EndFeature("amber_root", new SinglePlantFeature(EndBlocks.AMBER_ROOT, 5, 5), 1);
public static final EndFeature PEARLBERRY = new EndFeature("pearlberry", new SinglePlantFeature(EndBlocks.PEARLBERRY, 5, 5), 1);
// Vines //
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);
@ -217,6 +221,7 @@ public class EndFeatures {
public static final DefaultFeature END_STONE_STALAGMITE = new StalactiteFeature(false, EndBlocks.END_STONE_STALACTITE, Blocks.END_STONE);
public static final DefaultFeature END_STONE_STALACTITE_CAVEMOSS = new StalactiteFeature(true, EndBlocks.END_STONE_STALACTITE_CAVEMOSS, Blocks.END_STONE, EndBlocks.CAVE_MOSS);
public static final DefaultFeature END_STONE_STALAGMITE_CAVEMOSS = new StalactiteFeature(false, EndBlocks.END_STONE_STALACTITE_CAVEMOSS, EndBlocks.CAVE_MOSS);
public static final DefaultFeature CAVE_PUMPKIN = new CavePumpkinFeature();
public static void registerBiomeFeatures(Identifier id, Biome biome, List<List<Supplier<ConfiguredFeature<?, ?>>>> features) {
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {

View file

@ -226,6 +226,11 @@ public class BlocksHelper {
}
}
}
else if (state.isOf(EndBlocks.CAVE_PUMPKIN)) {
if (!world.getBlockState(POS.up()).isOf(EndBlocks.CAVE_PUMPKIN_SEED)) {
setWithoutUpdate(world, POS, AIR);
}
}
else if (!state.canPlaceAt(world, POS)) {
// Chorus
if (state.isOf(Blocks.CHORUS_PLANT)) {

View file

@ -27,6 +27,7 @@ public class LushAuroraCaveBiome extends EndCaveBiome {
this.addFloorFeature(EndFeatures.END_STONE_STALAGMITE_CAVEMOSS, 5);
this.addCeilFeature(EndFeatures.CAVE_BUSH, 1);
this.addCeilFeature(EndFeatures.CAVE_PUMPKIN, 1);
this.addCeilFeature(EndFeatures.RUBINEA, 3);
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE_CAVEMOSS, 10);
}

View file

@ -25,6 +25,7 @@ public class AmberLandBiome extends EndBiome {
.addFeature(EndFeatures.LANCELEAF)
.addFeature(EndFeatures.GLOW_PILLAR)
.addFeature(EndFeatures.AMBER_GRASS)
.addFeature(EndFeatures.AMBER_ROOT)
.addFeature(EndFeatures.BULB_MOSS)
.addFeature(EndFeatures.BULB_MOSS_WOOD)
.addFeature(EndFeatures.CHARNIA_ORANGE)

View file

@ -30,6 +30,7 @@ public class ChorusForestBiome extends EndBiome {
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
.addFeature(EndFeatures.CHORUS_GRASS)
.addFeature(EndFeatures.CHORUS_MUSHROOM)
.addFeature(EndFeatures.TAIL_MOSS)
.addFeature(EndFeatures.TAIL_MOSS_WOOD)
.addFeature(EndFeatures.CHARNIA_PURPLE)

View file

@ -28,6 +28,7 @@ public class FoggyMushroomlandBiome extends EndBiome {
.addFeature(EndFeatures.UMBRELLA_MOSS)
.addFeature(EndFeatures.CREEPING_MOSS)
.addFeature(EndFeatures.DENSE_VINE)
.addFeature(EndFeatures.PEARLBERRY)
.addFeature(EndFeatures.CYAN_MOSS)
.addFeature(EndFeatures.CYAN_MOSS_WOOD)
.addFeature(EndFeatures.END_LILY)

View file

@ -25,6 +25,7 @@ public class MegalakeBiome extends EndBiome {
.addFeature(EndFeatures.END_LILY_RARE)
.addFeature(EndFeatures.UMBRELLA_MOSS)
.addFeature(EndFeatures.CREEPING_MOSS)
.addFeature(EndFeatures.PEARLBERRY)
.addFeature(EndFeatures.CHARNIA_CYAN)
.addFeature(EndFeatures.CHARNIA_LIGHT_BLUE)
.addFeature(EndFeatures.CHARNIA_RED_RARE)

View file

@ -27,6 +27,7 @@ public class MegalakeGroveBiome extends EndBiome {
.addFeature(EndFeatures.BUBBLE_CORAL_RARE)
.addFeature(EndFeatures.END_LILY_RARE)
.addFeature(EndFeatures.UMBRELLA_MOSS)
.addFeature(EndFeatures.PEARLBERRY)
.addFeature(EndFeatures.CREEPING_MOSS)
.addFeature(EndFeatures.CHARNIA_CYAN)
.addFeature(EndFeatures.CHARNIA_LIGHT_BLUE)

View file

@ -0,0 +1,29 @@
package ru.betterend.world.features;
import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
public class CavePumpkinFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
if (!world.getBlockState(pos.up()).isIn(EndTags.GEN_TERRAIN) || !world.isAir(pos) || !world.isAir(pos.down())) {
return false;
}
int age = random.nextInt(4);
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.CAVE_PUMPKIN_SEED.getDefaultState().with(BlockProperties.AGE, age));
if (age > 1) {
BlocksHelper.setWithoutUpdate(world, pos.down(), EndBlocks.CAVE_PUMPKIN.getDefaultState().with(BlockProperties.SMALL, age < 3));
}
return true;
}
}