Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creative Inventory Handler Missing #834

Open
KCodeYT opened this issue Dec 20, 2023 · 0 comments
Open

Creative Inventory Handler Missing #834

KCodeYT opened this issue Dec 20, 2023 · 0 comments

Comments

@KCodeYT
Copy link

KCodeYT commented Dec 20, 2023

Description

The creative inventory currently lacks essential features related to item creation and destruction. Unlike other inventories, there is no existing handler interface or methods specifically designed to manage these actions within the creative inventory.

Proposed Solution

To address this deficiency, I recommend to extend the current handler interface to incorporate functions related to item creation and destruction. The existing handler interface for actions performed by a player on an inventory is defined as follows:
https://github.com/df-mc/dragonfly/blob/master/server/item/inventory/handler.go#L8-L18

// Handler is a type that may be used to handle actions performed on an inventory by a player.
type Handler interface {
	// HandleTake handles an item.Stack being taken from a slot in the inventory. This item might be the whole stack or
	// part of the stack currently present in that slot.
	HandleTake(ctx *event.Context, slot int, it item.Stack)
	// HandlePlace handles an item.Stack being placed in a slot of the inventory. It might either be added to an empty
	// slot or a slot that contains an item of the same type.
	HandlePlace(ctx *event.Context, slot int, it item.Stack)
	// HandleDrop handles the dropping of an item.Stack in a slot out of the inventory.
	HandleDrop(ctx *event.Context, slot int, it item.Stack)
}

This existing interface can be extended to include methods specifically tailored for creative mode, addressing the unique actions associated with item creation and destruction. Alternatively, a new interface dedicated to the creative inventory can be created to ensure it accommodates the distinct functionalities required in creative mode.

Expected Outcome

Implementing a mechanism to handle actions within the creative inventory will significantly enhance the overall functionality of the server software. This enhancement will provide a more comprehensive set of features for efficiently managing items in creative mode, thereby improving the developer experience and expanding the capabilities of the server.

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

No branches or pull requests

1 participant