Skip to content

Rename text preprocess, direct item set methods#400

Open
KamikotoTkach wants to merge 1 commit intoWesJD:masterfrom
KamikotoTkach:feature/extend-api
Open

Rename text preprocess, direct item set methods#400
KamikotoTkach wants to merge 1 commit intoWesJD:masterfrom
KamikotoTkach:feature/extend-api

Conversation

@KamikotoTkach
Copy link
Copy Markdown

@KamikotoTkach KamikotoTkach commented Apr 6, 2026

Pull Request Description

I’ve added the following methods:

interface AnvilContainerWrapper {
    default void setRenameVisitor(Function<String, ItemStack> renameVisitor) {}
    default void setLeftItem(ItemStack item) {}
    default void setMiddleItem(ItemStack item) {}
    default void setRightItem(ItemStack item) {}
}

Changes Overview

  • renameVisitor — a preprocessor for user input text. This allows formatting or transforming the text before it is directly applied to the item name.
  • set*Item methods — allow setting items directly into specific slots. This enables logic such as:
    “If the player enters 0 — replace item X with a red block displaying an error message.”

Implementation Notes

  • Implemented for Minecraft 1.16.5 as a reference example.
  • Tested on a production server I maintain.
  • No issues have been observed over the past 6 months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant