diff --git a/docs/advanced/featureflags.md b/docs/advanced/featureflags.md index 73615a81..98390744 100644 --- a/docs/advanced/featureflags.md +++ b/docs/advanced/featureflags.md @@ -55,7 +55,7 @@ In order to flag a given `FeatureElement` as requiring your Feature Flag, you si - `Item`: `Item.Properties#requiredFeatures` - `Block`: `BlockBehaviour.Properties#requiredFeatures` - `EntityType`: `EntityType.Builder#requiredFeatures` -- `MenuType`: `IMenuTypeExtension#create` +- `MenuType`: `MenuType#new` - `Potion`: `Potion#requiredFeatures` - `MobEffect`: `MobEffect#requiredFeatures` @@ -89,9 +89,18 @@ DeferredHolder, EntityType> EXPERIMENTAL_ENTIT // MenuType DeferredRegister> MENU_TYPES = DeferredRegister.create(Registries.MENU, "examplemod"); -DeferredHolder, MenuType> EXPERIMENTAL_MENU = MENU_TYPES.register("experimental", () -> IMenuTypeExtension.create( - ExperimentalMenu::new, - EXPERIMENTAL // mark as requiring the 'EXPERIMENTAL' flag +DeferredHolder, MenuType> EXPERIMENTAL_MENU = MENU_TYPES.register("experimental", () -> new MenuType<>( + // Using Vanilla MenuSupplier + // This is used when your menu is not encoding complex data during `player.openMenu` + // (windowId, inventory) -> new ExperimentalMenu(windowId, inventory), + + // Using NeoForge IContainerFactory + // This is used when you wish to read complex data encoded during `player.openMenu` + // Casting here is important as `MenuType` specificly wants `MenuSupplier` + (IContainerFactory) (windowId, inventory, buffer) -> new ExperimentalMenu(windowId, inventory, buffer), + + // mark as requiring the 'EXPERIMENTAL' flag + FeatureFlagSet.of(EXPERIMENTAL) )); // MobEffect @@ -248,11 +257,20 @@ public static void gatherData(final GatherDataEvent event) { var generator = event.getGenerator(); // The generate a Feature Pack you must first obtain a pack generator instance for the desired pack. + + // make use of provided utility method // generator.getBuiltinDatapack(, , ); // this will generate the feature pack into the following path // ./data//datapacks/ var featurePack = generator.getBuiltinDatapack(true, "examplemod", "experimental"); + // construct the pack generator your self + // this allows generating your feature pack into a custom location + // new DataGenerator.PackGenerator(, , generator.getPackOutput()); + // this will generate the feature pack into the following path + // ./ + // var featurePack = new DataGenerator.PackGenerator(true, "examplemod", generator.getPackOutput("experimental")); + // Do take note of the generated pack location, as this is where Built-In packs should point their `packLocation` towards. // register a provider to generate the `pack.mcmeta` file