Skip to content

Commit

Permalink
Fix entity-types bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bibi-reden committed Aug 9, 2024
1 parent 5d4d6d7 commit eb951c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
12 changes: 1 addition & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
## Additions 🍎
- Implemented a feature that reads data-packs and applies attribute modifications to the world based on order.
- More documentation on this feature will come as the mod stabilizes.
- For now, if you want to be aware of how to format your data-pack(s), look towards the source code of the next builds of PlayerEX/WizardEX.

## Changes 🌽
- Changed how configs and modded entries are applied.
- Your config will appear sparse on startup, but when you go to a world (in an integrated server), it will show the extra modifications provided by loaded packs and mods.
- You can overwrite these, and they will appear in your actual config. Your config will **overwrite** any data-pack or modded pack.
- The UI will be overhauled to better assist in knowing what is supplied by datapacks/mods, but that will be in the later future.
- Deprecated the `DefaultAttributeRegistry` to keep previous versions functional, but it will be removed before release.
- Being able to override specific mods and being able to customize your data-packs will come in the future. For now, if you want to override something, use your config as it is the main source of truth.
- Resolved an issue with entity-types not applying properly if a mod/data-pack got to the entity-type id first.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ loom_version=1.7-SNAPSHOT
minecraft_version=1.20.1
fabric_kotlin_version=1.12.0+kotlin.2.0.10
fabric_api_version=0.92.2+1.20.1
mod_version=2.0.0+1.20.1-beta.10
mod_version=2.0.0+1.20.1-beta.11
loader=fabric

# Mappings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import kotlinx.serialization.UseSerializers
import com.bibireden.data_attributes.DataAttributes
import com.bibireden.data_attributes.config.functions.AttributeFunction
import com.bibireden.data_attributes.config.models.OverridesConfigModel.AttributeOverride
import com.bibireden.data_attributes.data.EntityTypeData
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
Expand Down Expand Up @@ -116,7 +115,16 @@ class DefaultAttributesReloadListener : SimpleResourceReloadListener<DefaultAttr
manager.findResources(path, ::isPathJson).forEach { (id, res) ->
try {
Json.decodeFromStream<EntityTypes>(res.inputStream).entries.forEach { (id, entry) ->
cache.types.entries.computeIfAbsent(id) { entry }
val presentEntry = cache.types.entries[id]
if (presentEntry == null) {
cache.types.entries[id] = entry
}
else {
for ((secondaryId, secondaryValue) in entry) {
presentEntry.computeIfAbsent(secondaryId) { secondaryValue }
}
cache.types.entries[id] = presentEntry
}
}
}
catch (why: Exception) {
Expand Down

0 comments on commit eb951c6

Please sign in to comment.