Advertisement
justync7

skullspawn

Jul 1st, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. shell.run("nbt")
  2. p=peripheral.wrap("left")
  3. world=p.getWorld(0)
  4.  
  5. function chest(x,y,z,SkullName)
  6. -- Create a chest
  7. world.setBlockWithoutNotify(x, y, z, 54, 0)
  8.  
  9. -- Get an NBT table representing the contents of the chest
  10. local te = world.getTileEntity(x, y, z)
  11. local nbt = readTileNBT(te)
  12.  
  13. -- Add a stack of bedrock in slot 0
  14. table.insert(nbt.value.Items.value, {type="compound", value={id={type="short", value=397}, Count={type="byte", value=1}, Damage={type="short", value=3}, Slot={type="byte", value=0},tag={type="compound", value={SkullOwner={type="string",value=SkullName}}}}})
  15.  
  16. writeTileNBT(te, nbt)
  17. end
  18.  
  19. while true do
  20. ev,name,msg=os.pullEvent("chat_message")
  21. if msg:sub(1,6)=="/skull" and msg:sub(8)~=nil then
  22. user=p.getPlayerByName(name)
  23. ent=user.asEntity()
  24. x,y,z=ent.getPosition()
  25. chest(x,y,z,msg:sub(8))
  26. end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement