Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ CrateAPI
- Easily summon chests
- with items!
- By RodrickLord ]]
- if not commands then
- error("Crate API needs a Command Computer!", 0)
- end
- function RandomSpawn()
- X = math.random(40)
- Y = math.random(38)
- end
- -- Thx awsumben13 for help in this function
- local function formatTable(t)
- local s = ""
- for i, v in ipairs(t) do
- if type(v) == "table" then
- local tagType = ""
- v.data = v.data or 0
- s = s .. "," .. ("{id:%d,Count:%db,Slot:%db,Damage:%ds}"):format(v.id,v.count,v.slot,v.data)
- end
- end
- return s:sub( 2 )
- end
- function summonCrate(x,y,z,itemTable)
- local items = formatTable(itemTable)
- commands.summon("FallingSand",x,y,z,"{TileID:54,Time:1,TileEntityData:{Items:["..items.."]}}")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement