Skip to content

Commit

Permalink
item/colour.go: Change the RGBA value for black
Browse files Browse the repository at this point in the history
Leather armour dying, cauldron water dying, and firework stars expect a black colour of rgba(21, 21, 33). The black colour of sign text is the exception.
  • Loading branch information
DaPigGuy committed Nov 28, 2024
1 parent 6ec631b commit a465241
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/block/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ func (s Sign) BreakInfo() BreakInfo {
// Dye dyes the Sign, changing its base colour to that of the colour passed.
func (s Sign) Dye(pos cube.Pos, userPos mgl64.Vec3, c item.Colour) (world.Block, bool) {
if s.EditingFrontSide(pos, userPos) {
if s.Front.BaseColour == c.RGBA() {
if s.Front.BaseColour == c.SignRGBA() {
return s, false
}
s.Front.BaseColour = c.RGBA()
s.Front.BaseColour = c.SignRGBA()
} else {
if s.Back.BaseColour == c.RGBA() {
if s.Back.BaseColour == c.SignRGBA() {
return s, false
}
s.Back.BaseColour = c.RGBA()
s.Back.BaseColour = c.SignRGBA()
}
return s, true
}
Expand Down
10 changes: 10 additions & 0 deletions server/item/colour.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,18 @@ func (c colour) RGBA() color.RGBA {
case 14:
return color.RGBA{R: 0xb0, G: 0x2e, B: 0x26, A: 0xff}
default:
return color.RGBA{R: 0x1d, G: 0x1d, B: 0x21, A: 0xff}
}
}

// SignRGBA returns the colour as RGBA. It is identical to the RGBA method, except for the colour black. For the colour
// black, a value of rgba(0, 0, 0, 255) is returned rather than rgba(29, 29, 33, 255), in order to match the black sign
// text colour found in vanilla Minecraft.
func (c colour) SignRGBA() color.RGBA {
if c == 0 {
return color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff}
}
return c.RGBA()
}

// String ...
Expand Down

0 comments on commit a465241

Please sign in to comment.