#Cryptic error about type

1 messages · Page 1 of 1 (latest)

humble elk
#

im getting this very cryptic error message "The type modConfiguredFeatures does not define bootstrap(Registerable<ConfiguredFeature<capture#1-of ?,capture#2-of ?>>) that is applicable here" on this line: java registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE,modConfiguredFeatures::bootstrap); but there is a bootstrap method in that class it looks like this ```java
public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
RuleTest deepslateReplaceables = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);

    List<OreFeatureConfig.Target> overworldCitrineOres =
            List.of(OreFeatureConfig.createTarget(deepslateReplaceables, ModBlocks.DEEPSLATE_TERRAFLUX_ORE.getDefaultState()));

    register(context, TERRAFLUX_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldCitrineOres, 12));
}
oak stirrupBOT
#

<@&987246652869971988> please have a look, thanks.

oak stirrupBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

unkempt dome
#

Seems like you are using an Instance of ModConfiguredFeatures right? If you want a method reference to a static method use Class::method instead of using the instance

humble elk
unkempt dome
#

is modConfiguredFeatures an instance of a class in your code?

humble elk
# unkempt dome is modConfiguredFeatures an instance of a class in your code?

modConfiguredFeatures is a class that i import from another file the class looks like this ```java
public class modConfiguredFeatures {
public static final RegistryKey<ConfiguredFeature<?, ?>> TERRAFLUX_ORE_KEY = registerKey("terraflux-ore");

public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
    RuleTest deepslateReplaceables = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);

    List<OreFeatureConfig.Target> overworldCitrineOres =
            List.of(OreFeatureConfig.createTarget(deepslateReplaceables, ModBlocks.DEEPSLATE_TERRAFLUX_ORE.getDefaultState()));

    register(context, TERRAFLUX_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldCitrineOres, 12));
}

public static RegistryKey<ConfiguredFeature<?, ?>> registerKey(String name) {
    return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, new Identifier(modMain.MOD_ID, name));
}

private static <FC extends FeatureConfig, F extends Feature<FC>> void register(Registerable<ConfiguredFeature<?, ?>> context,
                                                                               RegistryKey<ConfiguredFeature<?, ?>> key, F feature, FC configuration) {
    context.register(key, new ConfiguredFeature<>(feature, configuration));
}

}

oak stirrupBOT
# humble elk modConfiguredFeatures is a class that i import from another file the class looks...

Detected code, here are some useful tools:

Formatted code
public class modConfiguredFeatures {
  public static final RegistryKey<ConfiguredFeature<? , ? >> TERRAFLUX_ORE_KEY = registerKey("terraflux-ore");
  public static void bootstrap(Registerable<ConfiguredFeature<? , ? >> context) {
    RuleTest deepslateReplaceables = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);
    List<OreFeatureConfig.Target> overworldCitrineOres = List.of(OreFeatureConfig.createTarget(deepslateReplaceables, ModBlocks.DEEPSLATE_TERRAFLUX_ORE.getDefaultState()));
    register(context, TERRAFLUX_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldCitrineOres, 12));
  }
  public static RegistryKey<ConfiguredFeature<? , ? >> registerKey(String name) {
    return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, new Identifier(modMain.MOD_ID, name));
  }
  private static <FC extends FeatureConfig, F extends Feature<FC>> void register(Registerable<ConfiguredFeature<? , ? >> context, RegistryKey<ConfiguredFeature<? , ? >> key, F feature, FC configuration) {
    context.register(key, new ConfiguredFeature<>(feature, configuration));
  }
}
#

The naming convention in Java is as follows:

Classes:
PascalCase. Example: GoldMiner, FoodDestroyer, DispenserBuilder

Methods / Fields / Variables:
camelCase. Example: foodAmount, integerValue, goodBoyAsADog

Packages:
All lowercase. Preferably the domain name backwards. Example: "google.com" ==> com.google, "ialistannen.me" ==> me.ialistannen
Followed by the project name. Example: Project "Builder" ==> com.google.builder

Constants/Enum entries:
UPPER_SNAKE_CASE. Where words are separated by underscores. Example: RED_DOG, I_AM_THE_BEST, CONQUER_WORLD

unkempt dome
#

naming things not to standard makes things confusing to read when someone helps you

humble elk
#

oh i had no idea about this java is not my normal language so thats my mad. let me refactor this part for you

humble elk
# unkempt dome naming things not to standard makes things confusing to read when someone helps ...

this is the refactored version java registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE,ModConfiguredFeatures::bootstrap); but there is a bootstrap method in that class it looks like this ```java
public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
RuleTest deepslateReplaceables = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);

    List<OreFeatureConfig.Target> overworldCitrineOres =
            List.of(OreFeatureConfig.createTarget(deepslateReplaceables, ModBlocks.DEEPSLATE_TERRAFLUX_ORE.getDefaultState()));

    register(context, TERRAFLUX_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldCitrineOres, 12));
}