Skip to content

Commit

Permalink
✨ Add component changes from 24w34a
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Aug 21, 2024
1 parent 4b15446 commit 8311e82
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions java/server/world/item/mod.mcdoc
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use ::java::data::advancement::predicate::BlockPredicate
use ::java::data::util::SoundEventRef
use ::java::server::util::attribute::AttributeName
use ::java::server::util::attribute::LegacyOperation
use ::java::server::util::attribute::AttributeOperation
use ::java::server::util::attribute::AttributeSlot
use ::java::server::util::block_state::BlockState
use ::java::server::util::effect::MobEffectInstance
use ::java::server::util::inventory::InventoryItem

struct AttributeModifiers {
modifiers: [AttributeModifier],
Expand All @@ -27,6 +29,61 @@ dispatch minecraft:data_component[can_break] to (
BlockPredicate |
)

#[since="1.21.2"]
dispatch minecraft:data_component[consumable] to struct Consumable {
/// The amount of seconds it takes for a player to consume the item. Defaults to 1.6.
consume_seconds?: float @ 0..,
/// The animation used during consumption of the item. Defaults to "eat".
animation?: ItemUseAnimation,
/// The sound used during and on completion of the item's consumption.
sound?: SoundEventRef,
/// Whether consumption particles are emitted while consuming this item. Defaults to true.
has_consume_particles?: boolean,
/// Side effects which take place as a result of consuming this item.
on_consume_effects?: [ConsumeEffect],
}

enum(string) ItemUseAnimation {
None = "none",
Eat = "eat",
Drink = "drink",
Block = "block",
Bow = "bow",
Spear = "spear",
Crossbow = "crossbow",
Spyglass = "spyglass",
TootHorn = "toot_horn",
Brush = "brush",
}

struct ConsumeEffect {
type: #[id="consume_effect_type"] string,
...minecraft:consume_effect[[type]],
}

dispatch minecraft:consume_effect[apply_effects] to struct ApplyEffectsConsumeEffect {
/// Status effect instances applied once consumed.
effects: [MobEffectInstance],
/// Probability that the effects will be applied once consumed.
probability?: float @ 0..1,
}

dispatch minecraft:consume_effect[remove_effects] to struct RemoveEffectsConsumeEffect {
effects: (#[id(registry="mob_effect",tags="allowed")] string | [#[id="mob_effect"] string]),
}

dispatch minecraft:consume_effect[clear_all_effects] to struct {}

dispatch minecraft:consume_effect[teleport_randomly] to struct TeleportRandomlyConsumeEffect {
/// The diameter that the consumer will be teleported within. Defaults to 16.
diameter?: float @ 1..,
}

dispatch minecraft:consume_effect[play_sound] to struct PlaySoundConsumeEffect {
/// The sound played once consumed.
sound: SoundEventRef,
}

dispatch minecraft:data_component[custom_name] to (#[text_component] string)

dispatch mcdoc:custom_data[%unknown] to any
Expand Down Expand Up @@ -96,11 +153,14 @@ struct Food {
/// Whether the item can be eaten when the player's food points/haunches are full. Defaults to `false`
can_always_eat?: boolean,
/// Seconds it takes to eat the item. Defaults to `1.6`
#[until="1.21.2"]
eat_seconds?: float @ 0..,
/// Applied when eaten.
#[until="1.21.2"]
effects?: [FoodEffect],
/// Works similarly to a milk bucket.
#[since="1.21"]
#[until="1.21.2"]
using_converts_to?: AnyItem,
}

Expand Down Expand Up @@ -209,6 +269,16 @@ dispatch minecraft:data_component[unbreakable] to struct Unbreakable {
show_in_tooltip?: boolean,
}

dispatch minecraft:data_component[use_cooldown] to struct UseCooldown {
/// The amount of seconds the cooldown will take place for.
seconds: float @ 0<..,
/// If present, this item will be part of a cooldown group and no longer share cooldowns with its base item type.
/// Instead, cooldowns applied to this item will only be shared with any other items that are part of the same cooldown group.
cooldown_group?: #[id="cooldown_group"] string,
}

dispatch minecraft:data_component[use_remainder] to InventoryItem

enum(string) ItemBaseComponents {
AttributeModifiers = "attribute_modifiers",
CanBreak = "can_break",
Expand Down

0 comments on commit 8311e82

Please sign in to comment.