Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("nbt")
- local p=peripheral.wrap("left")
- local world=p.getWorld(0)
- function chest(x,y,z,itemid)
- -- Create a chest
- world.setBlock(x, y, z, 54, 0)
- -- Get an NBT table representing the contents of the chest
- local te = world.getTileEntity(x, y, z)
- local nbt = readTileNBT(te)
- table.insert(nbt.value.Items.value, {
- type="compound", value={
- id={
- type="short",
- value=itemid
- }, Count={
- type="byte",
- value=1
- }, Damage={
- type="short",
- value=0
- }, Slot={
- type="byte",
- value=0
- }, tag={
- type="compound",
- value={
- ["ench"]={
- ["type"]="list",
- ["value"]={
- [1]={
- ["value"]={
- ["id"]={
- ["value"]=34,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- },
- },
- ["type"]="compound"
- }, [2]={
- ["value"]={
- ["id"]={
- ["value"]=32,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [3]={
- ["value"]={
- ["id"]={
- ["value"]=0,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [4]={
- ["value"]={
- ["id"]={
- ["value"]=2,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [5]={
- ["value"]={
- ["id"]={
- ["value"]=5,
- ["type"]="short"},
- ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [6]={
- ["value"]={
- ["id"]={
- ["value"]=6,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [7]={
- ["value"]={
- ["id"]={
- ["value"]=16,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [8]={
- ["value"]={
- ["id"]={
- ["value"]=19,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [9]={
- ["value"]={
- ["id"]={
- ["value"]=20,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [10]={
- ["value"]={
- ["id"]={
- ["value"]=21,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [11]={
- ["value"]={
- ["id"]={
- ["type"]="short",
- ["value"]=21
- }, ["lvl"]={
- ["value"]=100,["type"]="short"
- }
- },
- ["type"]="compound"
- }, [12]={
- ["value"]={
- ["id"]={
- ["value"]=35,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [13]={
- ["value"]={
- ["id"]={
- ["value"]=51,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [14]={
- ["value"]={
- ["id"]={
- ["value"]=48,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }, [15]={
- ["value"]={
- ["id"]={
- ["value"]=49,
- ["type"]="short"
- }, ["lvl"]={
- ["value"]=100,
- ["type"]="short"
- }
- },
- ["type"]="compound"
- }
- }
- }
- }
- }
- }
- })
- writeTileNBT(te, nbt)
- end
- while true do
- ev,name,msg=os.pullEvent("chat_message")
- if msg:sub(1,5)=="/ench" then
- user=p.getPlayerByName(name)
- ent=user.asEntity()
- x,y,z=ent.getPosition()
- chest(x,y,z,tonumber(msg:sub(7)))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement