Skip to content
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

Update Pickonimbus 2000 max durability #504

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.lwjgl.input.Keyboard
import java.awt.Color
import kotlin.math.min
import kotlin.math.pow

object ItemFeatures {
Expand Down Expand Up @@ -653,11 +654,19 @@ object ItemFeatures {
stackTip = ItemUtil.getStarCount(extraAttributes).toString()
}
if (extraAttributes.hasKey("pickonimbus_durability")) {
RenderUtil.drawDurabilityBar(
event.x,
event.y,
1 - extraAttributes.getInteger("pickonimbus_durability") / 5000.0
)
val durability = extraAttributes.getInteger("pickonimbus_durability")
/*
Old Pickonimbuses had 5000 durability. If they were at full durability, they were nerfed to 2000.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if > 2000 then 5000 else 2000 i guess would be the only way

not sure which is more preferable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could kinda work, but it would suddenly jump to showing full durability once it reaches 2000.

However, if they were not at full durability, they were left alone. Therefore, it's not really
possible to check the true max durability, so we just clamp any durability above 2000 to 2000.
*/
if (durability < 2000) {
RenderUtil.drawDurabilityBar(
event.x,
event.y,
1 - min(durability, 2000) / 2000.0
)
}
}
if (Skytils.config.showAttributeShardAbbreviation && itemId == "ATTRIBUTE_SHARD" && extraAttributes.getCompoundTag(
"attributes"
Expand Down
Loading