Jump to content

Trouble with registering features (1.16.3)


jbko6

Recommended Posts

I'm having trouble registering a feature and using it in json files. I have a "AsteroidFeature" class:

public class AsteroidFeature<C extends IFeatureConfig> extends Feature<NoFeatureConfig> {

    int steps;
    int check;
    ArrayList<BlockPos> plannedPos = new ArrayList<>();
    ArrayList<BlockPos> plannedPosDone = new ArrayList<>();

    public AsteroidFeature(Codec<NoFeatureConfig> codec) {
        super(codec);
    }


    @Override
    public boolean func_241855_a(ISeedReader reader , ChunkGenerator generator, Random rand, BlockPos pos, NoFeatureConfig config) {
        if (pos.getY() <= 60) {return false;}
        // do stuff
        return true;
    }
}

... and a registering class:

public abstract class Feature<FC extends IFeatureConfig> extends net.minecraftforge.registries.ForgeRegistryEntry<Feature<?>> {
    public static final AsteroidFeature<IFeatureConfig> ASTEROID = register(new ResourceLocation(VanillaSpace.MOD_ID, "asteroid"), new AsteroidFeature<>(NoFeatureConfig.field_236558_a_));

    private static <C extends IFeatureConfig, F extends net.minecraft.world.gen.feature.Feature<C>> F register(ResourceLocation key, F value) {
        return Registry.register(Registry.FEATURE, key, value);
    }

}

I've been basing these classes off of the "ForestRock" feature. I am adding the feature to a custom biome I created so I don't think I need to do any of the BiomeLoadingEvent stuff (correct me if I'm wrong about that). However, when I try and create a world, I get this error:

[17:14:09] [Render thread/ERROR] [minecraft/BiomeGenerationSettings]: Feature: Not a JSON object: "vspace:asteroid"
[17:14:09] [Render thread/ERROR] [minecraft/DynamicRegistries]: Error loading registry data: Unknown registry key: vspace:asteroid

 

Honestly, I'm not sure what to do about this anymore.

Link to comment
Share on other sites

1 hour ago, jbko6 said:

public abstract class Feature<FC extends IFeatureConfig> extends net.minecraftforge.registries.ForgeRegistryEntry<Feature<?>> { public static final AsteroidFeature<IFeatureConfig> ASTEROID = register(new ResourceLocation(VanillaSpace.MOD_ID, "asteroid"), new AsteroidFeature<>(NoFeatureConfig.field_236558_a_)); private static <C extends IFeatureConfig, F extends net.minecraft.world.gen.feature.Feature<C>> F register(ResourceLocation key, F value) { return Registry.register(Registry.FEATURE, key, value); } }

You do know how to register something correct?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.