Add VarLong encoder/decoder and integrate into generation pipeline

This commit is contained in:
adman
2025-12-24 12:35:14 +01:00
parent dd41115ca2
commit db091d17df
7 changed files with 52 additions and 21 deletions
+6
View File
@@ -507,6 +507,11 @@ func VarIntDecoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s
return
}
func VarLongDecoder(g *Generator, varToSet ast.Expr, dataRaw any, name string) (s []ast.Stmt, err error) {
s = Stmts(Assign(Exprs(varToSet, Ident("err")), Exprs(Call(Selector("proto_base", "DecodeVarLong"), Ident("r")))), IfErrNil())
return
}
func (g *Generator) RegisterDecoderNatives() {
g.DecoderNatives = map[string]FunctionGeneratorFunc{
"container": ContainerDecoder,
@@ -521,6 +526,7 @@ func (g *Generator) RegisterDecoderNatives() {
"void": DefaultDecoder,
"varint": VarIntDecoder,
"varlong": VarLongDecoder,
"anonymousNbt": DefaultDecoder,
"anonOptionalNbt": DefaultDecoder, // I have no idea what the difference is between these two
"UUID": UUIDDecoder,