package Ġli rand . api . nbt Ċ Ċ import Ġli rand . api . extensions . server . nms Number Version Ċ import Ġli rand . api . extensions . server . nms Version Ċ import Ġorg . bukkit . block . Tile State Ċ import Ġorg . bukkit . entity . Entity Ċ import Ġorg . bukkit . inventory . ItemStack Ċ import Ġorg . bukkit . inventory . meta . Item Meta Ċ Ċ var ĠEntity . nbt Data : ĠNbt Data Ċ ĉ get () Ġ{ Ċĉ ĉ val Ġn bt Tag Compound Ġ= Ġn bt Compound Constructor . newInstance () ĊĊĉ ĉ val Ġentity Ġ= Ġcraft Entity Get Handle Method . invoke ( this ) ĊĊĉ ĉ minecraft Entity Save Method . invoke ( entity , Ġn bt Tag Compound ) ĊĊĉ ĉ return ĠNbt Data ( nbt Tag Compound ) Ċ ĉ } Ċ ĉ set ( value ) Ġ{ Ċĉ ĉ val Ġentity Ġ= Ġcraft Entity Get Handle Method . invoke ( this ) ĊĊĉ ĉ minecraft Entity Load Method . invoke ( entity , Ġvalue . nbt Tag Compound ) Ċ ĉ } ĊĊ Ċ var ĠItemStack . nbt Data : ĠNbt Data Ċ ĉ get () Ġ{ Ċĉ ĉ val Ġitem Stack Ġ= Ġas NM SC opy Method . invoke ( null , Ġthis ) ĊĊĉ ĉ return ĠNbt Data ( minecraft ItemStack Tag Field . get ( item Stack )) Ċ ĉ } Ċ ĉ set ( value ) Ġ{ Ċĉ ĉ val Ġn ms ItemStack Ġ= Ġ( as NM SC opy Method . invoke ( null , Ġthis )). apply Ġ{ Ċĉĉ ĉ minecraft ItemStack Set Tag Method . invoke ( this , Ġvalue . nbt Tag Compound ) Ċĉ ĉ } Ċĉ ĉ item Meta Ġ= ĠgetItem Meta Method . invoke ( null , Ġn ms ItemStack ) Ġas ĠItem Meta Ċ ĉ } ĊĊ Ċ var ĠTile State . nbt Data : ĠNbt Data Ċ ĉ get () Ġ{ Ċĉ ĉ val Ġn bt Tag Compound Ġ= Ġtile State Get Snapshot NBT Method . invoke ( this ) ĊĊĉ ĉ return ĠNbt Data ( nbt Tag Compound ) Ċ ĉ } Ċ ĉ set ( value ) Ġ{ Ċĉ ĉ val Ġsnapshot Ġ= Ġtile State Get Snapshot Method . invoke ( this ) ĊĊĉ ĉ if Ġ( nms Number Version Ġ< Ġ 1 7 ) Ġ{ Ċĉĉ ĉ block Entity Load Method . invoke ( Ċĉĉĉ ĉ snapshot , Ġtile State Get Handle Method . invoke ( this ), Ġvalue . nbt Tag Compound Ċĉĉ ĉ ) Ċĉ ĉ } Ċĉ ĉ else Ġ{ Ċĉĉ ĉ block Entity Load Method . invoke ( snapshot , Ġvalue . nbt Tag Compound ) Ċĉ ĉ } Ċ ĉ } ĊĊĊ Ċ private Ġval Ġcraft ItemStack Class Ġ= Ċ ĉ Class . forName (" org . bukkit . craft bukkit . v $ nms Version . inventory . Craft ItemStack ") Ċ Ċ private Ġval Ġcraft Entity Get Handle Method Ġ= Ċ ĉ Class . forName (" org . bukkit . craft bukkit . v $ nms Version . entity . Craft Entity ") Ċĉ ĉ . getMethod (" get Handle ") ĊĊ Ċ private Ġval Ġas NM SC opy Method Ġ= Ċ ĉ craft ItemStack Class . getMethod (" as NM SC opy ", ĠItemStack :: class . java ) Ċ Ċ private Ġval ĠgetItem Meta Method Ġ= Ġcraft ItemStack Class . methods Ċ ĉ . find Ġ{ Ċĉ ĉ it . name Ġ== Ġ" getItem Meta " Ġ&& Ġit . parameter Types . let Ġ{ Ċĉĉ ĉ it . size Ġ== Ġ 1 Ġ&& Ġit [ 0 ] Ġ== Ġas NM SC opy Method . returnType Ċĉ ĉ } Ċ ĉ } !! ĊĊ Ċ private Ġval Ġtile State Class Ġ= Ċ ĉ Class . forName (" org . bukkit . craft bukkit . v $ nms Version . block . Craft Block Entity State ") Ċ Ċ private Ġval Ġtile State Get Snapshot Method Ġ= Ġtile State Class . getDeclared Method (" get Snapshot ") Ċ ĉ . apply Ġ{ Ġis Accessible Ġ= Ġtrue Ġ} Ċ Ċ private Ġval Ġtile State Get Snapshot NBT Method Ġ= Ġtile State Class . getMethod (" get Snapshot NBT ") ĊĊĊ Ċ private Ġval Ġm inecraft Entity Class Ġ= Ġcraft Entity Get Handle Method . returnType Ċ Ċ private Ġval Ġm inecraft Entity Load Method Ġ= Ġm inecraft Entity Class . methods Ċ ĉ . find Ġ{ Ċĉ ĉ it . returnType Ġ== ĠVoid . TYPE Ġ&& Ġit . parameter Types . let Ġ{ Ċĉĉ ĉ it . size Ġ== Ġ 1 Ġ&& Ġit [ 0 ] Ġ== Ġn bt Compound Class Ċĉ ĉ } Ċ ĉ } !! Ċ private Ġval Ġm inecraft Entity Save Method Ġ= Ġm inecraft Entity Class . methods Ċ ĉ . find Ġ{ Ċĉ ĉ it . returnType Ġ== Ġn bt Compound Class Ġ&& Ġit . parameter Types . let Ġ{ Ċĉĉ ĉ it . size Ġ== Ġ 1 Ġ&& Ġit [ 0 ] Ġ== Ġn bt Compound Class Ċĉ ĉ } Ċ ĉ } !! ĊĊ Ċ private Ġval Ġm inecraft ItemStack Class Ġ= Ġas NM SC opy Method . returnType Ċ Ċ private Ġval Ġm inecraft ItemStack Tag Field Ġ= Ġm inecraft ItemStack Class . declared Fields Ċ ĉ . find Ġ{ Ġit . type Ġ== Ġn bt Compound Class Ġ} !! Ċ ĉ . apply Ġ{ Ġis Accessible Ġ= Ġtrue Ġ} Ċ Ċ private Ġval Ġm inecraft ItemStack Set Tag Method Ġ= Ġm inecraft ItemStack Class . methods Ċ ĉ . find Ġ{ Ċĉ ĉ it . returnType Ġ== ĠVoid . TYPE Ġ&& Ġit . parameter Types . let Ġ{ Ċĉĉ ĉ it . size Ġ== Ġ 1 Ġ&& Ġit [ 0 ] Ġ== Ġn bt Compound Class Ċĉ ĉ } Ċ ĉ } !! ĊĊ Ċ private Ġval Ġblock Entity Class Ġ= Ġtile State Get Snapshot Method . returnType Ċ Ċ private Ġval Ġtile State Get Handle Method Ġ= Ġtile State Class . getMethod (" get Handle ") Ċ Ċ private Ġval Ġblock Entity Load Method Ġ= Ġblock Entity Class . methods . let Ġ{ Ċ ĉ if Ġ( nms Number Version Ġ< Ġ 1 7 ) Ġ{ Ċĉ ĉ it . find Ġ{ Ċĉĉ ĉ it . returnType Ġ== ĠVoid . TYPE Ġ&& Ġit . parameter Types . let Ġ{ Ċĉĉĉ ĉ it . size Ġ== Ġ 2 Ġ&& Ġit [ 0 ] Ġ== Ġtile State Get Handle Method . returnType Ġ&& Ġit [ 1 ] Ġ== Ġn bt Compound Class Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } Ċ ĉ else Ġ{ Ċĉ ĉ it . find Ġ{ Ċĉĉ ĉ it . returnType Ġ== ĠVoid . TYPE Ġ&& Ġit . parameter Types . let Ġ{ Ċĉĉĉ ĉ it . size Ġ== Ġ 1 Ġ&& Ġit [ 0 ] Ġ== Ġn bt Compound Class Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } Ċ } !!