Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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?

  • Author

Welp, that was dumb of me. I've been working on this for ~8 hours so I think my brains a bit melted. Time to take a walk I suppose.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.