Biome separation, Smaragdant caves & cave fixes
This commit is contained in:
parent
231794363b
commit
3daf3421ee
44 changed files with 332 additions and 140 deletions
|
@ -42,7 +42,7 @@ import ru.betterend.interfaces.ISlime;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class EndSlimeEntity extends SlimeEntity {
|
||||
private static final TrackedData<Byte> VARIANT = DataTracker.registerData(EndSlimeEntity.class, TrackedDataHandlerRegistry.BYTE);
|
||||
|
|
|
@ -14,7 +14,7 @@ import ru.betterend.integration.byg.features.BYGFeatures;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.TagHelper;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class BYGIntegration extends ModIntegration {
|
||||
public BYGIntegration() {
|
||||
|
|
|
@ -2,7 +2,7 @@ package ru.betterend.integration.byg.biomes;
|
|||
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class BYGBiomes {
|
||||
// New Biomes
|
||||
|
|
|
@ -10,8 +10,8 @@ import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
|||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.byg.features.BYGFeatures;
|
||||
import ru.betterend.world.biome.BiomeDefinition;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.BiomeDefinition;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class EterialGrove extends EndBiome {
|
||||
public EterialGrove() {
|
||||
|
|
|
@ -13,8 +13,8 @@ import ru.betterend.BetterEnd;
|
|||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.byg.features.BYGFeatures;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.world.biome.BiomeDefinition;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.BiomeDefinition;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class NightshadeRedwoods extends EndBiome {
|
||||
public NightshadeRedwoods() {
|
||||
|
|
|
@ -20,8 +20,8 @@ import ru.betterend.BetterEnd;
|
|||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.integration.byg.features.BYGFeatures;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.world.biome.BiomeDefinition;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.BiomeDefinition;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class OldBulbisGardens extends EndBiome {
|
||||
public OldBulbisGardens() {
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraft.world.biome.Biome.Category;
|
|||
import ru.betterend.client.ClientOptions;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.util.BackgroundInfo;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
@Mixin(BackgroundRenderer.class)
|
||||
public class BackgroundRendererMixin {
|
||||
|
|
|
@ -23,7 +23,7 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.BonemealUtil;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
@Mixin(BoneMealItem.class)
|
||||
public class BoneMealItemMixin {
|
||||
|
|
|
@ -31,25 +31,26 @@ import ru.betterend.BetterEnd;
|
|||
import ru.betterend.config.Configs;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.util.JsonFactory;
|
||||
import ru.betterend.world.biome.BiomeAmberLand;
|
||||
import ru.betterend.world.biome.BiomeBlossomingSpires;
|
||||
import ru.betterend.world.biome.BiomeChorusForest;
|
||||
import ru.betterend.world.biome.BiomeCrystalMountains;
|
||||
import ru.betterend.world.biome.BiomeDustWastelands;
|
||||
import ru.betterend.world.biome.BiomeFoggyMushroomland;
|
||||
import ru.betterend.world.biome.BiomeIceStarfield;
|
||||
import ru.betterend.world.biome.BiomeMegalake;
|
||||
import ru.betterend.world.biome.BiomeMegalakeGrove;
|
||||
import ru.betterend.world.biome.BiomePaintedMountains;
|
||||
import ru.betterend.world.biome.BiomeShadowForest;
|
||||
import ru.betterend.world.biome.BiomeSulphurSprings;
|
||||
import ru.betterend.world.biome.BiomeUmbrellaJungle;
|
||||
import ru.betterend.world.biome.DragonGraveyardsBiome;
|
||||
import ru.betterend.world.biome.DryShrublandBiome;
|
||||
import ru.betterend.world.biome.EmptyEndCaveBiome;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.EndCaveBiome;
|
||||
import ru.betterend.world.biome.GlowingGrasslandsBiome;
|
||||
import ru.betterend.world.biome.air.BiomeIceStarfield;
|
||||
import ru.betterend.world.biome.cave.EmptyEndCaveBiome;
|
||||
import ru.betterend.world.biome.cave.EmptySmaragdantCaveBiome;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
import ru.betterend.world.biome.land.BiomeAmberLand;
|
||||
import ru.betterend.world.biome.land.BiomeBlossomingSpires;
|
||||
import ru.betterend.world.biome.land.BiomeChorusForest;
|
||||
import ru.betterend.world.biome.land.BiomeCrystalMountains;
|
||||
import ru.betterend.world.biome.land.BiomeDustWastelands;
|
||||
import ru.betterend.world.biome.land.BiomeFoggyMushroomland;
|
||||
import ru.betterend.world.biome.land.BiomeMegalake;
|
||||
import ru.betterend.world.biome.land.BiomeMegalakeGrove;
|
||||
import ru.betterend.world.biome.land.BiomePaintedMountains;
|
||||
import ru.betterend.world.biome.land.BiomeShadowForest;
|
||||
import ru.betterend.world.biome.land.BiomeSulphurSprings;
|
||||
import ru.betterend.world.biome.land.BiomeUmbrellaJungle;
|
||||
import ru.betterend.world.biome.land.DragonGraveyardsBiome;
|
||||
import ru.betterend.world.biome.land.DryShrublandBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
import ru.betterend.world.biome.land.GlowingGrasslandsBiome;
|
||||
import ru.betterend.world.generator.BELayerRandomSource;
|
||||
import ru.betterend.world.generator.BiomePicker;
|
||||
import ru.betterend.world.generator.BiomeType;
|
||||
|
@ -98,7 +99,8 @@ public class EndBiomes {
|
|||
public static final EndBiome ICE_STARFIELD = registerBiome(new BiomeIceStarfield(), BiomeType.VOID);
|
||||
|
||||
// Better End Caves
|
||||
public static final EndCaveBiome EMPTY_CAVE = registerCaveBiome(new EmptyEndCaveBiome());
|
||||
public static final EndCaveBiome EMPTY_END_CAVE = registerCaveBiome(new EmptyEndCaveBiome());
|
||||
public static final EndCaveBiome EMPTY_SMARAGDANT_CAVE = registerCaveBiome(new EmptySmaragdantCaveBiome());
|
||||
|
||||
public static void register() {}
|
||||
|
||||
|
|
|
@ -10,11 +10,12 @@ import net.minecraft.world.biome.Biome;
|
|||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.world.biome.BiomeDefinition;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.BiomeDefinition;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
import ru.betterend.world.features.BlueVineFeature;
|
||||
import ru.betterend.world.features.CharniaFeature;
|
||||
import ru.betterend.world.features.CrashedShipFeature;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
import ru.betterend.world.features.DoublePlantFeature;
|
||||
import ru.betterend.world.features.EndFeature;
|
||||
import ru.betterend.world.features.EndLilyFeature;
|
||||
|
@ -43,6 +44,8 @@ import ru.betterend.world.features.terrain.GeyserFeature;
|
|||
import ru.betterend.world.features.terrain.IceStarFeature;
|
||||
import ru.betterend.world.features.terrain.ObsidianBoulderFeature;
|
||||
import ru.betterend.world.features.terrain.ObsidianPillarBasementFeature;
|
||||
import ru.betterend.world.features.terrain.SmaragdantCrystalFeature;
|
||||
import ru.betterend.world.features.terrain.SmaragdantCrystalShardFeature;
|
||||
import ru.betterend.world.features.terrain.SpireFeature;
|
||||
import ru.betterend.world.features.terrain.SulphurHillFeature;
|
||||
import ru.betterend.world.features.terrain.SulphuricCaveFeature;
|
||||
|
@ -185,6 +188,10 @@ public class EndFeatures {
|
|||
// Mobs
|
||||
public static final EndFeature SILK_MOTH_NEST = EndFeature.makeChansedFeature("silk_moth_nest", new SilkMothNestFeature(), 2);
|
||||
|
||||
// Caves
|
||||
public static final DefaultFeature SMARAGDANT_CRYSTAL = new SmaragdantCrystalFeature();
|
||||
public static final DefaultFeature SMARAGDANT_CRYSTAL_SHARD = new SmaragdantCrystalShardFeature();
|
||||
|
||||
public static void registerBiomeFeatures(Identifier id, Biome biome, List<List<Supplier<ConfiguredFeature<?, ?>>>> features) {
|
||||
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
|
||||
return;
|
||||
|
|
|
@ -196,6 +196,17 @@ public class BlocksHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (state.isOf(EndBlocks.SMARAGDANT_CRYSTAL)) {
|
||||
POS.setY(POS.getY() - 1);
|
||||
if (world.isAir(POS)) {
|
||||
POS.setY(POS.getY() + 1);
|
||||
while (state.isOf(EndBlocks.SMARAGDANT_CRYSTAL)) {
|
||||
setWithoutUpdate(world, POS, AIR);
|
||||
POS.setY(POS.getY() + 1);
|
||||
state = world.getBlockState(POS);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!state.canPlaceAt(world, POS)) {
|
||||
// Chorus
|
||||
if (state.isOf(Blocks.CHORUS_PLANT)) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.util.Identifier;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class BonemealUtil {
|
||||
private static final Map<Identifier, Map<Block, GrassList>> GRASS_BIOMES = Maps.newHashMap();
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
package ru.betterend.world.biome;
|
||||
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
|
||||
public class EmptyEndCaveBiome extends EndCaveBiome {
|
||||
public EmptyEndCaveBiome() {
|
||||
super(new BiomeDefinition("empty_end_cave")
|
||||
.setFogColor(255, 184, 71)
|
||||
.setFogDensity(2.0F)
|
||||
.setPlantsColor(219, 115, 38)
|
||||
.setWaterAndFogColor(145, 108, 72)
|
||||
.setMusic(EndSounds.MUSIC_FOREST)
|
||||
.setParticles(EndParticles.AMBER_SPHERE, 0.001F)
|
||||
.setSurface(EndBlocks.AMBER_MOSS));
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package ru.betterend.world.biome;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
|
||||
public class EndCaveBiome extends EndBiome {
|
||||
private List<Feature<?>> floorFeatures = Lists.newArrayList();
|
||||
private List<Feature<?>> ceilFeatures = Lists.newArrayList();
|
||||
|
||||
public EndCaveBiome(BiomeDefinition definition) {
|
||||
super(definition.setCaveBiome());
|
||||
}
|
||||
|
||||
public void addFloorFeature(Feature<?> feature) {
|
||||
floorFeatures.add(feature);
|
||||
}
|
||||
|
||||
public void addCeilFeature(Feature<?> feature) {
|
||||
ceilFeatures.add(feature);
|
||||
}
|
||||
|
||||
public Feature<?> getFloorFeature(Random random) {
|
||||
return floorFeatures.isEmpty() ? null : floorFeatures.get(random.nextInt(floorFeatures.size()));
|
||||
}
|
||||
|
||||
public Feature<?> getCeilFeature(Random random) {
|
||||
return ceilFeatures.isEmpty() ? null : ceilFeatures.get(random.nextInt(ceilFeatures.size()));
|
||||
}
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.air;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
import ru.betterend.world.biome.land.BiomeDefinition;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class BiomeIceStarfield extends EndBiome {
|
||||
public BiomeIceStarfield() {
|
|
@ -0,0 +1,12 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import ru.betterend.registry.EndSounds;
|
||||
import ru.betterend.world.biome.land.BiomeDefinition;
|
||||
|
||||
public class EmptyEndCaveBiome extends EndCaveBiome {
|
||||
public EmptyEndCaveBiome() {
|
||||
super(new BiomeDefinition("empty_end_cave")
|
||||
.setFogDensity(2.0F)
|
||||
.setMusic(EndSounds.MUSIC_FOREST));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
import ru.betterend.registry.EndSounds;
|
||||
import ru.betterend.world.biome.land.BiomeDefinition;
|
||||
|
||||
public class EmptySmaragdantCaveBiome extends EndCaveBiome {
|
||||
public EmptySmaragdantCaveBiome() {
|
||||
super(new BiomeDefinition("empty_smaragdant_cave")
|
||||
.setFogColor(0, 253, 182)
|
||||
.setFogDensity(2.0F)
|
||||
.setPlantsColor(0, 131, 145)
|
||||
.setWaterAndFogColor(31, 167, 212)
|
||||
.setMusic(EndSounds.MUSIC_FOREST)
|
||||
.setParticles(EndParticles.FIREFLY, 0.001F));
|
||||
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL, 1);
|
||||
this.addFloorFeature(EndFeatures.SMARAGDANT_CRYSTAL_SHARD, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloorDensity() {
|
||||
return 0.1F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.collection.WeightedList;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import ru.betterend.world.biome.land.BiomeDefinition;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class EndCaveBiome extends EndBiome {
|
||||
private WeightedList<Feature<?>> floorFeatures = new WeightedList<Feature<?>>();
|
||||
private WeightedList<Feature<?>> ceilFeatures = new WeightedList<Feature<?>>();
|
||||
|
||||
public EndCaveBiome(BiomeDefinition definition) {
|
||||
super(definition.setCaveBiome());
|
||||
}
|
||||
|
||||
public void addFloorFeature(Feature<?> feature, int weight) {
|
||||
floorFeatures.add(feature, weight);
|
||||
}
|
||||
|
||||
public void addCeilFeature(Feature<?> feature, int weight) {
|
||||
ceilFeatures.add(feature, weight);
|
||||
}
|
||||
|
||||
public Feature<?> getFloorFeature(Random random) {
|
||||
return floorFeatures.isEmpty() ? null : floorFeatures.pickRandom(random);
|
||||
}
|
||||
|
||||
public Feature<?> getCeilFeature(Random random) {
|
||||
return ceilFeatures.isEmpty() ? null : ceilFeatures.pickRandom(random);
|
||||
}
|
||||
|
||||
public float getFloorDensity() {
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import ru.betterend.registry.EndBlocks;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.particle.ParticleTypes;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import ru.betterend.registry.EndBlocks;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.particle.ParticleTypes;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import ru.betterend.registry.EndBlocks;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import ru.betterend.registry.EndBlocks;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.particle.ParticleTypes;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.particle.ParticleTypes;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import ru.betterend.registry.EndEntities;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import ru.betterend.registry.EndBlocks;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package ru.betterend.world.biome;
|
||||
package ru.betterend.world.biome.land;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
|
|
@ -0,0 +1,56 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class SmaragdantCrystalFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
||||
if (!world.getBlockState(pos.down()).isIn(EndTags.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Mutable mut = new Mutable();
|
||||
int count = MHelper.randRange(15, 30, random);
|
||||
BlockState crystal = EndBlocks.SMARAGDANT_CRYSTAL.getDefaultState();
|
||||
BlockState shard = EndBlocks.SMARAGDANT_CRYSTAL_SHARD.getDefaultState();
|
||||
for (int i = 0; i < count; i++) {
|
||||
mut.set(pos).move(MHelper.floor(random.nextGaussian() * 2 + 0.5), 5, MHelper.floor(random.nextGaussian() * 2 + 0.5));
|
||||
int dist = MHelper.floor(1.5F - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(3);
|
||||
if (dist > 0) {
|
||||
BlockState state = world.getBlockState(mut);
|
||||
for (int n = 0; n < 10 && state.isAir(); n++) {
|
||||
mut.setY(mut.getY() - 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
if (state.isIn(EndTags.GEN_TERRAIN) && !world.getBlockState(mut.up()).isOf(crystal.getBlock())) {
|
||||
for (int j = 0; j <= dist; j++) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, crystal);
|
||||
mut.setY(mut.getY() + 1);
|
||||
}
|
||||
if (random.nextBoolean()) {
|
||||
boolean waterlogged = !world.getFluidState(mut).isEmpty();
|
||||
BlocksHelper.setWithoutUpdate(world, mut, shard.with(Properties.WATERLOGGED, waterlogged));
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, crystal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package ru.betterend.world.features.terrain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.property.Properties;
|
||||
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.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class SmaragdantCrystalShardFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
|
||||
if (!world.getBlockState(pos.down()).isIn(EndTags.GEN_TERRAIN)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockState shard = EndBlocks.SMARAGDANT_CRYSTAL_SHARD.getDefaultState();
|
||||
boolean waterlogged = !world.getFluidState(pos).isEmpty();
|
||||
BlocksHelper.setWithoutUpdate(world, pos, shard.with(Properties.WATERLOGGED, waterlogged));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -9,16 +9,20 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import ru.betterend.interfaces.IBiomeArray;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.biome.EndCaveBiome;
|
||||
import ru.betterend.world.biome.cave.EndCaveBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
import ru.betterend.world.features.DefaultFeature;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
|
@ -33,6 +37,10 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (biomeMissingCaves(world, pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int radius = MHelper.randRange(10, 30, random);
|
||||
BlockPos center = findPos(world, pos, radius, random);
|
||||
|
||||
|
@ -42,7 +50,8 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
|
||||
EndCaveBiome biome = EndBiomes.getCaveBiome(random);
|
||||
Set<BlockPos> caveBlocks = generate(world, center, radius, random);
|
||||
if (biome != null && !caveBlocks.isEmpty()) {
|
||||
if (!caveBlocks.isEmpty()) {
|
||||
if (biome != null) {
|
||||
setBiomes(world, biome, caveBlocks);
|
||||
Set<BlockPos> floorPositions = Sets.newHashSet();
|
||||
Set<BlockPos> ceilPositions = Sets.newHashSet();
|
||||
|
@ -64,7 +73,8 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
placeFloor(world, biome, floorPositions, random, surfaceBlock);
|
||||
placeCeil(world, biome, ceilPositions, random);
|
||||
}
|
||||
fixBlocks(world, center, radius);
|
||||
fixBlocks(world, caveBlocks);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -75,6 +85,18 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
floorPositions.forEach((pos) -> {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
|
||||
});
|
||||
|
||||
float density = biome.getFloorDensity();
|
||||
if (density > 0) {
|
||||
floorPositions.forEach((pos) -> {
|
||||
if (random.nextFloat() <= density) {
|
||||
Feature<?> feature = biome.getFloorFeature(random);
|
||||
if (feature != null) {
|
||||
feature.generate(world, null, random, pos.up(), null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected void placeCeil(StructureWorldAccess world, EndCaveBiome biome, Set<BlockPos> ceilPositions, Random random) {
|
||||
|
@ -122,13 +144,54 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
|||
return new BlockPos(pos.getX(), MHelper.randRange(bottom, top, random), pos.getZ());
|
||||
}
|
||||
|
||||
private void fixBlocks(StructureWorldAccess world, BlockPos pos, int radius) {
|
||||
int x1 = pos.getX() - radius - 5;
|
||||
int y1 = pos.getY() - radius - 5;
|
||||
int z1 = pos.getZ() - radius - 5;
|
||||
int x2 = pos.getX() + radius + 5;
|
||||
int y2 = pos.getY() + radius + 5;
|
||||
int z2 = pos.getZ() + radius + 5;
|
||||
BlocksHelper.fixBlocks(world, new BlockPos(x1, y1, z1), new BlockPos(x2, y2, z2));
|
||||
private void fixBlocks(StructureWorldAccess world, Set<BlockPos> caveBlocks) {
|
||||
BlockPos pos = caveBlocks.iterator().next();
|
||||
Mutable start = new Mutable().set(pos);
|
||||
Mutable end = new Mutable().set(pos);
|
||||
caveBlocks.forEach((bpos) -> {
|
||||
if (bpos.getX() < start.getX()) {
|
||||
start.setX(bpos.getX());
|
||||
}
|
||||
if (bpos.getX() > end.getX()) {
|
||||
end.setX(bpos.getX());
|
||||
}
|
||||
|
||||
if (bpos.getY() < start.getY()) {
|
||||
start.setY(bpos.getY());
|
||||
}
|
||||
if (bpos.getY() > end.getY()) {
|
||||
end.setY(bpos.getY());
|
||||
}
|
||||
|
||||
if (bpos.getZ() < start.getZ()) {
|
||||
start.setZ(bpos.getZ());
|
||||
}
|
||||
if (bpos.getZ() > end.getZ()) {
|
||||
end.setZ(bpos.getZ());
|
||||
}
|
||||
});
|
||||
BlocksHelper.fixBlocks(world, start.add(-5, -5, -5), end.add(5, 5, 5));
|
||||
}
|
||||
|
||||
protected boolean isWaterNear(StructureWorldAccess world, BlockPos pos) {
|
||||
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||
if (!world.getFluidState(pos.offset(dir, 5)).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean biomeMissingCaves(StructureWorldAccess world, BlockPos pos) {
|
||||
for (int x = -2; x < 3; x++) {
|
||||
for (int z = -2; z < 3; z++) {
|
||||
Biome biome = world.getBiome(pos.add(x << 4, 0, z << 4));
|
||||
EndBiome endBiome = EndBiomes.getFromBiome(biome);
|
||||
if (!endBiome.hasCaves()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,11 +47,10 @@ public class RoundCaveFeature extends EndCaveFeature {
|
|||
ysq *= ysq;
|
||||
bpos.setY(y);
|
||||
double r = noise.eval(x * 0.1, y * 0.1, z * 0.1) * nr + hr;
|
||||
//double r2 = r + 5;
|
||||
double dist = xsq + ysq + zsq;
|
||||
if (dist < r * r) {
|
||||
state = world.getBlockState(bpos);
|
||||
if (isReplaceable(state)) {
|
||||
if (isReplaceable(state) && !isWaterNear(world, bpos)) {
|
||||
BlocksHelper.setWithoutUpdate(world, bpos, CAVE_AIR);
|
||||
blocks.add(bpos.toImmutable());
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import ru.betterend.noise.OpenSimplexNoise;
|
|||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.FeaturesHelper;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class BetterEndBiomeSource extends BiomeSource {
|
||||
public static final Codec<BetterEndBiomeSource> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
|
|
|
@ -2,7 +2,7 @@ package ru.betterend.world.generator;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class BiomeChunk
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.util.math.ChunkPos;
|
|||
import net.minecraft.world.gen.ChunkRandom;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class BiomeMap {
|
||||
private static final ChunkRandom RANDOM = new ChunkRandom();
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.google.common.collect.Lists;
|
|||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class BiomePicker {
|
||||
private final Set<Identifier> immutableIDs = Sets.newHashSet();
|
||||
|
|
|
@ -2,7 +2,7 @@ package ru.betterend.world.generator;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.biome.land.EndBiome;
|
||||
|
||||
public class WeighTree {
|
||||
private final Node root;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue