Fixes for SurfaceRules and Feature code cleanup
This commit is contained in:
parent
4f7d0939e3
commit
7e981ca1d9
4 changed files with 8 additions and 63 deletions
|
@ -688,24 +688,7 @@ public class BCLBiomeBuilder {
|
||||||
builder.mobSpawnSettings(getSpawns().build());
|
builder.mobSpawnSettings(getSpawns().build());
|
||||||
builder.specialEffects(getEffects().build());
|
builder.specialEffects(getEffects().build());
|
||||||
|
|
||||||
Map<Decoration, List<Holder<PlacedFeature>>> defferedFeatures = Maps.newHashMap();
|
builder.generationSettings(fixGenerationSettings(getGeneration().build()));
|
||||||
BiomeGenerationSettingsAccessor acc = BiomeGenerationSettingsAccessor.class.cast(getGeneration().build());
|
|
||||||
if (acc != null) {
|
|
||||||
builder.generationSettings(fixGenerationSettings(new BiomeGenerationSettings.Builder().build()));
|
|
||||||
List<HolderSet<PlacedFeature>> decorations = acc.bclib_getFeatures();
|
|
||||||
for (Decoration d : Decoration.values()) {
|
|
||||||
int i = d.ordinal();
|
|
||||||
if (i>=0 && i<decorations.size()) {
|
|
||||||
HolderSet<PlacedFeature> features = decorations.get(i);
|
|
||||||
defferedFeatures.put(d, features.stream().collect(Collectors.toList()));
|
|
||||||
} else {
|
|
||||||
defferedFeatures.put(d, Lists.newArrayList());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
builder.generationSettings(fixGenerationSettings(getGeneration().build()));
|
|
||||||
}
|
|
||||||
|
|
||||||
BCLBiomeSettings settings = BCLBiomeSettings.createBCL()
|
BCLBiomeSettings settings = BCLBiomeSettings.createBCL()
|
||||||
.setTerrainHeight(height)
|
.setTerrainHeight(height)
|
||||||
|
@ -720,7 +703,6 @@ public class BCLBiomeBuilder {
|
||||||
final T res = biomeConstructor.apply(biomeID, biome, settings);
|
final T res = biomeConstructor.apply(biomeID, biome, settings);
|
||||||
res.attachStructures(structureTags);
|
res.attachStructures(structureTags);
|
||||||
res.setSurface(surfaceRule);
|
res.setSurface(surfaceRule);
|
||||||
res.setFeatures(defferedFeatures);
|
|
||||||
|
|
||||||
//carvers.forEach(cfg -> BiomeAPI.addBiomeCarver(biome, cfg.second, cfg.first));
|
//carvers.forEach(cfg -> BiomeAPI.addBiomeCarver(biome, cfg.second, cfg.first));
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -504,9 +504,9 @@ public class BiomeAPI {
|
||||||
final BiomeSource source = chunkGenerator.getBiomeSource();
|
final BiomeSource source = chunkGenerator.getBiomeSource();
|
||||||
final Set<Holder<Biome>> biomes = source.possibleBiomes();
|
final Set<Holder<Biome>> biomes = source.possibleBiomes();
|
||||||
|
|
||||||
//TODO: 1.18.2 Is this stilla valid way to determine the correct noiseGeneratorSettings for the level?
|
if (chunkGenerator instanceof NoiseGeneratorSettingsProvider gen)
|
||||||
|
noiseGeneratorSettings = gen.bclib_getNoiseGeneratorSettings();
|
||||||
final Registry<StructureSet> structureSetRegistry;
|
/*final Registry<StructureSet> structureSetRegistry;
|
||||||
if (chunkGenerator instanceof ChunkGeneratorAccessor acc) {
|
if (chunkGenerator instanceof ChunkGeneratorAccessor acc) {
|
||||||
structureSetRegistry = acc.bclib_getStructureSetsRegistry();
|
structureSetRegistry = acc.bclib_getStructureSetsRegistry();
|
||||||
} else {
|
} else {
|
||||||
|
@ -524,7 +524,7 @@ public class BiomeAPI {
|
||||||
.filter(gen-> structureSetRegistry!=null && (gen instanceof NoiseGeneratorSettingsProvider) && (gen instanceof ChunkGeneratorAccessor) && ((ChunkGeneratorAccessor)gen).bclib_getStructureSetsRegistry()==structureSetRegistry)
|
.filter(gen-> structureSetRegistry!=null && (gen instanceof NoiseGeneratorSettingsProvider) && (gen instanceof ChunkGeneratorAccessor) && ((ChunkGeneratorAccessor)gen).bclib_getStructureSetsRegistry()==structureSetRegistry)
|
||||||
.map(gen->((NoiseGeneratorSettingsProvider)gen).bclib_getNoiseGeneratorSettings())
|
.map(gen->((NoiseGeneratorSettingsProvider)gen).bclib_getNoiseGeneratorSettings())
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);*/
|
||||||
|
|
||||||
|
|
||||||
// Datapacks (like Amplified Nether)will change the GeneratorSettings upon load, so we will
|
// Datapacks (like Amplified Nether)will change the GeneratorSettings upon load, so we will
|
||||||
|
@ -568,11 +568,6 @@ public class BiomeAPI {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
final BCLBiome bclBiome = BiomeAPI.getBiome(biome);
|
|
||||||
if (bclBiome != null) {
|
|
||||||
addStepFeaturesToBiome(biome, bclBiome.getFeatures());
|
|
||||||
}
|
|
||||||
|
|
||||||
sortBiomeFeatures(biome);
|
sortBiomeFeatures(biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -675,20 +670,6 @@ public class BiomeAPI {
|
||||||
accessor.bclib_setFlowerFeatures(flowerFeatures);
|
accessor.bclib_setFlowerFeatures(flowerFeatures);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* For internal use only!
|
|
||||||
*
|
|
||||||
* Adds new features to existing biome. Called from {@link #applyModificationsAndUpdateFeatures(List, Holder)}} when the Biome is
|
|
||||||
* present in any {@link BiomeSource}
|
|
||||||
* @param biome {@link Biome} to add features in.
|
|
||||||
* @param featureMap Map of {@link ConfiguredFeature} to add.
|
|
||||||
*/
|
|
||||||
private static void addStepFeaturesToBiome(Holder<Biome> biome, Map<Decoration, List<Holder<PlacedFeature>>> featureMap) {
|
|
||||||
for (Decoration step: featureMap.keySet()) {
|
|
||||||
addBiomeFeature(biome, step, featureMap.get(step));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds new carver into existing biome.
|
* Adds new carver into existing biome.
|
||||||
* @param biome {@link Biome} to add carver in.
|
* @param biome {@link Biome} to add carver in.
|
||||||
|
|
|
@ -26,14 +26,14 @@ public class NoiseGeneratorSettingsMixin implements SurfaceRuleProvider {
|
||||||
private SurfaceRules.RuleSource bclib_originalSurfaceRule;
|
private SurfaceRules.RuleSource bclib_originalSurfaceRule;
|
||||||
private Set<BiomeSource> bclib_biomeSources = new HashSet<>();
|
private Set<BiomeSource> bclib_biomeSources = new HashSet<>();
|
||||||
|
|
||||||
private void bclib_updateCutomRules(){
|
private void bclib_updateCustomRules(){
|
||||||
bclib_setCustomRules(BiomeAPI.getRuleSources(bclib_biomeSources));
|
bclib_setCustomRules(BiomeAPI.getRuleSources(bclib_biomeSources));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bclib_addBiomeSource(BiomeSource source) {
|
public void bclib_addBiomeSource(BiomeSource source) {
|
||||||
bclib_biomeSources.add(source);
|
bclib_biomeSources.add(source);
|
||||||
bclib_updateCutomRules();
|
bclib_updateCustomRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -306,25 +306,7 @@ public class BCLBiome extends BCLBiomeSettings {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Decoration, List<Holder<PlacedFeature>>> features = Maps.newHashMap();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the biome features.
|
|
||||||
* @param features the feature list.
|
|
||||||
*/
|
|
||||||
public void setFeatures(Map<Decoration, List<Holder<PlacedFeature>>> features) {
|
|
||||||
this.features = features;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the built-in set of Features for this biome (as they were set with {@link #setFeatures(Map)})
|
|
||||||
* @return List of all features
|
|
||||||
*/
|
|
||||||
public Map<Decoration, List<Holder<PlacedFeature>>> getFeatures(){
|
|
||||||
return features;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the group used in the config Files for this biome
|
* Returns the group used in the config Files for this biome
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue