Fixed datafixes for the unicopia:charges component

This commit is contained in:
Sollace 2024-10-10 20:02:31 +01:00
parent aac9404848
commit 156e17bee5
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -64,9 +64,9 @@ final class UnicopiaItemStackComponentizations {
} }
private static void fixEnergy(ItemStackComponentizationFix.StackData data, Dynamic<?> dynamic, int maximum, int baseline) { private static void fixEnergy(ItemStackComponentizationFix.StackData data, Dynamic<?> dynamic, int maximum, int baseline) {
data.getAndRemove("energy").getElement("energy").result().ifPresent(energy -> { data.getAndRemove("energy").result().ifPresent(energy -> {
data.setComponent("unicopia:charges", dynamic.emptyMap() data.setComponent("unicopia:charges", dynamic.emptyMap()
.set("energy", dynamic.createInt((int)energy)) .set("energy", dynamic.createInt(energy.get("energy").asInt(energy.asInt(baseline))))
.set("maximum", dynamic.createInt(maximum)) .set("maximum", dynamic.createInt(maximum))
.set("baseline", dynamic.createInt(baseline)) .set("baseline", dynamic.createInt(baseline))
.set("show_in_tooltip", dynamic.createBoolean(true))); .set("show_in_tooltip", dynamic.createBoolean(true)));