package Ġcom . un rel ent less . mess . extensions Ċ Ċ import Ġcom . un rel ent less . mess . inventory . Lim b Inventory Ċ import Ġnet . minecraft . item . ItemStack Ċ import Ġnet . minecraft . nbt . Compound Tag Ċ import Ġnet . minecraft . util . Identifier Ċ import Ġnet . minecraft . util . registry . Registry Ċ Ċ fun ĠCompound Tag . serialize Lim b ( li mb Inventory : ĠLim b Inventory ): ĠCompound Tag Ġ{ ĊĠĠĠ Ġval Ġitem Stack Ġ= Ġli mb Inventory . get Stack () ĊĠĠĠ Ġval Ġcompound Tag Ġ= ĠCompound Tag () ĊĊĠĠĠ Ġcompound Tag . putString (" id ", ĠRegistry . ITEM . getId ( item Stack . item ). toString ()) ĊĠĠĠ Ġcompound Tag . put Int (" count ", Ġitem Stack . count ) ĊĊĠĠĠ Ġif Ġ( item Stack . tag Ġ!= Ġnull ) Ġ{ Ġcompound Tag . put (" tag ", Ġitem Stack . tag ?. copy ()) Ġ} ĊĊĠĠĠ Ġput (" item ", Ġcompound Tag ) ĊĊĠĠĠ Ġreturn Ġthis Ċ } Ċ Ċ fun ĠCompound Tag . deserialize Lim b ( li mb Inventory : ĠLim b Inventory ): ĠCompound Tag Ġ{ ĊĠĠĠ Ġif (! contains (" item ")) Ġreturn Ġthis ĊĊĠĠĠ Ġval Ġcompound Tag Ġ= Ġthis . get Compound (" item ") ĊĠĠĠ Ġval Ġitem Ġ= ĠRegistry . ITEM [ Identifier ( compound Tag . getString (" id ")) ] ĊĠĠĠ Ġval Ġstack Ġ= ĠItemStack ( item ) ĊĊĠĠĠ Ġstack . count Ġ= Ġcompound Tag . getInt (" count ") ĊĊĠĠĠ Ġif ( compound Tag . contains (" tag ")) Ġ{ Ġstack . tag Ġ= Ġcompound Tag . get Compound (" tag ") Ġ} ĊĠĠĠ Ġli mb Inventory . set Stack ( 0 , Ġstack ) ĊĊĠĠĠ Ġreturn Ġthis Ċ } Ċ Ċ fun ĠCompound Tag . deserialize Inner Stack (): ĠItemStack ? Ġ{ ĊĠĠĠ Ġif (! this . contains (" item ")) Ġreturn Ġnull ĊĊĠĠĠ Ġval Ġcompound Tag Ġ= Ġthis . get Compound (" item ") ĊĠĠĠ Ġval Ġitem Ġ= ĠRegistry . ITEM [ Identifier ( compound Tag . getString (" id ")) ] ĊĠĠĠ Ġval Ġitem Stack Ġ= ĠItemStack ( item ) ĊĠĠĠ Ġitem Stack . count Ġ= Ġcompound Tag . getInt (" count ") ĊĊĠĠĠ Ġif ( compound Tag . contains (" tag ")) Ġ{ Ġitem Stack . tag Ġ= Ġcompound Tag . get Compound (" tag ") Ġ} ĊĊĠĠĠ Ġreturn Ġitem Stack Ċ } ĊĊ