Skip to content

Commit

Permalink
✨ Add remaining changes from 24w45a
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Nov 6, 2024
1 parent 036618f commit cc3fea4
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 8 deletions.
37 changes: 37 additions & 0 deletions java/assets/item_model.mcdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use ::java::server::util::color::RGB
use ::java::server::util::color::ColorString
use ::java::server::util::direction::Direction

Expand Down Expand Up @@ -77,6 +78,42 @@ struct ModelTint {
...minecraft:tint_source[[type]],
}

dispatch minecraft:tint_source[constant] to struct ConstantTint {
/// Constant tint color to apply.
value: RGB,
}

dispatch minecraft:tint_source[dye] to struct DyeTint {
/// Tint to apply when the `dyed_color` component is not present.
default: RGB
}

/// Applies a tint color based on the `textures/colormap/grass.png` color map.
dispatch minecraft:tint_source[grass] to struct GrassTint {
temperature: float @ 0..1,
downfall: float @ 0..1,
}

dispatch minecraft:tint_source[firework] to struct FireworkTint {
/// Tint to apply when the `firework_explosion` component is not present.
default?: RGB,
}

dispatch minecraft:tint_source[potion] to struct PotionTint {
/// Tint to apply when the `potion_contents` component is not present, or it has no effects and no `custom_color` is set.
default?: RGB,
}

dispatch minecraft:tint_source[map_color] to struct MapColorTint {
/// Tint to apply when the `map_color` component is not present.
default?: RGB,
}

dispatch minecraft:tint_source[custom_model_data] to struct CustomModelDataTint {
/// The index of the `colors` list in the `custom_model_data` component. Defaults to 0.
index?: int @ 0..,
}


enum(string) ConditionalPropertyType {
Broken = "broken",
Expand Down
3 changes: 1 addition & 2 deletions java/assets/model.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ dispatch minecraft:resource[model] to struct Model {
scale?: [float @ -4..4] @ 3,
},
},
#[model_override] // Currently unimplemented attribute to help with sorting rules.
#[until="1.21.4"]
overrides?: [struct ModelOverride {
#[model_override(predicate=true)] // Also unimplemented.
predicate: struct ModelOverridePredicates {
[Predicates]: float,
},
Expand Down
23 changes: 22 additions & 1 deletion java/data/loot/function.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use ::java::server::util::color::ColorString
use ::java::server::util::text::Text
use ::java::server::util::firework::FireworkShape
use ::java::server::util::Filterable
use ::java::server::util::color::RGB
use ::java::server::world::item::DataComponentPatch
use ::java::server::world::item::CustomData

Expand Down Expand Up @@ -509,7 +510,27 @@ dispatch minecraft:loot_function[set_custom_model_data] to struct SetCustomModel
/// Tag that describes the custom model an item will take.
/// Used by the `custom_model_data` model overrides predicate.
/// Has certain restrictions due to float conversion.
value: NumberProvider<int>,
#[until="1.21.4"]
value: NumberProvider,
#[since="1.21.4"]
...struct {
floats?: struct CustomModelDataFloats {
values: [NumberProvider],
...ListOperation,
},
flags?: struct CustomModelDataFlags {
values: [boolean],
...ListOperation,
},
strings?: struct CustomModelDataStrings {
values: [string],
...ListOperation,
},
colors?: struct CustomModelDataColors {
values: [(NumberProvider | RGB)],
...ListOperation,
},
},
...Conditions,
}

Expand Down
1 change: 1 addition & 0 deletions java/data/trim.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dispatch minecraft:resource[trim_material] to struct TrimMaterial {
#[since="1.21.2"] #[id(registry="item", exclude=["air"])] string |
),
/// Model override predicate float.
#[until="1.21.4"]
item_model_index: float @ 0..1,
/// Armor materials that should have a different color palette.
override_armor_materials?: struct TrimMaterialOverrides {
Expand Down
22 changes: 17 additions & 5 deletions java/server/world/item/mod.mcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use ::java::server::util::attribute::AttributeSlot
use ::java::server::util::block_state::BlockState
use ::java::server::util::effect::MobEffectInstance
use ::java::server::util::inventory::EquipmentSlot
use ::java::server::util::color::RGB

struct AttributeModifiers {
modifiers: [AttributeModifier],
Expand Down Expand Up @@ -105,10 +106,15 @@ type CustomData = (

dispatch minecraft:data_component[custom_data] to CustomData

/// Tag that describes the custom model an item will take.
/// Used by the `custom_model_data` model overrides predicate.
/// Has certain restrictions due to float conversion.
dispatch minecraft:data_component[custom_model_data] to int
dispatch minecraft:data_component[custom_model_data] to (
#[until="1.21.4"] int |
#[since="1.21.4"] struct CustomModelData {
floats?: [float],
flags?: [boolean],
strings?: [string],
colors?: [RGB],
} |
)

/// Damage that an item has. Only used for tools, armor, etc.
dispatch minecraft:data_component[damage] to int @ 0..
Expand Down Expand Up @@ -162,7 +168,10 @@ dispatch minecraft:data_component[equippable] to struct Equippable {
equip_sound?: SoundEventRef,
/// The equipment model to use when equipped.
/// Falls back to rendering as the item itself when in the head slot (or no rendering if not applicable).
#[until="1.21.4"]
model?: #[id="model"] string,
#[since="1.21.4"]
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
Expand Down Expand Up @@ -235,7 +244,10 @@ dispatch minecraft:data_component[hide_additional_tooltip] to struct {}
/// If set, it will completely hide this item's tooltip, including its name.
dispatch minecraft:data_component[hide_tooltip] to struct {}

dispatch minecraft:data_component[item_model] to #[id] string
dispatch minecraft:data_component[item_model] to (
#[until="1.21.4"] #[id(registry="model",path="item/")] string |
#[since="1.21.4"] #[id(registry="item_model")] string |
)

/// Replaces default item name with contained chat component.
///
Expand Down

0 comments on commit cc3fea4

Please sign in to comment.