TeamREPENTOGON / TeamREPENTOGON/REPENTOGON

Include a predicate argument for MC_EXECUTE_CMD

Open
#629 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
345
Forks
51
Avg merge
11h 2m
Merged PRs (30d)
4

Description

Currently, registering a callback for the MC_EXECUTE_CMD does not allow for an additional argument to filter by what command used. Mods registering to this callback should be able to optionally filter by the command being used.

Example:

-- This adds a callback which is only executed if the "cmd" argument to the callback matches "spawn_item"
mod:AddCallback(ModCallbacks.MC_EXECUTE_CMD, debug_spawn_item, "spawn_item")

This would eliminate the need for mods using Repentogon to include if cmd == "spawn_item" at the beginning of every command's callback. It would also be a minor performance save as the comparison would be made before executing the Lua callback.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the MC_EXECUTE_CMD callback registration and dispatch paths in the C++ code, then review how Lua callback arguments are currently handled. Add optional command filtering so callbacks registered with a command run only for that command, and verify that existing registrations without the argument continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, lua
Domain
api, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.