-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/TheMrZZ/sandstone
- Loading branch information
Showing
7 changed files
with
106 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { Command } from '@commands/Command' | ||
import { command } from '@commands/decorators' | ||
import { coordinatesParser, } from '@variables' | ||
|
||
import type { | ||
CONTAINER_SLOTS, Coordinates, ENTITY_SLOTS, ITEMS, MultipleEntitiesArgument, | ||
} from 'src/arguments' | ||
|
||
|
||
export class ItemSource extends Command { | ||
/** | ||
* Replace the slot with a specific item. | ||
* @param item The item to replace the slot with. | ||
* @param count The amount of items. | ||
*/ | ||
@command('with') | ||
with = (item: ITEMS, count: number) => { } | ||
|
||
/** | ||
* Replace the slot with a specific item. | ||
* @param item The item to replace the slot with. | ||
* @param count The amount of items. | ||
*/ | ||
@command(['from', 'block']) | ||
private fromBlock = (...args: unknown[]) => { } | ||
|
||
@command(['from', 'entity']) | ||
private fromEntity = (...args: unknown[]) => { } | ||
|
||
/** | ||
* Replace the slot with a block or an entity's item | ||
*/ | ||
from: { | ||
/** | ||
* @param pos The coordinates of the container to copy items from. | ||
* @param slot The slot to copy the items from. | ||
* @param [modifier] An optional modifier to apply. | ||
*/ | ||
block: (pos: Coordinates, slot: CONTAINER_SLOTS, modifier?: string) => void | ||
|
||
/** | ||
* @param targets The entity to copy items from. | ||
* @param slot The slot to copy the items from. | ||
* @param [modifier] An optional modifier to apply. | ||
*/ | ||
entity: (targets: MultipleEntitiesArgument, slot: ENTITY_SLOTS, modifier?: string) => void | ||
} = { | ||
block: this.fromBlock, | ||
entity: this.fromEntity | ||
} | ||
} | ||
|
||
export class ModifyItem extends Command { | ||
|
||
/** | ||
* @param pos The position of the container containing the slot to apply the modifier to. | ||
* @param slot The slot to apply the modifier to. | ||
* @param modifier The name of the modifier. | ||
*/ | ||
@command(['item', 'modify', 'block'], { isRoot: true, parsers: { '0': coordinatesParser } }) | ||
block = (pos: Coordinates, slot: CONTAINER_SLOTS, modifier: string) => { } | ||
|
||
/** | ||
* @param targets The entity/entities containing the slot to apply the modifier to. | ||
* @param slot The slot to apply the modifier to. | ||
* @param modifier The name of the modifier. | ||
*/ | ||
@command(['item', 'modify', 'entity'], { isRoot: true }) | ||
entity = (targets: MultipleEntitiesArgument, slot: ENTITY_SLOTS, modifier: string) => { } | ||
} | ||
|
||
export class ReplaceItem extends Command { | ||
/** | ||
* @param pos The position of the container containing the slot to be replaced. | ||
* @param slot The slot to be replaced. | ||
*/ | ||
@command(['item', 'replace', 'block'], { isRoot: true, hasSubcommands: true, executable: false, parsers: { '0': coordinatesParser } }) | ||
block = (pos: Coordinates, slot: CONTAINER_SLOTS) => new ItemSource(this.commandsRoot) | ||
|
||
/** | ||
* @param targets one or more entities to modify. | ||
. | ||
* @param slot The slot to be replaced. | ||
*/ | ||
@command(['item', 'replace', 'entity'], { isRoot: true, hasSubcommands: true, executable: false }) | ||
entity = (targets: MultipleEntitiesArgument, slot: ENTITY_SLOTS) => new ItemSource(this.commandsRoot) | ||
} | ||
|
||
/** Replaces or modifies items in inventories */ | ||
export class Item extends Command { | ||
/** Applies a modifier to a slot in an inventory. */ | ||
modify = new ModifyItem(this.commandsRoot) | ||
|
||
/** Replaces the content of a specific slot of an inventory with another. */ | ||
replace = new ReplaceItem(this.commandsRoot) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ export const { | |
raw, | ||
recipe, | ||
reload, | ||
replaceitem, | ||
item, | ||
say, | ||
schedule, | ||
scoreboard, | ||
|