docs: add godoc comments to all exported functions and methods
This commit is contained in:
@@ -19,6 +19,7 @@ type Item struct {
|
||||
var ItemsCache = make(map[string][]*Item)
|
||||
var ItemsCacheMutex = &sync.RWMutex{}
|
||||
|
||||
// ItemsForVersion returns the item definitions for the given Minecraft version, caching them after the first load.
|
||||
func ItemsForVersion(v string) (ret []*Item) {
|
||||
var ok bool
|
||||
ItemsCacheMutex.RLock()
|
||||
@@ -35,6 +36,7 @@ func ItemsForVersion(v string) (ret []*Item) {
|
||||
return b
|
||||
}
|
||||
|
||||
// LookupItemById returns the item with the given numeric ID in the given version.
|
||||
func LookupItemById(version string, id int32) (item *Item, ok bool) {
|
||||
for _, i := range ItemsForVersion(version) {
|
||||
if i.Id == id {
|
||||
@@ -46,6 +48,7 @@ func LookupItemById(version string, id int32) (item *Item, ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
// LookupItemByName returns the item with the given name in the given version.
|
||||
func LookupItemByName(version string, name string) (item *Item, ok bool) {
|
||||
for _, i := range ItemsForVersion(version) {
|
||||
if i.Name == name {
|
||||
|
||||
Reference in New Issue
Block a user