PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

Dye now can be used to change Sign text color

Open alvin0319 opened this issue 3 years ago • 7 comments

Introduction

Before this PR, the player cannot change the Sign text color by clicking with Dye.

This PR implements changing the Sign text color by clicking with Dye.

Relevant issues

N/A

Changes

API changes

  • Added SignText::getBaseColor(): returns the base text color of sign
  • Added SignText::isGlowingText(): returns whether Sign text has been changed to glow by the Dye

Behavioural changes

  • Player now can change Sign text color by clicking sign with Dye
  • SignChangeEvent is now also fired when changing text color or glowing text of sign

Backwards compatibility

N/A

Follow-up

N/A

Tests

https://user-images.githubusercontent.com/32565818/147897958-d1a880c0-e1fc-4ec5-9bac-7ffd874010be.mp4

alvin0319 avatar Jan 03 '22 03:01 alvin0319

The text is not the same after rejoining the server.

Before (using white dye) image

After image

dktapps avatar Jan 03 '22 16:01 dktapps

This is implemented completely incorrectly. Don't use the wiki for your source of information.

dktapps avatar Jan 03 '22 16:01 dktapps

  • The text is not supposed to glow unless using Glow Ink Sac, which is not currently implemented: image
  • The glow of text can be removed by using Ink Sac.
  • Applying colour codes to the text is unnecessary.
  • The usage of NBT is incorrect. Bedrock uses a SignTextColor tag, which is an integer containing an ARGB colour code. This means that the PR is significantly overcomplicated (it's as simple as using DyeColor->getRgbValue() to store a Color object, except for black, which should use 0,0,0 - this makes the game show a white border instead of black).

dktapps avatar Jan 03 '22 16:01 dktapps

  • There are also sounds that should be played when using dye or ink sacs on signs.

dktapps avatar Jan 03 '22 17:01 dktapps

Do any other things need to be fixed/changed?

alvin0319 avatar May 21 '22 16:05 alvin0319

There are still unresolved review comments.

dktapps avatar May 21 '22 16:05 dktapps

Changed target to PM5 (next-major)

alvin0319 avatar Jul 06 '22 16:07 alvin0319

I've made some modifications to the PR, to handle TextIgnoreLegacyBugResolved properly, tidy up the code and improve some doc comments.

dktapps avatar Aug 21 '22 19:08 dktapps