Fixed duplicate feature registration

This commit is contained in:
paulevsGitch 2021-12-23 04:56:18 +03:00
parent 6abf34d8bc
commit 544af449ee
2 changed files with 12 additions and 10 deletions

View file

@ -60,9 +60,10 @@ public abstract class ModIntegration {
}
public BCLFeature getFeature(String featureID, String placedFeatureID, GenerationStep.Decoration featureStep) {
Feature<?> feature = Registry.FEATURE.get(getID(featureID));
ResourceLocation id = getID(featureID);
Feature<?> feature = Registry.FEATURE.get(id);
PlacedFeature featureConfigured = BuiltinRegistries.PLACED_FEATURE.get(getID(placedFeatureID));
return new BCLFeature(feature, featureConfigured, featureStep);
return new BCLFeature(id, feature, featureStep, featureConfigured);
}
public BCLFeature getFeature(String name, GenerationStep.Decoration featureStep) {

View file

@ -19,16 +19,17 @@ public class BCLFeature {
private Decoration featureStep;
private Feature<?> feature;
public BCLFeature(Feature<?> feature, PlacedFeature placedFeature, Decoration featureStep) {
this.placedFeature = placedFeature;
this.featureStep = featureStep;
this.feature = feature;
}
public BCLFeature(ResourceLocation id, Feature<?> feature, Decoration featureStep, PlacedFeature placedFeature) {
this.placedFeature = Registry.register(BuiltinRegistries.PLACED_FEATURE, id, placedFeature);
this.feature = Registry.register(Registry.FEATURE, id, feature);
this.placedFeature = placedFeature;
this.feature = feature;
this.featureStep = featureStep;
if (!BuiltinRegistries.PLACED_FEATURE.containsKey(id)) {
Registry.register(BuiltinRegistries.PLACED_FEATURE, id, placedFeature);
}
if (!Registry.FEATURE.containsKey(id)) {
Registry.register(Registry.FEATURE, id, feature);
}
}
/**