Skip to content

Commit

Permalink
protocol: Documentation for armour trims
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC committed Apr 29, 2023
1 parent dcf2f63 commit fbfa7f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
8 changes: 7 additions & 1 deletion minecraft/protocol/packet/trim_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ import (
"github.com/sandertv/gophertunnel/minecraft/protocol"
)

// TrimData is sent by the server to the client when they first join the server. It contains a list of all the patterns
// and materials that can be applied via armour trims.
type TrimData struct {
Patterns []protocol.TrimPattern
// Patterns is a list of patterns that can be applied to armour. Each pattern has its own style and texture that is
// defined through resource packs.
Patterns []protocol.TrimPattern
// Materials is a list of materials that can be applied to armour. These are mostly different ores that have different
// colours for more customization.
Materials []protocol.TrimMaterial
}

Expand Down
14 changes: 11 additions & 3 deletions minecraft/protocol/trim.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package protocol

// TrimPattern represnets a pattern that can be applied to an armour pice in combination with a TrimMaterial.
type TrimPattern struct {
ItemName string
// ItemName is the identifier of the item that represents the pattern, for example
// 'minecraft:wayfinder_armor_trim_smithing_template'.
ItemName string
// PatternID is the identifier of the pattern, for example 'wayfinder'.
PatternID string
}

Expand All @@ -11,10 +15,14 @@ func (x *TrimPattern) Marshal(r IO) {
r.String(&x.PatternID)
}

// TrimMaterial represents a material that can be used when applying an armour trim.
type TrimMaterial struct {
// MaterialID is the identifier of the material, for example 'netherite'.
MaterialID string
Colour string
ItemName string
// Colour is the colour code used for text formatting, for example '§j'.
Colour string
// ItemName is the identifier of the item that represents the material, for example 'minecraft:netherite_ingot'.
ItemName string
}

// Marshal ...
Expand Down

0 comments on commit fbfa7f0

Please sign in to comment.