Overview
Bad name I know
JackFredLib: Extra Command Source Data adds an attachment Minecraft's used when running commands. This allows you to attach extra context to advanced commands that redirect back into itself in the same vein as the position, entity, level, etcetera, and do advanced things such as repeatable arguments.
For some examples, see Where Is It's command with repeatable criteria, or the test mod's example for holding multiple strings or ints.
Adding Extra Data
To start, you'll want to create a class to hold your data, attached to a CommandSourceStack
:
When overriding the copy
method, it is critical that a deep copy is made. This means that any mutable objects such as sublists must be copied along with all children.
Then when registering your command, you'll need to use the methods in ESD
in the redirect lambda:
Last updated