Skip to content

Commit

Permalink
[fix] Force unknowns to have priority render
Browse files Browse the repository at this point in the history
  • Loading branch information
bibi-reden committed Oct 4, 2024
1 parent 93e3dce commit bcc678c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Overview
**There are breaking changes in this release. Ensure you back up your config(s) if possible.**
**There are breaking changes in this release. Ensure you back up your config(s) if possible. Mods relying on the beta version will have to be updated.**

*Welcome to the release of the new Data Attributes. This has taken a considerable amount of time to complete.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class AttributeFunctionProvider(val option: Option<AttributeFunctionConfig>) : F
}
)

child(cf)
if (id.toString() == "minecraft:unknown" && children.size > 1) child(1, cf)
else child(cf)
}
}

Expand Down Expand Up @@ -196,7 +197,9 @@ class AttributeFunctionProvider(val option: Option<AttributeFunctionConfig>) : F
child(SearchAnchorComponent(titleLayout(), Option.Key.ROOT, { id.toString() }, { Text.translatable(id.toTranslationKey()).toString() }))
}

parent.child(container)
if (id.toString() == "minecraft:unknown" && parent.children().size > 1) parent.child(1, container)
else parent.child(container)

entryComponents[id] = container

// force a rearrangement to bring the dock up top~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,17 @@ class AttributeOverrideProvider(val option: Option<Map<Identifier, AttributeOver
})
container.id(id.toString())
}
.also(::child)
.also {
if (id.toString() == "minecraft:unknown" && children.size > 1) child(1, it)
else child(it)
}
.also { trackedContainers[id] = it }
}

init {
child(
Components.button(Text.translatable("text.config.data_attributes.buttons.add")) {
backing[Identifier.of("unresolved", "id")!!] = AttributeOverride()
backing[Identifier("unknown")] = AttributeOverride()
refreshAndDisplayAttributes()
}
.renderer(ButtonRenderers.STANDARD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class EntityTypesProvider(val option: Option<Map<Identifier, EntityTypeData>>) :
fl.child(Components.button(Text.translatable("text.config.data_attributes.data_entry.edit")) {
if (ct.childById(FlowLayout::class.java, "edit-field") == null) {
val field = FieldComponents.identifier(
{ newId, field ->
{ newId, _ ->
if (backing.containsKey(newId) || !Registries.ENTITY_TYPE.containsId(newId)) return@identifier
// ensured that this exists and is possible to swap
backing.remove(id)?.let { backing[newId] = it }
Expand Down Expand Up @@ -92,7 +92,9 @@ class EntityTypesProvider(val option: Option<Map<Identifier, EntityTypeData>>) :

child(SearchAnchorComponent(ct.titleLayout(), Option.Key.ROOT, id::toString, { Text.translatable(id.toTranslationKey()).toString() }))

child(ct)

if (id.toString() == "minecraft:unknown" && children.size > 1) child(1, ct)
else child(ct)
}

for ((entryId, entry) in types) {
Expand Down Expand Up @@ -192,7 +194,8 @@ class EntityTypesProvider(val option: Option<Map<Identifier, EntityTypeData>>) :

entryComponents[id] = ct

parent.child(ct)
if (id.toString() == "minecraft:unknown" && parent.children().size > 1) parent.child(1, ct)
else parent.child(ct)
}

// force a rearrangement to bring the dock up top~
Expand Down

0 comments on commit bcc678c

Please sign in to comment.