-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Destroyable - Add new sparks parameter value of "near" #1405
Conversation
Signed-off-by: arcadeboss <[email protected]>
I think it needs a better name, maybe consider allowing sparks to have true, false, and 'near' that disables the global sound instead of a diff attr |
I considered that, but felt wrong to change the type, but if you think it's okay, then alright. |
as long as it's backwards-compatible in xml, i don't think it's an issue |
Signed-off-by: arcadeboss <[email protected]>
I have updated the code to use an Enum to enforce the 3 spark type values of "true", "false" and "near" The code is backwards compatible, so current uses of "true" and "false" remain the same, and "near" provides the new logic of having sparks, but no far match sounds. There is a check for valid sparks values. and a corresponding exception thrown if non-valid value provided. |
core/src/main/java/tc/oc/pgm/destroyable/DestroyableFactory.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/destroyable/DestroyableModule.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/destroyable/DestroyableFactory.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/destroyable/DestroyableFactory.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/destroyable/DestroyableFactory.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/destroyable/DestroyableFactory.java
Outdated
Show resolved
Hide resolved
Signed-off-by: arcadeboss <[email protected]>
Updated from review comments. Abandoned aliasing, because couldn't make it work with parseEnum, but got everything else. |
Signed-off-by: arcadeboss <[email protected]>
Should be working out of the box, it's built-in already as long as you implement the aliasing interface in pgm like settings do |
This is what I implemented. It complies, but at run time gives following error:
See anything wrong?
|
The first attempt at iterator() above was based on the MapPoolType class enum which has the same iterator method that you shared. But you, also mentioned following a settings enum, so I tried implementing like SettingKey class does it, but it gets the same results at run time that first one did. It looks like this:
|
Looked into why aliased enums were being rejected myself and submitted a fix into the PR myself, should be good to go now |
Signed-off-by: Pablo Herrera <[email protected]>
b96dbff
to
33a45fe
Compare
Also note, for backwards-compat we need to support "true", "yes", and "on" variants as those are all valid boolean parsing in pgm xml (ie: you could do |
Wow, that's awesome, thank you for those updates! I was poking around in the text parser, but never would have figured out those changes. Nice on the extended enums. |
Uses the new feature added in PGMDev/PGM#1405
Adds a new parameter "sparks-match" to Destroyable
"sparks" must be active for "sparks-match" to have any effect
With the default value of "true" there is no change to current behavior for Destroyable sparks.
With value of "false" PGM will skip the far (+64 blocks away) logic
Purpose is to reduce the "noise" for players not actually near the action, especially for large Destroyables
Tested and verified that sound behavior changed for players and observers