Files
rust-minecraft-protocol/protocol-generator/templates/packet_structs.hbs
2021-01-24 02:11:26 +03:00

25 lines
668 B
Handlebars

{{~#each packets as |p|}}
{{~#if p.fields}}
#[derive(Packet, Debug)]
pub struct {{p.name}} {
{{~#each p.fields as |f|}}
{{~#if f.var_int}}
#[packet(with = "var_int")]{{/if}}
{{~#if f.var_long}}
#[packet(with = "var_long")]{{/if}}
{{~#if f.rest}}
#[packet(with = "rest")]{{/if}}
{{~#if f.hyphenated}}
#[packet(with = "uuid_hyp_str")]{{/if}}
{{~#if f.max_length}}
#[packet(max_length = {{f.max_length}})]{{/if}}
{{~#if (ne f.type "RefType")}}
pub {{f.name}}: {{f.type}}{{#unless @last}},{{/unless}}
{{~else}}
pub {{f.name}}: {{f.ref_name}}{{#unless @last}},{{/unless}}
{{~/if}}
{{~/each}}
}
{{/if}}
{{~/each}}