mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
make it so registries can have doc comments
This commit is contained in:
parent
758372f938
commit
f8f976ac02
3 changed files with 303 additions and 177 deletions
|
@ -5,7 +5,7 @@ use syn::{
|
||||||
parse::{Parse, ParseStream, Result},
|
parse::{Parse, ParseStream, Result},
|
||||||
parse_macro_input,
|
parse_macro_input,
|
||||||
punctuated::Punctuated,
|
punctuated::Punctuated,
|
||||||
Ident, LitStr, Token,
|
Attribute, Ident, LitStr, Token,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RegistryItem {
|
struct RegistryItem {
|
||||||
|
@ -16,6 +16,7 @@ struct RegistryItem {
|
||||||
struct Registry {
|
struct Registry {
|
||||||
name: Ident,
|
name: Ident,
|
||||||
items: Vec<RegistryItem>,
|
items: Vec<RegistryItem>,
|
||||||
|
attributes: Vec<Attribute>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for RegistryItem {
|
impl Parse for RegistryItem {
|
||||||
|
@ -30,12 +31,16 @@ impl Parse for RegistryItem {
|
||||||
|
|
||||||
impl Parse for Registry {
|
impl Parse for Registry {
|
||||||
fn parse(input: ParseStream) -> Result<Self> {
|
fn parse(input: ParseStream) -> Result<Self> {
|
||||||
// Block, {
|
// enum Block {
|
||||||
// Air => "minecraft:air",
|
// Air => "minecraft:air",
|
||||||
// Stone => "minecraft:stone"
|
// Stone => "minecraft:stone"
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// this also includes docs
|
||||||
|
let attributes = input.call(Attribute::parse_outer).unwrap_or_default();
|
||||||
|
|
||||||
|
input.parse::<Token![enum]>()?;
|
||||||
let name = input.parse()?;
|
let name = input.parse()?;
|
||||||
let _ = input.parse::<Token![,]>()?;
|
|
||||||
let content;
|
let content;
|
||||||
braced!(content in input);
|
braced!(content in input);
|
||||||
let items: Punctuated<RegistryItem, Token![,]> =
|
let items: Punctuated<RegistryItem, Token![,]> =
|
||||||
|
@ -44,6 +49,7 @@ impl Parse for Registry {
|
||||||
Ok(Registry {
|
Ok(Registry {
|
||||||
name,
|
name,
|
||||||
items: items.into_iter().collect(),
|
items: items.into_iter().collect(),
|
||||||
|
attributes,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +72,9 @@ pub fn registry(input: TokenStream) -> TokenStream {
|
||||||
#name = #protocol_id,
|
#name = #protocol_id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
let attributes = input.attributes;
|
||||||
generated.extend(quote! {
|
generated.extend(quote! {
|
||||||
|
#(#attributes)*
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, azalea_buf::McBuf)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, azalea_buf::McBuf)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum #name {
|
pub enum #name {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
|
||||||
// This file is automatically generated in codegen/lib/code/registry.py
|
// The contents of the macros below are generated in
|
||||||
|
// codegen/lib/code/registry.py, though the rest of the file isn't
|
||||||
|
// auto-generated (so you can add doc comments to the registry enums if you
|
||||||
|
// want)
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
||||||
use azalea_registry_macros::registry;
|
use azalea_registry_macros::registry;
|
||||||
|
@ -39,7 +42,9 @@ impl<T: Registry> McBufWritable for OptionalRegistry<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registry!(Activity, {
|
registry! {
|
||||||
|
/// The AI code that's currently being executed for the entity.
|
||||||
|
enum Activity {
|
||||||
Core => "minecraft:core",
|
Core => "minecraft:core",
|
||||||
Idle => "minecraft:idle",
|
Idle => "minecraft:idle",
|
||||||
Work => "minecraft:work",
|
Work => "minecraft:work",
|
||||||
|
@ -66,9 +71,11 @@ registry!(Activity, {
|
||||||
Roar => "minecraft:roar",
|
Roar => "minecraft:roar",
|
||||||
Emerge => "minecraft:emerge",
|
Emerge => "minecraft:emerge",
|
||||||
Dig => "minecraft:dig",
|
Dig => "minecraft:dig",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Attribute, {
|
registry! {
|
||||||
|
enum Attribute {
|
||||||
GenericMaxHealth => "minecraft:generic.max_health",
|
GenericMaxHealth => "minecraft:generic.max_health",
|
||||||
GenericFollowRange => "minecraft:generic.follow_range",
|
GenericFollowRange => "minecraft:generic.follow_range",
|
||||||
GenericKnockbackResistance => "minecraft:generic.knockback_resistance",
|
GenericKnockbackResistance => "minecraft:generic.knockback_resistance",
|
||||||
|
@ -82,9 +89,11 @@ registry!(Attribute, {
|
||||||
GenericLuck => "minecraft:generic.luck",
|
GenericLuck => "minecraft:generic.luck",
|
||||||
ZombieSpawnReinforcements => "minecraft:zombie.spawn_reinforcements",
|
ZombieSpawnReinforcements => "minecraft:zombie.spawn_reinforcements",
|
||||||
HorseJumpStrength => "minecraft:horse.jump_strength",
|
HorseJumpStrength => "minecraft:horse.jump_strength",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(BannerPattern, {
|
registry! {
|
||||||
|
enum BannerPattern {
|
||||||
Base => "minecraft:base",
|
Base => "minecraft:base",
|
||||||
SquareBottomLeft => "minecraft:square_bottom_left",
|
SquareBottomLeft => "minecraft:square_bottom_left",
|
||||||
SquareBottomRight => "minecraft:square_bottom_right",
|
SquareBottomRight => "minecraft:square_bottom_right",
|
||||||
|
@ -126,9 +135,16 @@ registry!(BannerPattern, {
|
||||||
Flower => "minecraft:flower",
|
Flower => "minecraft:flower",
|
||||||
Mojang => "minecraft:mojang",
|
Mojang => "minecraft:mojang",
|
||||||
Piglin => "minecraft:piglin",
|
Piglin => "minecraft:piglin",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Block, {
|
registry! {
|
||||||
|
/// An enum of every type of block in the game. To represent a block *state*,
|
||||||
|
/// use [`azalea_block::BlockState`] or the [`azalea_block::Block`] trait.
|
||||||
|
///
|
||||||
|
/// [`azalea_block::BlockState`]: https://docs.rs/azalea-block/latest/azalea_block/struct.BlockState.html
|
||||||
|
/// [`azalea_block::Block`]: https://docs.rs/azalea-block/latest/azalea_block/trait.Block.html
|
||||||
|
enum Block {
|
||||||
Air => "minecraft:air",
|
Air => "minecraft:air",
|
||||||
Stone => "minecraft:stone",
|
Stone => "minecraft:stone",
|
||||||
Granite => "minecraft:granite",
|
Granite => "minecraft:granite",
|
||||||
|
@ -1101,9 +1117,14 @@ registry!(Block, {
|
||||||
PearlescentFroglight => "minecraft:pearlescent_froglight",
|
PearlescentFroglight => "minecraft:pearlescent_froglight",
|
||||||
Frogspawn => "minecraft:frogspawn",
|
Frogspawn => "minecraft:frogspawn",
|
||||||
ReinforcedDeepslate => "minecraft:reinforced_deepslate",
|
ReinforcedDeepslate => "minecraft:reinforced_deepslate",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(BlockEntityKind, {
|
registry! {
|
||||||
|
/// An enum that contains every type of block entity. A block entity is a block
|
||||||
|
/// that contains data that can't be represented as just a block state, like
|
||||||
|
/// how chests store items.
|
||||||
|
enum BlockEntityKind {
|
||||||
Furnace => "minecraft:furnace",
|
Furnace => "minecraft:furnace",
|
||||||
Chest => "minecraft:chest",
|
Chest => "minecraft:chest",
|
||||||
TrappedChest => "minecraft:trapped_chest",
|
TrappedChest => "minecraft:trapped_chest",
|
||||||
|
@ -1142,9 +1163,11 @@ registry!(BlockEntityKind, {
|
||||||
SculkCatalyst => "minecraft:sculk_catalyst",
|
SculkCatalyst => "minecraft:sculk_catalyst",
|
||||||
SculkShrieker => "minecraft:sculk_shrieker",
|
SculkShrieker => "minecraft:sculk_shrieker",
|
||||||
ChiseledBookshelf => "minecraft:chiseled_bookshelf",
|
ChiseledBookshelf => "minecraft:chiseled_bookshelf",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(BlockPredicateKind, {
|
registry! {
|
||||||
|
enum BlockPredicateKind {
|
||||||
MatchingBlocks => "minecraft:matching_blocks",
|
MatchingBlocks => "minecraft:matching_blocks",
|
||||||
MatchingBlockTag => "minecraft:matching_block_tag",
|
MatchingBlockTag => "minecraft:matching_block_tag",
|
||||||
MatchingFluids => "minecraft:matching_fluids",
|
MatchingFluids => "minecraft:matching_fluids",
|
||||||
|
@ -1157,9 +1180,11 @@ registry!(BlockPredicateKind, {
|
||||||
AllOf => "minecraft:all_of",
|
AllOf => "minecraft:all_of",
|
||||||
Not => "minecraft:not",
|
Not => "minecraft:not",
|
||||||
True => "minecraft:true",
|
True => "minecraft:true",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(CatVariant, {
|
registry! {
|
||||||
|
enum CatVariant {
|
||||||
Tabby => "minecraft:tabby",
|
Tabby => "minecraft:tabby",
|
||||||
Black => "minecraft:black",
|
Black => "minecraft:black",
|
||||||
Red => "minecraft:red",
|
Red => "minecraft:red",
|
||||||
|
@ -1171,9 +1196,11 @@ registry!(CatVariant, {
|
||||||
White => "minecraft:white",
|
White => "minecraft:white",
|
||||||
Jellie => "minecraft:jellie",
|
Jellie => "minecraft:jellie",
|
||||||
AllBlack => "minecraft:all_black",
|
AllBlack => "minecraft:all_black",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(ChunkStatus, {
|
registry! {
|
||||||
|
enum ChunkStatus {
|
||||||
Empty => "minecraft:empty",
|
Empty => "minecraft:empty",
|
||||||
StructureStarts => "minecraft:structure_starts",
|
StructureStarts => "minecraft:structure_starts",
|
||||||
StructureReferences => "minecraft:structure_references",
|
StructureReferences => "minecraft:structure_references",
|
||||||
|
@ -1187,9 +1214,11 @@ registry!(ChunkStatus, {
|
||||||
Spawn => "minecraft:spawn",
|
Spawn => "minecraft:spawn",
|
||||||
Heightmaps => "minecraft:heightmaps",
|
Heightmaps => "minecraft:heightmaps",
|
||||||
Full => "minecraft:full",
|
Full => "minecraft:full",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(CommandArgumentKind, {
|
registry! {
|
||||||
|
enum CommandArgumentKind {
|
||||||
Bool => "brigadier:bool",
|
Bool => "brigadier:bool",
|
||||||
Float => "brigadier:float",
|
Float => "brigadier:float",
|
||||||
Double => "brigadier:double",
|
Double => "brigadier:double",
|
||||||
|
@ -1238,9 +1267,11 @@ registry!(CommandArgumentKind, {
|
||||||
TemplateMirror => "minecraft:template_mirror",
|
TemplateMirror => "minecraft:template_mirror",
|
||||||
TemplateRotation => "minecraft:template_rotation",
|
TemplateRotation => "minecraft:template_rotation",
|
||||||
Uuid => "minecraft:uuid",
|
Uuid => "minecraft:uuid",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(CustomStat, {
|
registry! {
|
||||||
|
enum CustomStat {
|
||||||
LeaveGame => "minecraft:leave_game",
|
LeaveGame => "minecraft:leave_game",
|
||||||
PlayTime => "minecraft:play_time",
|
PlayTime => "minecraft:play_time",
|
||||||
TotalWorldTime => "minecraft:total_world_time",
|
TotalWorldTime => "minecraft:total_world_time",
|
||||||
|
@ -1316,9 +1347,11 @@ registry!(CustomStat, {
|
||||||
InteractWithGrindstone => "minecraft:interact_with_grindstone",
|
InteractWithGrindstone => "minecraft:interact_with_grindstone",
|
||||||
TargetHit => "minecraft:target_hit",
|
TargetHit => "minecraft:target_hit",
|
||||||
InteractWithSmithingTable => "minecraft:interact_with_smithing_table",
|
InteractWithSmithingTable => "minecraft:interact_with_smithing_table",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Enchantment, {
|
registry! {
|
||||||
|
enum Enchantment {
|
||||||
Protection => "minecraft:protection",
|
Protection => "minecraft:protection",
|
||||||
FireProtection => "minecraft:fire_protection",
|
FireProtection => "minecraft:fire_protection",
|
||||||
FeatherFalling => "minecraft:feather_falling",
|
FeatherFalling => "minecraft:feather_falling",
|
||||||
|
@ -1358,9 +1391,12 @@ registry!(Enchantment, {
|
||||||
Piercing => "minecraft:piercing",
|
Piercing => "minecraft:piercing",
|
||||||
Mending => "minecraft:mending",
|
Mending => "minecraft:mending",
|
||||||
VanishingCurse => "minecraft:vanishing_curse",
|
VanishingCurse => "minecraft:vanishing_curse",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(EntityKind, {
|
registry! {
|
||||||
|
/// An enum that contains every type of entity.
|
||||||
|
enum EntityKind {
|
||||||
Allay => "minecraft:allay",
|
Allay => "minecraft:allay",
|
||||||
AreaEffectCloud => "minecraft:area_effect_cloud",
|
AreaEffectCloud => "minecraft:area_effect_cloud",
|
||||||
ArmorStand => "minecraft:armor_stand",
|
ArmorStand => "minecraft:armor_stand",
|
||||||
|
@ -1480,30 +1516,38 @@ registry!(EntityKind, {
|
||||||
ZombifiedPiglin => "minecraft:zombified_piglin",
|
ZombifiedPiglin => "minecraft:zombified_piglin",
|
||||||
Player => "minecraft:player",
|
Player => "minecraft:player",
|
||||||
FishingBobber => "minecraft:fishing_bobber",
|
FishingBobber => "minecraft:fishing_bobber",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(FloatProviderKind, {
|
registry! {
|
||||||
|
enum FloatProviderKind {
|
||||||
Constant => "minecraft:constant",
|
Constant => "minecraft:constant",
|
||||||
Uniform => "minecraft:uniform",
|
Uniform => "minecraft:uniform",
|
||||||
ClampedNormal => "minecraft:clamped_normal",
|
ClampedNormal => "minecraft:clamped_normal",
|
||||||
Trapezoid => "minecraft:trapezoid",
|
Trapezoid => "minecraft:trapezoid",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Fluid, {
|
registry! {
|
||||||
|
enum Fluid {
|
||||||
Empty => "minecraft:empty",
|
Empty => "minecraft:empty",
|
||||||
FlowingWater => "minecraft:flowing_water",
|
FlowingWater => "minecraft:flowing_water",
|
||||||
Water => "minecraft:water",
|
Water => "minecraft:water",
|
||||||
FlowingLava => "minecraft:flowing_lava",
|
FlowingLava => "minecraft:flowing_lava",
|
||||||
Lava => "minecraft:lava",
|
Lava => "minecraft:lava",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(FrogVariant, {
|
registry! {
|
||||||
|
enum FrogVariant {
|
||||||
Temperate => "minecraft:temperate",
|
Temperate => "minecraft:temperate",
|
||||||
Warm => "minecraft:warm",
|
Warm => "minecraft:warm",
|
||||||
Cold => "minecraft:cold",
|
Cold => "minecraft:cold",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(GameEvent, {
|
registry! {
|
||||||
|
enum GameEvent {
|
||||||
BlockActivate => "minecraft:block_activate",
|
BlockActivate => "minecraft:block_activate",
|
||||||
BlockAttach => "minecraft:block_attach",
|
BlockAttach => "minecraft:block_attach",
|
||||||
BlockChange => "minecraft:block_change",
|
BlockChange => "minecraft:block_change",
|
||||||
|
@ -1550,18 +1594,22 @@ registry!(GameEvent, {
|
||||||
Step => "minecraft:step",
|
Step => "minecraft:step",
|
||||||
Swim => "minecraft:swim",
|
Swim => "minecraft:swim",
|
||||||
Teleport => "minecraft:teleport",
|
Teleport => "minecraft:teleport",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(HeightProviderKind, {
|
registry! {
|
||||||
|
enum HeightProviderKind {
|
||||||
Constant => "minecraft:constant",
|
Constant => "minecraft:constant",
|
||||||
Uniform => "minecraft:uniform",
|
Uniform => "minecraft:uniform",
|
||||||
BiasedToBottom => "minecraft:biased_to_bottom",
|
BiasedToBottom => "minecraft:biased_to_bottom",
|
||||||
VeryBiasedToBottom => "minecraft:very_biased_to_bottom",
|
VeryBiasedToBottom => "minecraft:very_biased_to_bottom",
|
||||||
Trapezoid => "minecraft:trapezoid",
|
Trapezoid => "minecraft:trapezoid",
|
||||||
WeightedList => "minecraft:weighted_list",
|
WeightedList => "minecraft:weighted_list",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Instrument, {
|
registry! {
|
||||||
|
enum Instrument {
|
||||||
PonderGoatHorn => "minecraft:ponder_goat_horn",
|
PonderGoatHorn => "minecraft:ponder_goat_horn",
|
||||||
SingGoatHorn => "minecraft:sing_goat_horn",
|
SingGoatHorn => "minecraft:sing_goat_horn",
|
||||||
SeekGoatHorn => "minecraft:seek_goat_horn",
|
SeekGoatHorn => "minecraft:seek_goat_horn",
|
||||||
|
@ -1570,18 +1618,22 @@ registry!(Instrument, {
|
||||||
CallGoatHorn => "minecraft:call_goat_horn",
|
CallGoatHorn => "minecraft:call_goat_horn",
|
||||||
YearnGoatHorn => "minecraft:yearn_goat_horn",
|
YearnGoatHorn => "minecraft:yearn_goat_horn",
|
||||||
DreamGoatHorn => "minecraft:dream_goat_horn",
|
DreamGoatHorn => "minecraft:dream_goat_horn",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(IntProviderKind, {
|
registry! {
|
||||||
|
enum IntProviderKind {
|
||||||
Constant => "minecraft:constant",
|
Constant => "minecraft:constant",
|
||||||
Uniform => "minecraft:uniform",
|
Uniform => "minecraft:uniform",
|
||||||
BiasedToBottom => "minecraft:biased_to_bottom",
|
BiasedToBottom => "minecraft:biased_to_bottom",
|
||||||
Clamped => "minecraft:clamped",
|
Clamped => "minecraft:clamped",
|
||||||
WeightedList => "minecraft:weighted_list",
|
WeightedList => "minecraft:weighted_list",
|
||||||
ClampedNormal => "minecraft:clamped_normal",
|
ClampedNormal => "minecraft:clamped_normal",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Item, {
|
registry! {
|
||||||
|
enum Item {
|
||||||
Air => "minecraft:air",
|
Air => "minecraft:air",
|
||||||
Stone => "minecraft:stone",
|
Stone => "minecraft:stone",
|
||||||
Granite => "minecraft:granite",
|
Granite => "minecraft:granite",
|
||||||
|
@ -2768,9 +2820,11 @@ registry!(Item, {
|
||||||
PearlescentFroglight => "minecraft:pearlescent_froglight",
|
PearlescentFroglight => "minecraft:pearlescent_froglight",
|
||||||
Frogspawn => "minecraft:frogspawn",
|
Frogspawn => "minecraft:frogspawn",
|
||||||
EchoShard => "minecraft:echo_shard",
|
EchoShard => "minecraft:echo_shard",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(LootConditionKind, {
|
registry! {
|
||||||
|
enum LootConditionKind {
|
||||||
Inverted => "minecraft:inverted",
|
Inverted => "minecraft:inverted",
|
||||||
Alternative => "minecraft:alternative",
|
Alternative => "minecraft:alternative",
|
||||||
RandomChance => "minecraft:random_chance",
|
RandomChance => "minecraft:random_chance",
|
||||||
|
@ -2788,9 +2842,11 @@ registry!(LootConditionKind, {
|
||||||
Reference => "minecraft:reference",
|
Reference => "minecraft:reference",
|
||||||
TimeCheck => "minecraft:time_check",
|
TimeCheck => "minecraft:time_check",
|
||||||
ValueCheck => "minecraft:value_check",
|
ValueCheck => "minecraft:value_check",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(LootFunctionKind, {
|
registry! {
|
||||||
|
enum LootFunctionKind {
|
||||||
SetCount => "minecraft:set_count",
|
SetCount => "minecraft:set_count",
|
||||||
EnchantWithLevels => "minecraft:enchant_with_levels",
|
EnchantWithLevels => "minecraft:enchant_with_levels",
|
||||||
EnchantRandomly => "minecraft:enchant_randomly",
|
EnchantRandomly => "minecraft:enchant_randomly",
|
||||||
|
@ -2816,21 +2872,27 @@ registry!(LootFunctionKind, {
|
||||||
SetBannerPattern => "minecraft:set_banner_pattern",
|
SetBannerPattern => "minecraft:set_banner_pattern",
|
||||||
SetPotion => "minecraft:set_potion",
|
SetPotion => "minecraft:set_potion",
|
||||||
SetInstrument => "minecraft:set_instrument",
|
SetInstrument => "minecraft:set_instrument",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(LootNbtProviderKind, {
|
registry! {
|
||||||
|
enum LootNbtProviderKind {
|
||||||
Storage => "minecraft:storage",
|
Storage => "minecraft:storage",
|
||||||
Context => "minecraft:context",
|
Context => "minecraft:context",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(LootNumberProviderKind, {
|
registry! {
|
||||||
|
enum LootNumberProviderKind {
|
||||||
Constant => "minecraft:constant",
|
Constant => "minecraft:constant",
|
||||||
Uniform => "minecraft:uniform",
|
Uniform => "minecraft:uniform",
|
||||||
Binomial => "minecraft:binomial",
|
Binomial => "minecraft:binomial",
|
||||||
Score => "minecraft:score",
|
Score => "minecraft:score",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(LootPoolEntryKind, {
|
registry! {
|
||||||
|
enum LootPoolEntryKind {
|
||||||
Empty => "minecraft:empty",
|
Empty => "minecraft:empty",
|
||||||
Item => "minecraft:item",
|
Item => "minecraft:item",
|
||||||
LootTable => "minecraft:loot_table",
|
LootTable => "minecraft:loot_table",
|
||||||
|
@ -2839,14 +2901,18 @@ registry!(LootPoolEntryKind, {
|
||||||
Alternatives => "minecraft:alternatives",
|
Alternatives => "minecraft:alternatives",
|
||||||
Sequence => "minecraft:sequence",
|
Sequence => "minecraft:sequence",
|
||||||
Group => "minecraft:group",
|
Group => "minecraft:group",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(LootScoreProviderKind, {
|
registry! {
|
||||||
|
enum LootScoreProviderKind {
|
||||||
Fixed => "minecraft:fixed",
|
Fixed => "minecraft:fixed",
|
||||||
Context => "minecraft:context",
|
Context => "minecraft:context",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(MemoryModuleKind, {
|
registry! {
|
||||||
|
enum MemoryModuleKind {
|
||||||
Dummy => "minecraft:dummy",
|
Dummy => "minecraft:dummy",
|
||||||
Home => "minecraft:home",
|
Home => "minecraft:home",
|
||||||
JobSite => "minecraft:job_site",
|
JobSite => "minecraft:job_site",
|
||||||
|
@ -2940,9 +3006,11 @@ registry!(MemoryModuleKind, {
|
||||||
LikedNoteblock => "minecraft:liked_noteblock",
|
LikedNoteblock => "minecraft:liked_noteblock",
|
||||||
LikedNoteblockCooldownTicks => "minecraft:liked_noteblock_cooldown_ticks",
|
LikedNoteblockCooldownTicks => "minecraft:liked_noteblock_cooldown_ticks",
|
||||||
ItemPickupCooldownTicks => "minecraft:item_pickup_cooldown_ticks",
|
ItemPickupCooldownTicks => "minecraft:item_pickup_cooldown_ticks",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Menu, {
|
registry! {
|
||||||
|
enum Menu {
|
||||||
Generic9x1 => "minecraft:generic_9x1",
|
Generic9x1 => "minecraft:generic_9x1",
|
||||||
Generic9x2 => "minecraft:generic_9x2",
|
Generic9x2 => "minecraft:generic_9x2",
|
||||||
Generic9x3 => "minecraft:generic_9x3",
|
Generic9x3 => "minecraft:generic_9x3",
|
||||||
|
@ -2967,9 +3035,11 @@ registry!(Menu, {
|
||||||
Smoker => "minecraft:smoker",
|
Smoker => "minecraft:smoker",
|
||||||
CartographyTable => "minecraft:cartography_table",
|
CartographyTable => "minecraft:cartography_table",
|
||||||
Stonecutter => "minecraft:stonecutter",
|
Stonecutter => "minecraft:stonecutter",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(MobEffect, {
|
registry! {
|
||||||
|
enum MobEffect {
|
||||||
Speed => "minecraft:speed",
|
Speed => "minecraft:speed",
|
||||||
Slowness => "minecraft:slowness",
|
Slowness => "minecraft:slowness",
|
||||||
Haste => "minecraft:haste",
|
Haste => "minecraft:haste",
|
||||||
|
@ -3003,9 +3073,11 @@ registry!(MobEffect, {
|
||||||
BadOmen => "minecraft:bad_omen",
|
BadOmen => "minecraft:bad_omen",
|
||||||
HeroOfTheVillage => "minecraft:hero_of_the_village",
|
HeroOfTheVillage => "minecraft:hero_of_the_village",
|
||||||
Darkness => "minecraft:darkness",
|
Darkness => "minecraft:darkness",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(PaintingVariant, {
|
registry! {
|
||||||
|
enum PaintingVariant {
|
||||||
Kebab => "minecraft:kebab",
|
Kebab => "minecraft:kebab",
|
||||||
Aztec => "minecraft:aztec",
|
Aztec => "minecraft:aztec",
|
||||||
Alban => "minecraft:alban",
|
Alban => "minecraft:alban",
|
||||||
|
@ -3036,9 +3108,11 @@ registry!(PaintingVariant, {
|
||||||
Water => "minecraft:water",
|
Water => "minecraft:water",
|
||||||
Fire => "minecraft:fire",
|
Fire => "minecraft:fire",
|
||||||
DonkeyKong => "minecraft:donkey_kong",
|
DonkeyKong => "minecraft:donkey_kong",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(ParticleKind, {
|
registry! {
|
||||||
|
enum ParticleKind {
|
||||||
AmbientEntityEffect => "minecraft:ambient_entity_effect",
|
AmbientEntityEffect => "minecraft:ambient_entity_effect",
|
||||||
AngryVillager => "minecraft:angry_villager",
|
AngryVillager => "minecraft:angry_villager",
|
||||||
Block => "minecraft:block",
|
Block => "minecraft:block",
|
||||||
|
@ -3132,9 +3206,11 @@ registry!(ParticleKind, {
|
||||||
ElectricSpark => "minecraft:electric_spark",
|
ElectricSpark => "minecraft:electric_spark",
|
||||||
Scrape => "minecraft:scrape",
|
Scrape => "minecraft:scrape",
|
||||||
Shriek => "minecraft:shriek",
|
Shriek => "minecraft:shriek",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(PointOfInterestKind, {
|
registry! {
|
||||||
|
enum PointOfInterestKind {
|
||||||
Armorer => "minecraft:armorer",
|
Armorer => "minecraft:armorer",
|
||||||
Butcher => "minecraft:butcher",
|
Butcher => "minecraft:butcher",
|
||||||
Cartographer => "minecraft:cartographer",
|
Cartographer => "minecraft:cartographer",
|
||||||
|
@ -3155,20 +3231,26 @@ registry!(PointOfInterestKind, {
|
||||||
NetherPortal => "minecraft:nether_portal",
|
NetherPortal => "minecraft:nether_portal",
|
||||||
Lodestone => "minecraft:lodestone",
|
Lodestone => "minecraft:lodestone",
|
||||||
LightningRod => "minecraft:lightning_rod",
|
LightningRod => "minecraft:lightning_rod",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(PosRuleTest, {
|
registry! {
|
||||||
|
enum PosRuleTest {
|
||||||
AlwaysTrue => "minecraft:always_true",
|
AlwaysTrue => "minecraft:always_true",
|
||||||
LinearPos => "minecraft:linear_pos",
|
LinearPos => "minecraft:linear_pos",
|
||||||
AxisAlignedLinearPos => "minecraft:axis_aligned_linear_pos",
|
AxisAlignedLinearPos => "minecraft:axis_aligned_linear_pos",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(PositionSourceKind, {
|
registry! {
|
||||||
|
enum PositionSourceKind {
|
||||||
Block => "minecraft:block",
|
Block => "minecraft:block",
|
||||||
Entity => "minecraft:entity",
|
Entity => "minecraft:entity",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Potion, {
|
registry! {
|
||||||
|
enum Potion {
|
||||||
Empty => "minecraft:empty",
|
Empty => "minecraft:empty",
|
||||||
Water => "minecraft:water",
|
Water => "minecraft:water",
|
||||||
Mundane => "minecraft:mundane",
|
Mundane => "minecraft:mundane",
|
||||||
|
@ -3212,9 +3294,11 @@ registry!(Potion, {
|
||||||
Luck => "minecraft:luck",
|
Luck => "minecraft:luck",
|
||||||
SlowFalling => "minecraft:slow_falling",
|
SlowFalling => "minecraft:slow_falling",
|
||||||
LongSlowFalling => "minecraft:long_slow_falling",
|
LongSlowFalling => "minecraft:long_slow_falling",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(RecipeSerializer, {
|
registry! {
|
||||||
|
enum RecipeSerializer {
|
||||||
CraftingShaped => "minecraft:crafting_shaped",
|
CraftingShaped => "minecraft:crafting_shaped",
|
||||||
CraftingShapeless => "minecraft:crafting_shapeless",
|
CraftingShapeless => "minecraft:crafting_shapeless",
|
||||||
CraftingSpecialArmordye => "minecraft:crafting_special_armordye",
|
CraftingSpecialArmordye => "minecraft:crafting_special_armordye",
|
||||||
|
@ -3236,9 +3320,11 @@ registry!(RecipeSerializer, {
|
||||||
CampfireCooking => "minecraft:campfire_cooking",
|
CampfireCooking => "minecraft:campfire_cooking",
|
||||||
Stonecutting => "minecraft:stonecutting",
|
Stonecutting => "minecraft:stonecutting",
|
||||||
Smithing => "minecraft:smithing",
|
Smithing => "minecraft:smithing",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(RecipeKind, {
|
registry! {
|
||||||
|
enum RecipeKind {
|
||||||
Crafting => "minecraft:crafting",
|
Crafting => "minecraft:crafting",
|
||||||
Smelting => "minecraft:smelting",
|
Smelting => "minecraft:smelting",
|
||||||
Blasting => "minecraft:blasting",
|
Blasting => "minecraft:blasting",
|
||||||
|
@ -3246,25 +3332,31 @@ registry!(RecipeKind, {
|
||||||
CampfireCooking => "minecraft:campfire_cooking",
|
CampfireCooking => "minecraft:campfire_cooking",
|
||||||
Stonecutting => "minecraft:stonecutting",
|
Stonecutting => "minecraft:stonecutting",
|
||||||
Smithing => "minecraft:smithing",
|
Smithing => "minecraft:smithing",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(RuleTest, {
|
registry! {
|
||||||
|
enum RuleTest {
|
||||||
AlwaysTrue => "minecraft:always_true",
|
AlwaysTrue => "minecraft:always_true",
|
||||||
BlockMatch => "minecraft:block_match",
|
BlockMatch => "minecraft:block_match",
|
||||||
BlockstateMatch => "minecraft:blockstate_match",
|
BlockstateMatch => "minecraft:blockstate_match",
|
||||||
TagMatch => "minecraft:tag_match",
|
TagMatch => "minecraft:tag_match",
|
||||||
RandomBlockMatch => "minecraft:random_block_match",
|
RandomBlockMatch => "minecraft:random_block_match",
|
||||||
RandomBlockstateMatch => "minecraft:random_blockstate_match",
|
RandomBlockstateMatch => "minecraft:random_blockstate_match",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(Schedule, {
|
registry! {
|
||||||
|
enum Schedule {
|
||||||
Empty => "minecraft:empty",
|
Empty => "minecraft:empty",
|
||||||
Simple => "minecraft:simple",
|
Simple => "minecraft:simple",
|
||||||
VillagerBaby => "minecraft:villager_baby",
|
VillagerBaby => "minecraft:villager_baby",
|
||||||
VillagerDefault => "minecraft:villager_default",
|
VillagerDefault => "minecraft:villager_default",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(SensorKind, {
|
registry! {
|
||||||
|
enum SensorKind {
|
||||||
Dummy => "minecraft:dummy",
|
Dummy => "minecraft:dummy",
|
||||||
NearestItems => "minecraft:nearest_items",
|
NearestItems => "minecraft:nearest_items",
|
||||||
NearestLivingEntities => "minecraft:nearest_living_entities",
|
NearestLivingEntities => "minecraft:nearest_living_entities",
|
||||||
|
@ -3287,9 +3379,11 @@ registry!(SensorKind, {
|
||||||
FrogAttackables => "minecraft:frog_attackables",
|
FrogAttackables => "minecraft:frog_attackables",
|
||||||
IsInWater => "minecraft:is_in_water",
|
IsInWater => "minecraft:is_in_water",
|
||||||
WardenEntitySensor => "minecraft:warden_entity_sensor",
|
WardenEntitySensor => "minecraft:warden_entity_sensor",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(SoundEvent, {
|
registry! {
|
||||||
|
enum SoundEvent {
|
||||||
EntityAllayAmbientWithItem => "minecraft:entity.allay.ambient_with_item",
|
EntityAllayAmbientWithItem => "minecraft:entity.allay.ambient_with_item",
|
||||||
EntityAllayAmbientWithoutItem => "minecraft:entity.allay.ambient_without_item",
|
EntityAllayAmbientWithoutItem => "minecraft:entity.allay.ambient_without_item",
|
||||||
EntityAllayDeath => "minecraft:entity.allay.death",
|
EntityAllayDeath => "minecraft:entity.allay.death",
|
||||||
|
@ -4682,9 +4776,11 @@ registry!(SoundEvent, {
|
||||||
EntityZombieVillagerDeath => "minecraft:entity.zombie_villager.death",
|
EntityZombieVillagerDeath => "minecraft:entity.zombie_villager.death",
|
||||||
EntityZombieVillagerHurt => "minecraft:entity.zombie_villager.hurt",
|
EntityZombieVillagerHurt => "minecraft:entity.zombie_villager.hurt",
|
||||||
EntityZombieVillagerStep => "minecraft:entity.zombie_villager.step",
|
EntityZombieVillagerStep => "minecraft:entity.zombie_villager.step",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(StatKind, {
|
registry! {
|
||||||
|
enum StatKind {
|
||||||
Mined => "minecraft:mined",
|
Mined => "minecraft:mined",
|
||||||
Crafted => "minecraft:crafted",
|
Crafted => "minecraft:crafted",
|
||||||
Used => "minecraft:used",
|
Used => "minecraft:used",
|
||||||
|
@ -4694,9 +4790,11 @@ registry!(StatKind, {
|
||||||
Killed => "minecraft:killed",
|
Killed => "minecraft:killed",
|
||||||
KilledBy => "minecraft:killed_by",
|
KilledBy => "minecraft:killed_by",
|
||||||
Custom => "minecraft:custom",
|
Custom => "minecraft:custom",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(VillagerProfession, {
|
registry! {
|
||||||
|
enum VillagerProfession {
|
||||||
None => "minecraft:none",
|
None => "minecraft:none",
|
||||||
Armorer => "minecraft:armorer",
|
Armorer => "minecraft:armorer",
|
||||||
Butcher => "minecraft:butcher",
|
Butcher => "minecraft:butcher",
|
||||||
|
@ -4712,9 +4810,11 @@ registry!(VillagerProfession, {
|
||||||
Shepherd => "minecraft:shepherd",
|
Shepherd => "minecraft:shepherd",
|
||||||
Toolsmith => "minecraft:toolsmith",
|
Toolsmith => "minecraft:toolsmith",
|
||||||
Weaponsmith => "minecraft:weaponsmith",
|
Weaponsmith => "minecraft:weaponsmith",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(VillagerKind, {
|
registry! {
|
||||||
|
enum VillagerKind {
|
||||||
Desert => "minecraft:desert",
|
Desert => "minecraft:desert",
|
||||||
Jungle => "minecraft:jungle",
|
Jungle => "minecraft:jungle",
|
||||||
Plains => "minecraft:plains",
|
Plains => "minecraft:plains",
|
||||||
|
@ -4722,16 +4822,20 @@ registry!(VillagerKind, {
|
||||||
Snow => "minecraft:snow",
|
Snow => "minecraft:snow",
|
||||||
Swamp => "minecraft:swamp",
|
Swamp => "minecraft:swamp",
|
||||||
Taiga => "minecraft:taiga",
|
Taiga => "minecraft:taiga",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenBiomeSource, {
|
registry! {
|
||||||
|
enum WorldgenBiomeSource {
|
||||||
Fixed => "minecraft:fixed",
|
Fixed => "minecraft:fixed",
|
||||||
MultiNoise => "minecraft:multi_noise",
|
MultiNoise => "minecraft:multi_noise",
|
||||||
Checkerboard => "minecraft:checkerboard",
|
Checkerboard => "minecraft:checkerboard",
|
||||||
TheEnd => "minecraft:the_end",
|
TheEnd => "minecraft:the_end",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenBlockStateProviderKind, {
|
registry! {
|
||||||
|
enum WorldgenBlockStateProviderKind {
|
||||||
SimpleStateProvider => "minecraft:simple_state_provider",
|
SimpleStateProvider => "minecraft:simple_state_provider",
|
||||||
WeightedStateProvider => "minecraft:weighted_state_provider",
|
WeightedStateProvider => "minecraft:weighted_state_provider",
|
||||||
NoiseThresholdProvider => "minecraft:noise_threshold_provider",
|
NoiseThresholdProvider => "minecraft:noise_threshold_provider",
|
||||||
|
@ -4739,21 +4843,27 @@ registry!(WorldgenBlockStateProviderKind, {
|
||||||
DualNoiseProvider => "minecraft:dual_noise_provider",
|
DualNoiseProvider => "minecraft:dual_noise_provider",
|
||||||
RotatedBlockProvider => "minecraft:rotated_block_provider",
|
RotatedBlockProvider => "minecraft:rotated_block_provider",
|
||||||
RandomizedIntStateProvider => "minecraft:randomized_int_state_provider",
|
RandomizedIntStateProvider => "minecraft:randomized_int_state_provider",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenCarver, {
|
registry! {
|
||||||
|
enum WorldgenCarver {
|
||||||
Cave => "minecraft:cave",
|
Cave => "minecraft:cave",
|
||||||
NetherCave => "minecraft:nether_cave",
|
NetherCave => "minecraft:nether_cave",
|
||||||
Canyon => "minecraft:canyon",
|
Canyon => "minecraft:canyon",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenChunkGenerator, {
|
registry! {
|
||||||
|
enum WorldgenChunkGenerator {
|
||||||
Noise => "minecraft:noise",
|
Noise => "minecraft:noise",
|
||||||
Flat => "minecraft:flat",
|
Flat => "minecraft:flat",
|
||||||
Debug => "minecraft:debug",
|
Debug => "minecraft:debug",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenDensityFunctionKind, {
|
registry! {
|
||||||
|
enum WorldgenDensityFunctionKind {
|
||||||
BlendAlpha => "minecraft:blend_alpha",
|
BlendAlpha => "minecraft:blend_alpha",
|
||||||
BlendOffset => "minecraft:blend_offset",
|
BlendOffset => "minecraft:blend_offset",
|
||||||
Beardifier => "minecraft:beardifier",
|
Beardifier => "minecraft:beardifier",
|
||||||
|
@ -4786,9 +4896,11 @@ registry!(WorldgenDensityFunctionKind, {
|
||||||
Spline => "minecraft:spline",
|
Spline => "minecraft:spline",
|
||||||
Constant => "minecraft:constant",
|
Constant => "minecraft:constant",
|
||||||
YClampedGradient => "minecraft:y_clamped_gradient",
|
YClampedGradient => "minecraft:y_clamped_gradient",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenFeature, {
|
registry! {
|
||||||
|
enum WorldgenFeature {
|
||||||
NoOp => "minecraft:no_op",
|
NoOp => "minecraft:no_op",
|
||||||
Tree => "minecraft:tree",
|
Tree => "minecraft:tree",
|
||||||
Flower => "minecraft:flower",
|
Flower => "minecraft:flower",
|
||||||
|
@ -4850,14 +4962,18 @@ registry!(WorldgenFeature, {
|
||||||
LargeDripstone => "minecraft:large_dripstone",
|
LargeDripstone => "minecraft:large_dripstone",
|
||||||
PointedDripstone => "minecraft:pointed_dripstone",
|
PointedDripstone => "minecraft:pointed_dripstone",
|
||||||
SculkPatch => "minecraft:sculk_patch",
|
SculkPatch => "minecraft:sculk_patch",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenFeatureSizeKind, {
|
registry! {
|
||||||
|
enum WorldgenFeatureSizeKind {
|
||||||
TwoLayersFeatureSize => "minecraft:two_layers_feature_size",
|
TwoLayersFeatureSize => "minecraft:two_layers_feature_size",
|
||||||
ThreeLayersFeatureSize => "minecraft:three_layers_feature_size",
|
ThreeLayersFeatureSize => "minecraft:three_layers_feature_size",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenFoliagePlacerKind, {
|
registry! {
|
||||||
|
enum WorldgenFoliagePlacerKind {
|
||||||
BlobFoliagePlacer => "minecraft:blob_foliage_placer",
|
BlobFoliagePlacer => "minecraft:blob_foliage_placer",
|
||||||
SpruceFoliagePlacer => "minecraft:spruce_foliage_placer",
|
SpruceFoliagePlacer => "minecraft:spruce_foliage_placer",
|
||||||
PineFoliagePlacer => "minecraft:pine_foliage_placer",
|
PineFoliagePlacer => "minecraft:pine_foliage_placer",
|
||||||
|
@ -4868,9 +4984,11 @@ registry!(WorldgenFoliagePlacerKind, {
|
||||||
MegaPineFoliagePlacer => "minecraft:mega_pine_foliage_placer",
|
MegaPineFoliagePlacer => "minecraft:mega_pine_foliage_placer",
|
||||||
DarkOakFoliagePlacer => "minecraft:dark_oak_foliage_placer",
|
DarkOakFoliagePlacer => "minecraft:dark_oak_foliage_placer",
|
||||||
RandomSpreadFoliagePlacer => "minecraft:random_spread_foliage_placer",
|
RandomSpreadFoliagePlacer => "minecraft:random_spread_foliage_placer",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenMaterialCondition, {
|
registry! {
|
||||||
|
enum WorldgenMaterialCondition {
|
||||||
Biome => "minecraft:biome",
|
Biome => "minecraft:biome",
|
||||||
NoiseThreshold => "minecraft:noise_threshold",
|
NoiseThreshold => "minecraft:noise_threshold",
|
||||||
VerticalGradient => "minecraft:vertical_gradient",
|
VerticalGradient => "minecraft:vertical_gradient",
|
||||||
|
@ -4882,16 +5000,20 @@ registry!(WorldgenMaterialCondition, {
|
||||||
Hole => "minecraft:hole",
|
Hole => "minecraft:hole",
|
||||||
AbovePreliminarySurface => "minecraft:above_preliminary_surface",
|
AbovePreliminarySurface => "minecraft:above_preliminary_surface",
|
||||||
StoneDepth => "minecraft:stone_depth",
|
StoneDepth => "minecraft:stone_depth",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenMaterialRule, {
|
registry! {
|
||||||
|
enum WorldgenMaterialRule {
|
||||||
Bandlands => "minecraft:bandlands",
|
Bandlands => "minecraft:bandlands",
|
||||||
Block => "minecraft:block",
|
Block => "minecraft:block",
|
||||||
Sequence => "minecraft:sequence",
|
Sequence => "minecraft:sequence",
|
||||||
Condition => "minecraft:condition",
|
Condition => "minecraft:condition",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenPlacementModifierKind, {
|
registry! {
|
||||||
|
enum WorldgenPlacementModifierKind {
|
||||||
BlockPredicateFilter => "minecraft:block_predicate_filter",
|
BlockPredicateFilter => "minecraft:block_predicate_filter",
|
||||||
RarityFilter => "minecraft:rarity_filter",
|
RarityFilter => "minecraft:rarity_filter",
|
||||||
SurfaceRelativeThresholdFilter => "minecraft:surface_relative_threshold_filter",
|
SurfaceRelativeThresholdFilter => "minecraft:surface_relative_threshold_filter",
|
||||||
|
@ -4907,13 +5029,17 @@ registry!(WorldgenPlacementModifierKind, {
|
||||||
InSquare => "minecraft:in_square",
|
InSquare => "minecraft:in_square",
|
||||||
RandomOffset => "minecraft:random_offset",
|
RandomOffset => "minecraft:random_offset",
|
||||||
CarvingMask => "minecraft:carving_mask",
|
CarvingMask => "minecraft:carving_mask",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenRootPlacerKind, {
|
registry! {
|
||||||
|
enum WorldgenRootPlacerKind {
|
||||||
MangroveRootPlacer => "minecraft:mangrove_root_placer",
|
MangroveRootPlacer => "minecraft:mangrove_root_placer",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenStructurePiece, {
|
registry! {
|
||||||
|
enum WorldgenStructurePiece {
|
||||||
Mscorridor => "minecraft:mscorridor",
|
Mscorridor => "minecraft:mscorridor",
|
||||||
Mscrossing => "minecraft:mscrossing",
|
Mscrossing => "minecraft:mscrossing",
|
||||||
Msroom => "minecraft:msroom",
|
Msroom => "minecraft:msroom",
|
||||||
|
@ -4970,22 +5096,28 @@ registry!(WorldgenStructurePiece, {
|
||||||
Shipwreck => "minecraft:shipwreck",
|
Shipwreck => "minecraft:shipwreck",
|
||||||
Nefos => "minecraft:nefos",
|
Nefos => "minecraft:nefos",
|
||||||
Jigsaw => "minecraft:jigsaw",
|
Jigsaw => "minecraft:jigsaw",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenStructurePlacement, {
|
registry! {
|
||||||
|
enum WorldgenStructurePlacement {
|
||||||
RandomSpread => "minecraft:random_spread",
|
RandomSpread => "minecraft:random_spread",
|
||||||
ConcentricRings => "minecraft:concentric_rings",
|
ConcentricRings => "minecraft:concentric_rings",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenStructurePoolElement, {
|
registry! {
|
||||||
|
enum WorldgenStructurePoolElement {
|
||||||
SinglePoolElement => "minecraft:single_pool_element",
|
SinglePoolElement => "minecraft:single_pool_element",
|
||||||
ListPoolElement => "minecraft:list_pool_element",
|
ListPoolElement => "minecraft:list_pool_element",
|
||||||
FeaturePoolElement => "minecraft:feature_pool_element",
|
FeaturePoolElement => "minecraft:feature_pool_element",
|
||||||
EmptyPoolElement => "minecraft:empty_pool_element",
|
EmptyPoolElement => "minecraft:empty_pool_element",
|
||||||
LegacySinglePoolElement => "minecraft:legacy_single_pool_element",
|
LegacySinglePoolElement => "minecraft:legacy_single_pool_element",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenStructureProcessor, {
|
registry! {
|
||||||
|
enum WorldgenStructureProcessor {
|
||||||
BlockIgnore => "minecraft:block_ignore",
|
BlockIgnore => "minecraft:block_ignore",
|
||||||
BlockRot => "minecraft:block_rot",
|
BlockRot => "minecraft:block_rot",
|
||||||
Gravity => "minecraft:gravity",
|
Gravity => "minecraft:gravity",
|
||||||
|
@ -4996,9 +5128,11 @@ registry!(WorldgenStructureProcessor, {
|
||||||
BlackstoneReplace => "minecraft:blackstone_replace",
|
BlackstoneReplace => "minecraft:blackstone_replace",
|
||||||
LavaSubmergedBlock => "minecraft:lava_submerged_block",
|
LavaSubmergedBlock => "minecraft:lava_submerged_block",
|
||||||
ProtectedBlocks => "minecraft:protected_blocks",
|
ProtectedBlocks => "minecraft:protected_blocks",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenStructureKind, {
|
registry! {
|
||||||
|
enum WorldgenStructureKind {
|
||||||
BuriedTreasure => "minecraft:buried_treasure",
|
BuriedTreasure => "minecraft:buried_treasure",
|
||||||
DesertPyramid => "minecraft:desert_pyramid",
|
DesertPyramid => "minecraft:desert_pyramid",
|
||||||
EndCity => "minecraft:end_city",
|
EndCity => "minecraft:end_city",
|
||||||
|
@ -5015,18 +5149,22 @@ registry!(WorldgenStructureKind, {
|
||||||
Stronghold => "minecraft:stronghold",
|
Stronghold => "minecraft:stronghold",
|
||||||
SwampHut => "minecraft:swamp_hut",
|
SwampHut => "minecraft:swamp_hut",
|
||||||
WoodlandMansion => "minecraft:woodland_mansion",
|
WoodlandMansion => "minecraft:woodland_mansion",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenTreeDecoratorKind, {
|
registry! {
|
||||||
|
enum WorldgenTreeDecoratorKind {
|
||||||
TrunkVine => "minecraft:trunk_vine",
|
TrunkVine => "minecraft:trunk_vine",
|
||||||
LeaveVine => "minecraft:leave_vine",
|
LeaveVine => "minecraft:leave_vine",
|
||||||
Cocoa => "minecraft:cocoa",
|
Cocoa => "minecraft:cocoa",
|
||||||
Beehive => "minecraft:beehive",
|
Beehive => "minecraft:beehive",
|
||||||
AlterGround => "minecraft:alter_ground",
|
AlterGround => "minecraft:alter_ground",
|
||||||
AttachedToLeaves => "minecraft:attached_to_leaves",
|
AttachedToLeaves => "minecraft:attached_to_leaves",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
registry!(WorldgenTrunkPlacerKind, {
|
registry! {
|
||||||
|
enum WorldgenTrunkPlacerKind {
|
||||||
StraightTrunkPlacer => "minecraft:straight_trunk_placer",
|
StraightTrunkPlacer => "minecraft:straight_trunk_placer",
|
||||||
ForkingTrunkPlacer => "minecraft:forking_trunk_placer",
|
ForkingTrunkPlacer => "minecraft:forking_trunk_placer",
|
||||||
GiantTrunkPlacer => "minecraft:giant_trunk_placer",
|
GiantTrunkPlacer => "minecraft:giant_trunk_placer",
|
||||||
|
@ -5035,4 +5173,5 @@ registry!(WorldgenTrunkPlacerKind, {
|
||||||
FancyTrunkPlacer => "minecraft:fancy_trunk_placer",
|
FancyTrunkPlacer => "minecraft:fancy_trunk_placer",
|
||||||
BendingTrunkPlacer => "minecraft:bending_trunk_placer",
|
BendingTrunkPlacer => "minecraft:bending_trunk_placer",
|
||||||
UpwardsBranchingTrunkPlacer => "minecraft:upwards_branching_trunk_placer",
|
UpwardsBranchingTrunkPlacer => "minecraft:upwards_branching_trunk_placer",
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -7,49 +7,8 @@ REGISTRIES_DIR = get_dir_location('../azalea-registry/src/lib.rs')
|
||||||
|
|
||||||
|
|
||||||
def generate_registries(registries: dict):
|
def generate_registries(registries: dict):
|
||||||
code = []
|
with open(REGISTRIES_DIR, 'r') as f:
|
||||||
|
code = f.read().split('\n')
|
||||||
code.append('''#![doc = include_str!("../README.md")]
|
|
||||||
|
|
||||||
// This file is automatically generated in codegen/lib/code/registry.py
|
|
||||||
|
|
||||||
use azalea_buf::{BufReadError, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable};
|
|
||||||
use azalea_registry_macros::registry;
|
|
||||||
use std::io::{Cursor, Write};
|
|
||||||
|
|
||||||
pub trait Registry
|
|
||||||
where
|
|
||||||
Self: Sized,
|
|
||||||
{
|
|
||||||
fn from_u32(value: u32) -> Option<Self>;
|
|
||||||
fn to_u32(&self) -> u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A registry that might not be present. This is transmitted as a single
|
|
||||||
/// varint in the protocol.
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
||||||
pub struct OptionalRegistry<T: Registry>(Option<T>);
|
|
||||||
|
|
||||||
impl<T: Registry> McBufReadable for OptionalRegistry<T> {
|
|
||||||
fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
|
|
||||||
Ok(OptionalRegistry(match u32::var_read_from(buf)? {
|
|
||||||
0 => None,
|
|
||||||
value => Some(
|
|
||||||
T::from_u32(value - 1)
|
|
||||||
.ok_or(BufReadError::UnexpectedEnumVariant { id: value as i32 })?,
|
|
||||||
),
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<T: Registry> McBufWritable for OptionalRegistry<T> {
|
|
||||||
fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
|
|
||||||
match &self.0 {
|
|
||||||
None => 0u32.var_write_into(buf),
|
|
||||||
Some(value) => (value.to_u32() + 1).var_write_into(buf),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
''')
|
|
||||||
|
|
||||||
for registry_name, registry in registries.items():
|
for registry_name, registry in registries.items():
|
||||||
# registry!(Block, {
|
# registry!(Block, {
|
||||||
|
@ -64,15 +23,35 @@ impl<T: Registry> McBufWritable for OptionalRegistry<T> {
|
||||||
|
|
||||||
registry_struct_name = to_camel_case(registry_name.split(':')[1])
|
registry_struct_name = to_camel_case(registry_name.split(':')[1])
|
||||||
|
|
||||||
code.append(f'registry!({registry_struct_name}, {{')
|
registry_code = []
|
||||||
|
registry_code.append(f'enum {registry_struct_name} {{')
|
||||||
registry_entries = sorted(
|
registry_entries = sorted(
|
||||||
registry['entries'].items(), key=lambda x: x[1]['protocol_id'])
|
registry['entries'].items(), key=lambda x: x[1]['protocol_id'])
|
||||||
for variant_name, _variant in registry_entries:
|
for variant_name, _variant in registry_entries:
|
||||||
variant_struct_name = to_camel_case(
|
variant_struct_name = to_camel_case(
|
||||||
variant_name.split(':')[1])
|
variant_name.split(':')[1])
|
||||||
code.append(f'\t{variant_struct_name} => "{variant_name}",')
|
registry_code.append(f'\t{variant_struct_name} => "{variant_name}",')
|
||||||
code.append('});')
|
registry_code.append('}')
|
||||||
code.append('')
|
|
||||||
|
# when we find a "registry! {" line, find the next line that starts
|
||||||
|
# with "enum <name>" and replace that until we find a line that's "}"
|
||||||
|
found = False
|
||||||
|
in_registry_macro = False
|
||||||
|
for i, line in enumerate(list(code)):
|
||||||
|
if not in_registry_macro and line == "registry! {":
|
||||||
|
in_registry_macro = True
|
||||||
|
elif in_registry_macro and line == registry_code[0]:
|
||||||
|
# found it, now delete until we get to "}"
|
||||||
|
while code[i] != '}':
|
||||||
|
code.pop(i)
|
||||||
|
code[i] = '\n'.join(registry_code)
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
if not found:
|
||||||
|
code.append('registry! {')
|
||||||
|
code.append('\n'.join(registry_code))
|
||||||
|
code.append('}')
|
||||||
|
code.append('')
|
||||||
|
|
||||||
with open(REGISTRIES_DIR, 'w') as f:
|
with open(REGISTRIES_DIR, 'w') as f:
|
||||||
f.write('\n'.join(code))
|
f.write('\n'.join(code))
|
||||||
|
|
Loading…
Add table
Reference in a new issue