-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Feature: Armor Stack Decay Timer #2538
base: beta
Are you sure you want to change the base?
Conversation
I dont think the dependency is good here, the other PR has been dead for months, would be better to just review/merge this one with good changes. |
ill close the other one then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks mostly fine.
Feature works also cool in game.
But i could not get it to work with 3/4 aurora armor.
and with 3/4 crimson the timer was 1-2 seconds off: the display showed "0s" for 1-2 seconds until it finally removed one stack.
Also suggested some code cleanup and consistnecy changes
@Accordion | ||
// TODO rename to armor stack display | ||
public StackDisplayConfig stackDisplayConfig = new StackDisplayConfig(); | ||
public ArmorStackDisplayConfig armorStackDisplayConfig = new ArmorStackDisplayConfig(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the suffix "Config" from the variable name (not the class name)
|
||
public class ArmorStackDisplayConfig { | ||
@Expose | ||
@ConfigOption(name = "Enable", desc = "Enable the armor stack display feature.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain a bit more what this feature does. (include crimson armor names maybe, or their ability names)
@ConfigOption(name = "Enable", desc = "Enable the armor stack display feature.") | ||
@ConfigEditorBoolean | ||
@FeatureToggle | ||
public boolean enabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make this default diabled
|
||
private fun drawDisplay(): List<String> { | ||
if (stackCount == 0 || armorPieceCount < 3) return emptyList() | ||
val displaySingleLine = config.showInSingleLine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the config variables here can all be removed/inlined (not the isMaxStack one)
if (!isEnabled()) return | ||
config.position.renderString(display, posLabel = "Armor Stack Display") | ||
display = drawDisplay() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a check so that this only happens every second tick (10 times a second, not 20 times a second). Can be done via event.isMod(2)
else -> "§b" | ||
} | ||
|
||
if (displaySingleLine) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can move the two returns below to this if block directly
|
||
@SubscribeEvent | ||
fun onWorldChange(event: LorenzWorldChangeEvent) { | ||
if (!isEnabled()) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the check here can go
|
||
@SubscribeEvent | ||
fun onPlaySound(event: PlaySoundEvent) { | ||
if (!isEnabled() && !config.armorStackDecayTimer) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the AND here is wrong, a OR makes more sense to me
@SubscribeEvent | ||
fun onPlaySound(event: PlaySoundEvent) { | ||
if (!isEnabled() && !config.armorStackDecayTimer) return | ||
if (event.soundName in listOf("tile.piston.out", "tile.piston.in") && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move the list into a member of the class so that we dont need to recreate it each time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionally, a set is probably better than a list here?
|
||
private fun resetDecayTime() { | ||
armorPieceCount = InventoryUtils.getArmor().firstNotNullOfOrNull { armor -> | ||
val lore = armor?.getLore().toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont like the getLore().toString()
workaround here. i think we have another matcher utils function that works with a list and uses the first/last directly
I have detected some issues with your pull request: Body issues: Please fix these issues. For the correct format, refer to the pull request template. |
What
This adds a decay timer for armor stacks. When a stack reaches max stacks (10), text color changes for better experience. Decay timer can be toggled to show only for the 10th stack.
Images
Changelog New Features
Changelog Improvements
Armor Stack Display
is enabled. - Ovi_1Changelog Technical Details
StackDisplayConfig
toArmorStackDisplayConfig
. - Ovi_1