Old Biomes

This commit is contained in:
Frank 2022-06-06 23:34:25 +02:00
parent 505006ed17
commit 56e63f3ce2
6 changed files with 37 additions and 15 deletions

View file

@ -1,7 +1,7 @@
name: Report a Bug name: Report a Bug
description: File a bug report description: File a bug report
title: "[Bug] " title: "[Bug] "
labels: ["bug"] labels: [ "bug" ]
body: body:
- type: markdown - type: markdown
attributes: attributes:
@ -50,7 +50,7 @@ body:
label: Minecraft label: Minecraft
description: What version of Minecraft is installed? description: What version of Minecraft is installed?
options: options:
- 1.19-snapshot - 1.19
- 1.18.2 - 1.18.2
- 1.18.1 - 1.18.1
- 1.18 - 1.18

View file

@ -22,7 +22,7 @@ import org.betterx.bclib.api.features.config.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Optional; import java.util.Optional;
public class BCLFeature { public class BCLFeature<F extends Feature<FC>, FC extends FeatureConfiguration> {
public static final Feature<PlaceFacingBlockConfig> PLACE_BLOCK = register( public static final Feature<PlaceFacingBlockConfig> PLACE_BLOCK = register(
BCLib.makeID("place_block"), BCLib.makeID("place_block"),
new PlaceBlockFeature<>(PlaceFacingBlockConfig.CODEC)); new PlaceBlockFeature<>(PlaceFacingBlockConfig.CODEC));
@ -48,24 +48,27 @@ public class BCLFeature {
new ConditionFeature()); new ConditionFeature());
private final Holder<PlacedFeature> placedFeature; private final Holder<PlacedFeature> placedFeature;
private final Decoration featureStep; private final Decoration featureStep;
private final Feature<?> feature; private final F feature;
private final FC configuration;
public <FC extends FeatureConfiguration, F extends Feature<FC>> BCLFeature(ResourceLocation id, public BCLFeature(ResourceLocation id,
F feature, F feature,
Decoration featureStep, Decoration featureStep,
FC configuration, FC configuration,
PlacementModifier[] modifiers) { PlacementModifier[] modifiers) {
this(id, feature, featureStep, buildPlacedFeature(id, feature, configuration, modifiers)); this(id, feature, featureStep, configuration, buildPlacedFeature(id, feature, configuration, modifiers));
} }
public BCLFeature(ResourceLocation id, public BCLFeature(ResourceLocation id,
Feature<?> feature, F feature,
Decoration featureStep, Decoration featureStep,
FC configuration,
Holder<PlacedFeature> placedFeature) { Holder<PlacedFeature> placedFeature) {
this.placedFeature = placedFeature; this.placedFeature = placedFeature;
this.featureStep = featureStep; this.featureStep = featureStep;
this.feature = feature; this.feature = feature;
this.configuration = configuration;
if (!BuiltinRegistries.PLACED_FEATURE.containsKey(id)) { if (!BuiltinRegistries.PLACED_FEATURE.containsKey(id)) {
Registry.register(BuiltinRegistries.PLACED_FEATURE, id, placedFeature.value()); Registry.register(BuiltinRegistries.PLACED_FEATURE, id, placedFeature.value());
@ -119,7 +122,7 @@ public class BCLFeature {
* *
* @return {@link Feature}. * @return {@link Feature}.
*/ */
public Feature<?> getFeature() { public F getFeature() {
return feature; return feature;
} }
@ -140,4 +143,8 @@ public class BCLFeature {
public Decoration getDecoration() { public Decoration getDecoration() {
return featureStep; return featureStep;
} }
public FC getConfiguration() {
return configuration;
}
} }

View file

@ -64,6 +64,16 @@ public class FastFeatures {
new SimpleBlockConfiguration(BlockStateProvider.simple(block))); new SimpleBlockConfiguration(BlockStateProvider.simple(block)));
} }
public static BCLFeature
patch(ResourceLocation location, BlockStateProvider provider, int attempts, int xzSpread, int ySpread) {
return patch(location,
attempts,
xzSpread,
ySpread,
Feature.SIMPLE_BLOCK,
new SimpleBlockConfiguration(provider));
}
public static BCLFeature patchWitRandomInt(ResourceLocation location, Block block, IntegerProperty prop) { public static BCLFeature patchWitRandomInt(ResourceLocation location, Block block, IntegerProperty prop) {
return patchWitRandomInt(location, block, prop, 96, 7, 3); return patchWitRandomInt(location, block, prop, 96, 7, 3);
} }

View file

@ -23,7 +23,7 @@ public class SequenceFeatureConfig implements FeatureConfiguration {
private final List<Holder<PlacedFeature>> features; private final List<Holder<PlacedFeature>> features;
public static SequenceFeatureConfig create(List<BCLFeature> features) { public static SequenceFeatureConfig create(List<BCLFeature<?, ?>> features) {
return new SequenceFeatureConfig(features.stream().map(f -> f.getPlacedFeature()).toList()); return new SequenceFeatureConfig(features.stream().map(f -> f.getPlacedFeature()).toList());
} }

View file

@ -65,6 +65,7 @@ public class CommonBlockTags {
NETHER_ORES, NETHER_ORES,
SOUL_GROUND, SOUL_GROUND,
NETHER_MYCELIUM, NETHER_MYCELIUM,
MYCELIUM,
END_STONES); END_STONES);
TagAPI.BLOCKS.add(MYCELIUM, Blocks.MYCELIUM); TagAPI.BLOCKS.add(MYCELIUM, Blocks.MYCELIUM);

View file

@ -69,7 +69,11 @@ public abstract class ModIntegration {
Feature<?> feature = Registry.FEATURE.get(id); Feature<?> feature = Registry.FEATURE.get(id);
Holder<PlacedFeature> featurePlaced = BuiltinRegistries.PLACED_FEATURE.getHolder(getFeatureKey(placedFeatureID)) Holder<PlacedFeature> featurePlaced = BuiltinRegistries.PLACED_FEATURE.getHolder(getFeatureKey(placedFeatureID))
.orElse(null); .orElse(null);
return new BCLFeature(id, feature, featureStep, featurePlaced); return new BCLFeature(id,
feature,
featureStep,
featurePlaced.value().getFeatures().map(f -> f.config()).findFirst().orElse(null),
featurePlaced);
} }
public BCLFeature getFeature(String name, GenerationStep.Decoration featureStep) { public BCLFeature getFeature(String name, GenerationStep.Decoration featureStep) {