Skip to content

Add Cooking and Brewing Fuel Item Components - #14247

Open
MiniDigger wants to merge 3 commits into
dev/26.3from
feat/fuel-data-components
Open

Add Cooking and Brewing Fuel Item Components#14247
MiniDigger wants to merge 3 commits into
dev/26.3from
feat/fuel-data-components

Conversation

@MiniDigger

@MiniDigger MiniDigger commented Sep 11, 2026

Copy link
Copy Markdown
Member
        this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, event -> {
            final Commands commands = event.registrar();
            commands.register(Commands.literal("test")
                .executes((ctx) -> {
                    Player p = ctx.getSource().getPlayerOrThrow();
                    p.sendPlainMessage("Test");
                    LootContext lootContext = new LootContext.Builder(p.getLocation()).build();
                    ItemStack itemInMainHand = p.getInventory().getItemInMainHand();
                    if (itemInMainHand.hasData(DataComponentTypes.COOKING_FUEL)) {
                        CookingFuel cookingFuel = itemInMainHand.getData(DataComponentTypes.COOKING_FUEL);
                        p.sendPlainMessage("cooking fuel " + cookingFuel.burnTime().resolve(lootContext, 0) + " " + cookingFuel.speedMultiplier().resolve(lootContext, 0));
                    }
                    if (itemInMainHand.hasData(DataComponentTypes.BREWING_FUEL)) {
                        BrewingFuel brewingFuel = itemInMainHand.getData(DataComponentTypes.BREWING_FUEL);
                        p.sendPlainMessage("brewing fuel " + brewingFuel.uses().resolve(lootContext, 0) + " " + brewingFuel.speedMultiplier().resolve(lootContext, 0));
                    }
                    itemInMainHand.setData(DataComponentTypes.COOKING_FUEL, CookingFuel.cookingFuel().burnTime(1).speedMultiplier(1000).build());
                    itemInMainHand.setData(DataComponentTypes.BREWING_FUEL, BrewingFuel.brewingFuel().uses(1).speedMultiplier(1000).build());
                    return 1;
                }).build()
            );
        });
    @EventHandler
    void onPlayerInteract(PlayerInteractEvent event) {
        final Player p = event.getPlayer();
        if (event.getClickedBlock() != null && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
            p.sendPlainMessage("Interact with block " + event.getClickedBlock().getType());
            LootContext lootContext = new LootContext.Builder(event.getClickedBlock().getLocation()).build();
            ItemStack itemInMainHand = p.getInventory().getItemInMainHand();
            final CookingFuel cookingFuel = itemInMainHand.getData(DataComponentTypes.COOKING_FUEL);
            if (cookingFuel != null) {
                p.sendPlainMessage("cooking fuel " + cookingFuel.burnTime().resolve(lootContext, 0) + " " + cookingFuel.speedMultiplier().resolve(lootContext, 0));
            }
            final BrewingFuel brewingFuel = itemInMainHand.getData(DataComponentTypes.BREWING_FUEL);
            if (brewingFuel != null) {
                p.sendPlainMessage("brewing fuel " + brewingFuel.uses().resolve(lootContext, 0) + " " + brewingFuel.speedMultiplier().resolve(lootContext, 0));
            }
        }
    }

@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Sep 11, 2026
@Lulu13022002 Lulu13022002 added the dev/next Changes related to the snapshot / next branch label Sep 11, 2026
@MiniDigger
MiniDigger force-pushed the feat/fuel-data-components branch 5 times, most recently from a7538dc to e5d40d1 Compare September 12, 2026 13:44
@MiniDigger
MiniDigger force-pushed the feat/fuel-data-components branch from e5d40d1 to 86d0b97 Compare September 12, 2026 13:45
@MiniDigger
MiniDigger marked this pull request as ready for review September 12, 2026 13:47
@MiniDigger
MiniDigger requested a review from a team as a code owner September 12, 2026 13:47
- Remove reduntant annotations from components
- Move annotations to package-info.java (and create missing)
- Add NullMarked where missing
- Remove convenience methods for ResolvableFloat/Int and improvement the pattern match
- Move the logic for lootcontext to a proper Craft Class (mostly for visual... this is going to be changed when #12778) and a few changes because I don't like yellow marks...
- Add missing Javadocs for ResolvableFloat and ResolvableInt
- Remove ignored components because they are implemented now

@Doc94 Doc94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing the reference Resolvable but that can be handle later for any when wanna touch Composter :)

@papermc-projects papermc-projects Bot moved this from Awaiting review to Delayed approval in Paper PR Queue Sep 12, 2026
@Lulu13022002 Lulu13022002 added the status: blocked Issue or Request is waiting on some other issue or change. label Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev/next Changes related to the snapshot / next branch status: blocked Issue or Request is waiting on some other issue or change.

Projects

Status: Delayed approval

Development

Successfully merging this pull request may close these issues.

3 participants