Removed old End Caves (temporary), added new Caves and Cave API (WIP)
This commit is contained in:
parent
2135fe50b5
commit
231794363b
14 changed files with 384 additions and 28 deletions
|
@ -4,6 +4,7 @@ import java.io.InputStream;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -45,7 +46,9 @@ 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.generator.BELayerRandomSource;
|
||||
import ru.betterend.world.generator.BiomePicker;
|
||||
|
@ -59,6 +62,7 @@ public class EndBiomes {
|
|||
|
||||
public static final BiomePicker LAND_BIOMES = new BiomePicker();
|
||||
public static final BiomePicker VOID_BIOMES = new BiomePicker();
|
||||
public static final BiomePicker CAVE_BIOMES = new BiomePicker();
|
||||
public static final List<EndBiome> SUBBIOMES = Lists.newArrayList();
|
||||
private static final JsonObject EMPTY_JSON = new JsonObject();
|
||||
|
||||
|
@ -93,6 +97,9 @@ public class EndBiomes {
|
|||
// Better End Void
|
||||
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 void register() {}
|
||||
|
||||
public static void mutateRegistry(Registry<Biome> biomeRegistry) {
|
||||
|
@ -100,6 +107,7 @@ public class EndBiomes {
|
|||
|
||||
LAND_BIOMES.clearMutables();
|
||||
VOID_BIOMES.clearMutables();
|
||||
CAVE_BIOMES.clearMutables();
|
||||
|
||||
if (FABRIC_VOID.isEmpty()) {
|
||||
loadFabricAPIBiomes();
|
||||
|
@ -144,16 +152,9 @@ public class EndBiomes {
|
|||
Integrations.addBiomes();
|
||||
Configs.BIOME_CONFIG.saveChanges();
|
||||
|
||||
LAND_BIOMES.rebuild();
|
||||
VOID_BIOMES.rebuild();
|
||||
|
||||
LAND_BIOMES.getBiomes().forEach((endBiome) -> {
|
||||
endBiome.updateActualBiomes(biomeRegistry);
|
||||
});
|
||||
|
||||
VOID_BIOMES.getBiomes().forEach((endBiome) -> {
|
||||
endBiome.updateActualBiomes(biomeRegistry);
|
||||
});
|
||||
rebuildPicker(LAND_BIOMES, biomeRegistry);
|
||||
rebuildPicker(VOID_BIOMES, biomeRegistry);
|
||||
rebuildPicker(CAVE_BIOMES, biomeRegistry);
|
||||
|
||||
SUBBIOMES.forEach((endBiome) -> {
|
||||
endBiome.updateActualBiomes(biomeRegistry);
|
||||
|
@ -162,6 +163,13 @@ public class EndBiomes {
|
|||
CLIENT.clear();
|
||||
}
|
||||
|
||||
private static void rebuildPicker(BiomePicker picker, Registry<Biome> biomeRegistry) {
|
||||
picker.rebuild();
|
||||
picker.getBiomes().forEach((endBiome) -> {
|
||||
endBiome.updateActualBiomes(biomeRegistry);
|
||||
});
|
||||
}
|
||||
|
||||
private static void loadFabricAPIBiomes() {
|
||||
WeightedBiomePicker picker = InternalBiomeData.getEndBiomesMap().get(BiomeKeys.SMALL_END_ISLANDS);
|
||||
LayerRandomnessSource random = new BELayerRandomSource();
|
||||
|
@ -343,10 +351,12 @@ public class EndBiomes {
|
|||
}
|
||||
|
||||
private static void addToPicker(EndBiome biome, BiomeType type) {
|
||||
if (type == BiomeType.LAND)
|
||||
if (type == BiomeType.LAND) {
|
||||
LAND_BIOMES.addBiome(biome);
|
||||
else
|
||||
}
|
||||
else {
|
||||
VOID_BIOMES.addBiome(biome);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerBiomeDirectly(EndBiome biome) {
|
||||
|
@ -400,4 +410,21 @@ public class EndBiomes {
|
|||
result.addAll(SUBBIOMES);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static EndCaveBiome registerCaveBiome(EndCaveBiome biome) {
|
||||
registerBiomeDirectly(biome);
|
||||
if (Configs.BIOME_CONFIG.getBoolean(biome.getID(), "enabled", true)) {
|
||||
CAVE_BIOMES.addBiome(biome);
|
||||
ID_MAP.put(biome.getID(), biome);
|
||||
}
|
||||
return biome;
|
||||
}
|
||||
|
||||
public static EndCaveBiome getCaveBiome(Random random) {
|
||||
return (EndCaveBiome) CAVE_BIOMES.getBiome(random);
|
||||
}
|
||||
|
||||
public static boolean hasBiome(Identifier biomeID) {
|
||||
return ID_MAP.containsKey(biomeID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import ru.betterend.BetterEnd;
|
|||
import ru.betterend.world.biome.BiomeDefinition;
|
||||
import ru.betterend.world.biome.EndBiome;
|
||||
import ru.betterend.world.features.BlueVineFeature;
|
||||
import ru.betterend.world.features.CavePlantFeature;
|
||||
import ru.betterend.world.features.CharniaFeature;
|
||||
import ru.betterend.world.features.CrashedShipFeature;
|
||||
import ru.betterend.world.features.DoublePlantFeature;
|
||||
|
@ -44,12 +43,12 @@ 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.RoundCaveFeature;
|
||||
import ru.betterend.world.features.terrain.SpireFeature;
|
||||
import ru.betterend.world.features.terrain.SulphurHillFeature;
|
||||
import ru.betterend.world.features.terrain.SulphuricCaveFeature;
|
||||
import ru.betterend.world.features.terrain.SulphuricLakeFeature;
|
||||
import ru.betterend.world.features.terrain.SurfaceVentFeature;
|
||||
import ru.betterend.world.features.terrain.caves.RoundCaveFeature;
|
||||
import ru.betterend.world.features.trees.DragonTreeFeature;
|
||||
import ru.betterend.world.features.trees.GiganticAmaranitaFeature;
|
||||
import ru.betterend.world.features.trees.HelixTreeFeature;
|
||||
|
@ -85,7 +84,6 @@ public class EndFeatures {
|
|||
public static final EndFeature CREEPING_MOSS = new EndFeature("creeping_moss", new SinglePlantFeature(EndBlocks.CREEPING_MOSS, 5), 5);
|
||||
public static final EndFeature BLUE_VINE = new EndFeature("blue_vine", new BlueVineFeature(), 1);
|
||||
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, 6), 9);
|
||||
public static final EndFeature MURKWEED = new EndFeature("murkweed", new SinglePlantFeature(EndBlocks.MURKWEED, 3), 2);
|
||||
|
@ -161,7 +159,6 @@ public class EndFeatures {
|
|||
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);
|
||||
public static final EndFeature END_LAKE_RARE = EndFeature.makeLakeFeature("end_lake_rare", new EndLakeFeature(), 40);
|
||||
public static final EndFeature ROUND_CAVE = EndFeature.makeRawGenFeature("round_cave", new RoundCaveFeature(), 2);
|
||||
public static final EndFeature ROUND_CAVE_RARE = EndFeature.makeRawGenFeature("round_cave_rare", new RoundCaveFeature(), 25);
|
||||
public static final EndFeature SPIRE = EndFeature.makeRawGenFeature("spire", new SpireFeature(), 2);
|
||||
public static final EndFeature FLOATING_SPIRE = EndFeature.makeRawGenFeature("floating_spire", new FloatingSpireFeature(), 8);
|
||||
public static final EndFeature GEYSER = EndFeature.makeRawGenFeature("geyser", new GeyserFeature(), 8);
|
||||
|
@ -215,8 +212,7 @@ public class EndFeatures {
|
|||
addFeature(CRASHED_SHIP, features);
|
||||
|
||||
if (EndBiomes.getBiome(id).hasCaves()) {
|
||||
addFeature(ROUND_CAVE_RARE, features);
|
||||
addFeature(CAVE_GRASS, features);
|
||||
addFeature(ROUND_CAVE, features);
|
||||
}
|
||||
|
||||
EndBiome endBiome = EndBiomes.getBiome(id);
|
||||
|
@ -233,8 +229,7 @@ public class EndFeatures {
|
|||
def.addFeature(CRASHED_SHIP);
|
||||
|
||||
if (def.hasCaves()) {
|
||||
def.addFeature(ROUND_CAVE_RARE);
|
||||
def.addFeature(CAVE_GRASS);
|
||||
def.addFeature(ROUND_CAVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue