[Feature] Migrated Biomes, Structures and Features to DataGen
This commit is contained in:
parent
76c5e1ce42
commit
bdee723117
11 changed files with 217 additions and 101 deletions
|
@ -3,6 +3,7 @@ package org.betterx.betterend.registry;
|
|||
import org.betterx.bclib.api.v2.advancement.AdvancementManager;
|
||||
import org.betterx.betterend.BetterEnd;
|
||||
import org.betterx.betterend.advancements.BECriteria;
|
||||
import org.betterx.betterend.world.biome.EndBiome;
|
||||
|
||||
import net.minecraft.advancements.FrameType;
|
||||
import net.minecraft.advancements.RequirementsStrategy;
|
||||
|
@ -65,7 +66,7 @@ public class EndAdvancements {
|
|||
.startDisplay(EndItems.AETERNIUM_BOOTS)
|
||||
.frame(FrameType.CHALLENGE)
|
||||
.endDisplay()
|
||||
.addVisitBiomesCriterion(EndBiomes.ALL_BE_BIOMES.stream().map(b -> b.getBiomeKey()).toList())
|
||||
.addVisitBiomesCriterion(EndBiome.getAllBeBiomes().stream().map(b -> b.getBiomeKey()).toList())
|
||||
.requirements(RequirementsStrategy.AND)
|
||||
.rewardXP(1500)
|
||||
.buildAndRegister();
|
||||
|
|
|
@ -9,10 +9,7 @@ import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
|||
import org.betterx.betterend.BetterEnd;
|
||||
import org.betterx.betterend.config.Configs;
|
||||
import org.betterx.betterend.world.biome.EndBiome;
|
||||
import org.betterx.betterend.world.biome.air.BiomeIceStarfield;
|
||||
import org.betterx.betterend.world.biome.cave.*;
|
||||
import org.betterx.betterend.world.biome.land.*;
|
||||
import org.betterx.betterend.world.generator.BiomeType;
|
||||
import org.betterx.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
|
@ -20,47 +17,12 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class EndBiomes {
|
||||
public static final BiomeAPI.BiomeType END_CAVE = new BiomeAPI.BiomeType("END_CAVE", BiomeAPI.BiomeType.END_IGNORE);
|
||||
public static final List<EndBiome> ALL_BE_BIOMES = new LinkedList<>();
|
||||
public static BiomePicker CAVE_BIOMES = null;
|
||||
private static HexBiomeMap caveBiomeMap;
|
||||
private static long lastSeed;
|
||||
|
||||
// Better End Land
|
||||
public static final EndBiome FOGGY_MUSHROOMLAND = registerBiome(new FoggyMushroomlandBiome(), BiomeType.LAND);
|
||||
public static final EndBiome CHORUS_FOREST = registerBiome(new ChorusForestBiome(), BiomeType.LAND);
|
||||
public static final EndBiome DUST_WASTELANDS = registerBiome(new DustWastelandsBiome(), BiomeType.LAND);
|
||||
public static final EndBiome MEGALAKE = registerBiome(new MegalakeBiome(), BiomeType.LAND);
|
||||
public static final EndBiome MEGALAKE_GROVE = registerSubBiome(new MegalakeGroveBiome(), MEGALAKE);
|
||||
public static final EndBiome CRYSTAL_MOUNTAINS = registerBiome(new CrystalMountainsBiome(), BiomeType.LAND);
|
||||
public static final EndBiome PAINTED_MOUNTAINS = registerSubBiome(new PaintedMountainsBiome(), DUST_WASTELANDS);
|
||||
public static final EndBiome SHADOW_FOREST = registerBiome(new ShadowForestBiome(), BiomeType.LAND);
|
||||
public static final EndBiome AMBER_LAND = registerBiome(new AmberLandBiome(), BiomeType.LAND);
|
||||
public static final EndBiome BLOSSOMING_SPIRES = registerBiome(new BlossomingSpiresBiome(), BiomeType.LAND);
|
||||
public static final EndBiome SULPHUR_SPRINGS = registerBiome(new SulphurSpringsBiome(), BiomeType.LAND);
|
||||
public static final EndBiome UMBRELLA_JUNGLE = registerBiome(new UmbrellaJungleBiome(), BiomeType.LAND);
|
||||
public static final EndBiome GLOWING_GRASSLANDS = registerBiome(new GlowingGrasslandsBiome(), BiomeType.LAND);
|
||||
public static final EndBiome DRAGON_GRAVEYARDS = registerBiome(new DragonGraveyardsBiome(), BiomeType.LAND);
|
||||
public static final EndBiome DRY_SHRUBLAND = registerBiome(new DryShrublandBiome(), BiomeType.LAND);
|
||||
public static final EndBiome LANTERN_WOODS = registerBiome(new LanternWoodsBiome(), BiomeType.LAND);
|
||||
public static final EndBiome NEON_OASIS = registerSubBiome(new NeonOasisBiome(), DUST_WASTELANDS);
|
||||
public static final EndBiome UMBRA_VALLEY = registerBiome(new UmbraValleyBiome(), BiomeType.LAND);
|
||||
|
||||
// Better End Void
|
||||
public static final EndBiome ICE_STARFIELD = registerBiome(new BiomeIceStarfield(), BiomeType.VOID);
|
||||
|
||||
// Better End Caves
|
||||
public static final EndCaveBiome EMPTY_END_CAVE = registerCaveBiome(new EmptyEndCaveBiome());
|
||||
public static final EndCaveBiome EMPTY_SMARAGDANT_CAVE = registerCaveBiome(new EmptySmaragdantCaveBiome());
|
||||
public static final EndCaveBiome LUSH_SMARAGDANT_CAVE = registerCaveBiome(new LushSmaragdantCaveBiome());
|
||||
public static final EndCaveBiome EMPTY_AURORA_CAVE = registerCaveBiome(new EmptyAuroraCaveBiome());
|
||||
public static final EndCaveBiome LUSH_AURORA_CAVE = registerCaveBiome(new LushAuroraCaveBiome());
|
||||
public static final EndCaveBiome JADE_CAVE = registerCaveBiome(new JadeCaveBiome());
|
||||
|
||||
public static void register() {
|
||||
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("biome"), EndBiome.KEY_CODEC);
|
||||
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("cave_biome"), EndCaveBiome.KEY_CODEC);
|
||||
|
@ -104,30 +66,6 @@ public class EndBiomes {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put existing {@link EndBiome} as a sub-biome into selected parent.
|
||||
*
|
||||
* @param biomeConfig - {@link EndBiome.Config} instance
|
||||
* @param parent - {@link EndBiome} to be linked with
|
||||
* @return registered {@link EndBiome}
|
||||
*/
|
||||
public static EndBiome registerSubBiome(EndBiome.Config biomeConfig, EndBiome parent) {
|
||||
return EndBiome.createSubBiome(biomeConfig, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers {@link EndBiome} and adds it into worldgen.
|
||||
*
|
||||
* @param biomeConfig - {@link EndBiome.Config} instance
|
||||
* @param type - {@link BiomeType}
|
||||
* @return registered {@link EndBiome}
|
||||
*/
|
||||
public static EndBiome registerBiome(EndBiome.Config biomeConfig, BiomeType type) {
|
||||
final EndBiome biome = EndBiome.create(biomeConfig);
|
||||
ALL_BE_BIOMES.add(biome);
|
||||
return biome;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put integration sub-biome {@link EndBiome} into subbiomes list and registers it.
|
||||
*
|
||||
|
@ -136,7 +74,7 @@ public class EndBiomes {
|
|||
*/
|
||||
public static EndBiome registerSubBiomeIntegration(EndBiome.Config biomeConfig) {
|
||||
//TODO: 1.19.3 this was don on runtime, but biomes are now created in DataGen, so we need a fix...
|
||||
return EndBiome.create(biomeConfig);
|
||||
return EndBiome.create(biomeConfig, BiomeAPI.BiomeType.END_LAND);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,10 +92,6 @@ public class EndBiomes {
|
|||
}
|
||||
}
|
||||
|
||||
public static EndCaveBiome registerCaveBiome(EndCaveBiome.Config biomeConfig) {
|
||||
return EndCaveBiome.create(biomeConfig);
|
||||
}
|
||||
|
||||
public static BiomePicker.ActualBiome getCaveBiome(int x, int z) {
|
||||
return caveBiomeMap.getBiome(x, 5, z);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.minecraft.world.level.levelgen.SurfaceRules;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
||||
public static final Codec<EndBiome> CODEC = RecordCodecBuilder.create(instance ->
|
||||
|
@ -173,15 +174,15 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
|||
super(biomeID, settings);
|
||||
}
|
||||
|
||||
public static EndBiome create(Config biomeConfig) {
|
||||
return create(biomeConfig, null);
|
||||
public static EndBiome create(Config biomeConfig, BiomeAPI.BiomeType type) {
|
||||
return create(biomeConfig, type, null);
|
||||
}
|
||||
|
||||
public static EndBiome createSubBiome(Config data, BCLBiome parentBiome) {
|
||||
return create(data, parentBiome);
|
||||
public static EndBiome createSubBiome(Config data, @NotNull BCLBiome parentBiome) {
|
||||
return create(data, parentBiome.getIntendedType(), parentBiome);
|
||||
}
|
||||
|
||||
private static EndBiome create(Config biomeConfig, BCLBiome parentBiome) {
|
||||
private static EndBiome create(Config biomeConfig, BiomeAPI.BiomeType type, BCLBiome parentBiome) {
|
||||
BCLBiomeBuilder builder = BCLBiomeBuilder
|
||||
.start(biomeConfig.ID)
|
||||
.music(SoundEvents.MUSIC_END)
|
||||
|
@ -195,7 +196,7 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
|||
.parentBiome(parentBiome)
|
||||
.precipitation(Biome.Precipitation.NONE)
|
||||
.surface(biomeConfig.surfaceMaterial().surface().build())
|
||||
.endLandBiome();
|
||||
.type(type);
|
||||
|
||||
biomeConfig.addCustomBuildData(builder);
|
||||
EndFeatures.addDefaultFeatures(biomeConfig.ID, builder, biomeConfig.hasCaves());
|
||||
|
@ -263,4 +264,8 @@ public class EndBiome extends BCLBiome implements SurfaceMaterialProvider {
|
|||
public static BlockState findUnderMaterial(WorldGenLevel world, BlockPos pos) {
|
||||
return findUnderMaterial(BiomeAPI.getBiome(world.getBiome(pos)));
|
||||
}
|
||||
|
||||
public static List<BCLBiome> getAllBeBiomes() {
|
||||
return BiomeAPI.getAllBiomes(BiomeAPI.BiomeType.END);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,6 +179,6 @@ public class EndCaveBiome extends EndBiome {
|
|||
}
|
||||
|
||||
public static EndCaveBiome create(EndBiome.Config biomeConfig) {
|
||||
return (EndCaveBiome) EndBiome.create(biomeConfig);
|
||||
return (EndCaveBiome) EndBiome.create(biomeConfig, EndBiomes.END_CAVE);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue