# #This skirpt prevents loosing nbt when placing blocks or heads. # on place: set {sknbtpreserver.nbt::%event-location%} to 1 of tool of player # #Drop item with NBT when broken # on break: {sknbtpreserver.nbt::%event-location%} is set gamemode of player is survival cancel drops drop {sknbtpreserver.nbt::%event-location%} at event-location delete {sknbtpreserver.nbt::%event-location%} # #Drop item with NBT when exploded # on explode: loop exploded blocks: {sknbtpreserver.nbt::%location of loop-block%} is set remove loop-block from exploded blocks set loop-block to air drop {sknbtpreserver.nbt::%location of loop-block%} at location of loop-block delete {sknbtpreserver.nbt::%location of loop-block%} # #FUNCTIONS # #Get Item from a block function SkNBTPreserverGetItemFromBlock(block: block) :: item: if {sknbtpreserver.nbt::%location of {_block}%} is set: return {sknbtpreserver.nbt::%location of {_block}%} #Get Item from a location (same as above, but from a location. Don't know if it's useful) function SkNBTPreserverGetItemFromLocation(location: location) :: item: if {sknbtpreserver.nbt::%{_location}%} is set: return {sknbtpreserver.nbt::%{_location}%} #Get name of a block function SkNBTPreserverGetNameFromBlock(block: block) :: string: if {sknbtpreserver.nbt::%location of {_block}%} is set: return formatted name of {sknbtpreserver.nbt::%location of {_block}%} # #CHECK BLOCKS EVERY 5 MINUTES # every 5 minutes: loop {sknbtpreserver.nbt::*}: if block at loop-value is air: remove loop-value from {sknbtpreserver.nbt::*}