下面列出了怎么用net.minecraft.world.biome.layer.ScaleLayer的API类实例代码及写法,或者点击链接到github查看源代码。
private static <T extends LayerSampler, C extends LayerSampleContext<T>> LayerFactory<T> build(int biomeSize, int riverSize, LongFunction<C> contextProvider) {
LayerFactory<T> layerFactory = MoonBaseBiomeLayer.INSTANCE.create(contextProvider.apply(1L));
layerFactory = ScaleLayer.FUZZY.create(contextProvider.apply(2000L), layerFactory);
layerFactory = MoonBiomeRockLayer.INSTANCE.create(contextProvider.apply(1999L), layerFactory);
layerFactory = MoonBiomeCraterLayer.INSTANCE.create(contextProvider.apply(2003L), layerFactory);
layerFactory = ScaleLayer.NORMAL.create(contextProvider.apply(2004L), layerFactory);
layerFactory = MoonValleyLayer.INSTANCE.create(contextProvider.apply(2001L), layerFactory);
// layerFactory = AddIslandLayer.INSTANCE.create(contextProvider.apply(2L), layerFactory);
// LayerFactory<T> layerFactory2 = OceanTemperatureLayer.INSTANCE.create(contextProvider.apply(2L));
// layerFactory2 = stack(2001L, ScaleLayer.NORMAL, layerFactory2, 6, contextProvider);
// layerFactory = AddColdClimatesLayer.INSTANCE.create(contextProvider.apply(2L), layerFactory);
// layerFactory = IncreaseEdgeCurvatureLayer.INSTANCE.create(contextProvider.apply(3L), layerFactory);
// layerFactory = AddClimateLayers.AddTemperateBiomesLayer.INSTANCE.create(contextProvider.apply(2L), layerFactory);
// layerFactory = AddClimateLayers.AddCoolBiomesLayer.INSTANCE.create(contextProvider.apply(2L), layerFactory);
// layerFactory = AddClimateLayers.AddSpecialBiomesLayer.INSTANCE.create(contextProvider.apply(3L), layerFactory);
// layerFactory = ScaleLayer.NORMAL.create(contextProvider.apply(2002L), layerFactory);
// layerFactory = ScaleLayer.NORMAL.create(contextProvider.apply(2003L), layerFactory);
// layerFactory = IncreaseEdgeCurvatureLayer.INSTANCE.create(contextProvider.apply(4L), layerFactory);
// layerFactory = AddMushroomIslandLayer.INSTANCE.create(contextProvider.apply(5L), layerFactory);
// layerFactory = AddDeepOceanLayer.INSTANCE.create(contextProvider.apply(4L), layerFactory);
// layerFactory = stack(1000L, ScaleLayer.NORMAL, layerFactory, 0, contextProvider);
// LayerFactory<T> layerFactory3 = stack(1000L, ScaleLayer.NORMAL, layerFactory, 0, contextProvider);
// layerFactory3 = SimpleLandNoiseLayer.INSTANCE.create(contextProvider.apply(100L), layerFactory3);
// LayerFactory<T> layerFactory4 = (new SetBaseBiomesLayer(old)).create(contextProvider.apply(200L), layerFactory);
// layerFactory4 = AddBambooJungleLayer.INSTANCE.create(contextProvider.apply(1001L), layerFactory4);
// layerFactory4 = stack(1000L, ScaleLayer.NORMAL, layerFactory4, 2, contextProvider);
// layerFactory4 = EaseBiomeEdgeLayer.INSTANCE.create(contextProvider.apply(1000L), layerFactory4);
// LayerFactory<T> layerFactory5 = stack(1000L, ScaleLayer.NORMAL, layerFactory3, 2, contextProvider);
// layerFactory4 = AddHillsLayer.INSTANCE.create(contextProvider.apply(1000L), layerFactory4, layerFactory5);
// layerFactory3 = stack(1000L, ScaleLayer.NORMAL, layerFactory3, 2, contextProvider);
// layerFactory3 = stack(1000L, ScaleLayer.NORMAL, layerFactory3, riverSize, contextProvider);
// layerFactory3 = NoiseToRiverLayer.INSTANCE.create(contextProvider.apply(1L), layerFactory3);
// layerFactory3 = SmoothenShorelineLayer.INSTANCE.create(contextProvider.apply(1000L), layerFactory3);
// layerFactory4 = AddSunflowerPlainsLayer.INSTANCE.create(contextProvider.apply(1001L), layerFactory4);
//
for (int i = 0; i < biomeSize; ++i) {
layerFactory = ScaleLayer.NORMAL.create(contextProvider.apply(1000L + i), layerFactory);
if (i == 0) {
layerFactory = IncreaseEdgeCurvatureLayer.INSTANCE.create(contextProvider.apply(3L), layerFactory);
}
// if (i == 1 || biomeSize == 1) {
// layerFactory = AddEdgeBiomesLayer.INSTANCE.create(contextProvider.apply(1000L), layerFactory4);
// }
}
//
// layerFactory4 = SmoothenShorelineLayer.INSTANCE.create(contextProvider.apply(1000L), layerFactory4);
//// layerFactory4 = MoonRavineLayer.INSTANCE.create(contextProvider.apply(100L), layerFactory4, layerFactory3);
// layerFactory4 = ApplyOceanTemperatureLayer.INSTANCE.create(contextProvider.apply(100L), layerFactory4, layerFactory2);
layerFactory = stack(2913L, ScaleLayer.NORMAL, layerFactory, 0, contextProvider);
return layerFactory;
}
private static <R extends LayerSampler, T extends LayerSampleContext<R>> LayerFactory<R> create(LongFunction<T> contextProvider) {
// Biome Groups
LayerFactory<R> biomeInit = SetBiomeGroupsLayer.INSTANCE.create(contextProvider.apply(1L));
biomeInit = ScaleLayer.NORMAL.create(contextProvider.apply(100L), biomeInit);
// Biomes
biomeInit = AddBiomesLayer.INSTANCE.create(contextProvider.apply(20L), biomeInit);
LayerFactory<R> biomes = ScaleLayer.NORMAL.create(contextProvider.apply(1000L), biomeInit);
// Sub Biomes and stuff
biomes = AddSubBiomesLayer.LARGE.create(contextProvider.apply(50L), biomes);
biomes = ScaleLayer.NORMAL.create(contextProvider.apply(1001L), biomes);
biomes = AddHallowedEdgeLayer.INSTANCE.create(contextProvider.apply(54L), biomes);
biomes = AddSubBiomesLayer.HILLS.create(contextProvider.apply(51L), biomes);
biomes = AddSubBiomesLayer.SMALL.create(contextProvider.apply(53L), biomes);
for (int i = 0; i < biomeSize; ++i) {
biomes = ScaleLayer.NORMAL.create(contextProvider.apply(1000L + (long) i), biomes);
if (biomeSize == 1 || i == 1) {
biomes = AddHallowedShoreLayer.DEFAULT.create(contextProvider.apply(52L), biomes);
}
}
biomes = SmoothenShorelineLayer.INSTANCE.create(contextProvider.apply(101L), biomes);
// River
LayerFactory<R> rivers = SimpleLandNoiseLayer.INSTANCE.create(contextProvider.apply(200L), biomeInit);
rivers = ScaleLayer.NORMAL.create(contextProvider.apply(1000L), rivers);
rivers = ScaleLayer.NORMAL.create(contextProvider.apply(1001L), rivers);
for (int i = 0; i < biomeSize - 1; ++i) {
rivers = ScaleLayer.NORMAL.create(contextProvider.apply(1000L + (long) i), rivers);
}
// Noise to river
rivers = NoiseToRiverLayer.INSTANCE.create(contextProvider.apply(201L), rivers);
rivers = ScaleLayer.NORMAL.create(contextProvider.apply(1001L), rivers);
// Mix rivers with biomes
biomes = AddRiversLayer.INSTANCE.create(contextProvider.apply(102L), biomes, rivers);
return biomes;
}
/**
* Allows modifying the {@link LayerFactory} used for this type's biome
* generation.
*
* @param <T> The type of {@link LayerSampler}.
* @param <C> The type of {@link LayerSampleContext}.
* @param parentLayer The parent layer to feed into any layer you return
* @param settings The {@link OverworldChunkGeneratorConfig} used to create the
* {@link SetBaseBiomesLayer}.
* @param contextFactory A {@link LongFunction} factory to create contexts of
* the supplied size.
* @return A {@link LayerFactory} that representing the Biomes to be generated.
* @see SetBaseBiomesLayer
*/
default <T extends LayerSampler, C extends LayerSampleContext<T>> LayerFactory<T> getBiomeLayer(LayerFactory<T> parentLayer, OverworldChunkGeneratorConfig settings, LongFunction<C> contextFactory) {
parentLayer = (new SetBaseBiomesLayer(getWorldType(), settings)).create(contextFactory.apply(200L), parentLayer);
parentLayer = AddBambooJungleLayer.INSTANCE.create(contextFactory.apply(1001L), parentLayer);
parentLayer = AccessorBiomeLayers.patchwork$stack(1000L, ScaleLayer.NORMAL, parentLayer, 2, contextFactory);
parentLayer = EaseBiomeEdgeLayer.INSTANCE.create(contextFactory.apply(1000L), parentLayer);
return parentLayer;
}