Skip to content

Commit

Permalink
🚧 Entity NBT changes from 25w03a
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Jan 15, 2025
1 parent 511b910 commit 3acd599
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 27 deletions.
2 changes: 2 additions & 0 deletions java/server/util/attribute.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ enum(string) AttributeSlot {
Any = "any",
#[since="1.20.5"]
Body = "body",
#[since="1.21.5"]
Saddle = "saddle",
}

enum(string) AttributeName {
Expand Down
2 changes: 2 additions & 0 deletions java/server/util/inventory.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ enum(string) EquipmentSlot {
Feet = "feet",
#[since="1.20.5"]
Body = "body",
#[since="1.21.5"]
Saddle = "saddle",
}
13 changes: 8 additions & 5 deletions java/server/util/text.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,15 @@ enum(string) HoverEventAction {
}

dispatch minecraft:hover_event[show_text] to struct ShowText {
#[deprecated="1.16"] #[until="1.21.5"]
value?: Text,
#[since="1.16"] #[until="1.21.5"]
contents?: Text,
#[until="1.21.5"]
...struct {
#[deprecated="1.16"]
value?: Text,
#[since="1.16"]
contents?: Text,
},
#[since="1.21.5"]
text: Text,
value: Text,
}

dispatch minecraft:hover_event[show_item] to struct ShowItem {
Expand Down
1 change: 1 addition & 0 deletions java/server/world/entity/mob/breedable/horse.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dispatch minecraft:entity[zombie_horse] to struct HorseBase {
/// Player who tamed it.
#[since="1.16"] #[uuid]
Owner?: int[] @ 4,
#[until="1.21.5"]
SaddleItem?: ItemStack,
}

Expand Down
1 change: 1 addition & 0 deletions java/server/world/entity/mob/breedable/saddled.mcdoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
struct Saddled {
...super::Breedable,
/// Whether there is a saddle on it.
#[until="1.21.5"]
Saddle?: boolean,
}

Expand Down
44 changes: 25 additions & 19 deletions java/server/world/entity/mob/mod.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,27 @@ struct LivingEntity {
/// Base NBT for all mobs.
struct MobBase {
...LivingEntity,
/// [main hand, offhand]
HandItems?: [(ItemStack | struct {})] @ 2,
/// [feet, legs, body, head]
ArmorItems?: [(ItemStack | struct {})] @ 4,
/// Chance to drop the items it is holding, in [main hand, offhand].
#[until="1.21.5"]
HandDropChances?: [float] @ 2,
/// Chance to drop the items it is wearing, in [feet, legs, body, head].
#[until="1.21.5"]
ArmorDropChances?: [float] @ 4,
/// Used for wolf armor & llama carpet decoration.
#[since="1.20.5"]
body_armor_item?: ItemStack,
/// Chance to drop the item it is wearing.
#[since="1.20.5"] #[until="1.21.5"]
body_armor_drop_chance?: float,
/// Chances of the mob dropping an equipment slot on deapth.
#[since="1.21.5"]
drop_chances?: DropChances,
#[until="1.21.5"] ...struct {
/// [main hand, offhand]
HandItems?: [(ItemStack | struct {})] @ 2,
/// Chance to drop the items it is holding, in [main hand, offhand].
HandDropChances?: [float] @ 2,
/// [feet, legs, body, head]
ArmorItems?: [(ItemStack | struct {})] @ 4,
/// Chance to drop the items it is wearing, in [feet, legs, body, head].
ArmorDropChances?: [float] @ 4,
/// Used for wolf armor & llama carpet decoration.
#[since="1.20.5"]
body_armor_item?: ItemStack,
/// Chance to drop the item it is wearing.
#[since="1.20.5"]
body_armor_drop_chance?: float,
},
#[since="1.21.5"] ...struct {
equipment?: EntityEquipment,
/// Chances of the mob dropping an equipment slot on deapth.
drop_chances?: DropChances,
},
DeathLootTable?: #[id(registry="loot_table", empty="allowed")] string,
/// Seed for generating the death loot table.
DeathLootTableSeed?: #[random] long,
Expand All @@ -85,6 +87,10 @@ struct MobBase {
})
}

struct EntityEquipment {
[EquipmentSlot]: ItemStack,
}

struct DropChances {
[EquipmentSlot]: float @ 0..,
}
Expand Down
4 changes: 4 additions & 0 deletions java/server/world/entity/mod.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ struct EntityBase {
/// Rotation in [y-rotation, x-rotation]
Rotation?: [float] @ 2,
/// How far the entity has fallen.
#[until="1.21.5"]
FallDistance?: float,
/// How far the entity has fallen.
#[since="1.21.5"]
fall_distance?: double,
/// Ticks of fire left, or if negative, ticks until the entity starts to burn.
Fire?: short,
/// Ticks of air left.
Expand Down
10 changes: 7 additions & 3 deletions java/server/world/item/mod.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,18 @@ dispatch minecraft:data_component[equippable] to struct Equippable {
asset_id?: #[id="equipment"] string,
/// The overlay texture that should render in first person when equipped.
camera_overlay?: #[id="texture"] string,
/// Limits which entities can equip this item
/// Limits which entities can equip this item.
allowed_entities?: (#[id(registry="entity_type",tags="allowed")] string | [#[id="entity_type"] string]),
/// Whether the item can be equipped by using a dispenser. Defaults to `true`.
dispensable?: boolean,
/// Whether the item can be equipped by right-clicking. Defaults to `true`.
swappable?: boolean,
/// Whether the item will be damaged when the wearer is damaged. Defaults to `true`.
damage_on_hurt?: boolean,
/// Whether players can equip this item onto a target mob by right-clicking it (as long as this item can be equipped on the target at all).
/// The item will not be equipped if the target already has an item in the relevant slot.
/// Defaults to `false`.
equip_on_interact?: boolean,
}

/// If set, this item will not burn in fire or lava.
Expand Down Expand Up @@ -360,8 +364,8 @@ dispatch minecraft:data_component[use_remainder] to ItemStack
/// When present, the 'Item Used' statistic will be incremented for each attack with the item.
#[since="1.21.5"]
dispatch minecraft:data_component[weapon] to struct Weapon {
/// The amount to damage the weapon item for each attack performed.
damage_per_attack?: int @ 0..,
/// The amount to damage to the weapon item for each attack performed. Defaults to `1`.
item_damage_per_attack?: int @ 0..,
/// If `true`, will disable a blocking Shield on successful attack. Defaults to `false`.
can_disable_blocking?: boolean,
}
Expand Down

0 comments on commit 3acd599

Please sign in to comment.