-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
218 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package basic | ||
|
||
import ( | ||
"bytes" | ||
"errors" | ||
|
||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
|
||
func (p *Player) handleUpdateTags(packet pk.Packet) error { | ||
r := bytes.NewReader(packet.Data) | ||
|
||
var length pk.VarInt | ||
_, err := length.ReadFrom(r) | ||
if err != nil { | ||
return Error{err} | ||
} | ||
|
||
var registryID pk.Identifier | ||
for i := 0; i < int(length); i++ { | ||
_, err = registryID.ReadFrom(r) | ||
if err != nil { | ||
return Error{err} | ||
} | ||
|
||
registry := p.c.Registries.Registry(string(registryID)) | ||
if registry == nil { | ||
return Error{errors.New("unknown registry: " + string(registryID))} | ||
} | ||
|
||
_, err = registry.ReadTagsFrom(r) | ||
if err != nil { | ||
return Error{err} | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Registry System | ||
|
||
instance { | ||
ResourceLocation { | ||
namespace: string | ||
path: string | ||
} | ||
|
||
ResourceKey<T> { | ||
registryName: ResourceLocation | ||
location: ResourceLocation | ||
} | ||
|
||
registry<T> { | ||
getId(T): int | ||
byId(int): T | ||
|
||
getKey(T): ResourceLocation | ||
getResourceKey(T): ResourceKey<T> | ||
get(ResourceKey<T>): T | ||
get(ResourceLocation): T | ||
|
||
getTags(TagKey<T>): (TagKey<T>, *T[])[] | ||
getTagNames(): TagKey<T>[] | ||
resetTags() | ||
bindTags((TagKey<T>, *T[])[]) | ||
}[] | ||
|
||
TagKey<T> { | ||
*Registry<T> | ||
ResourceLocation | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters