feature/d01-component-system #5

Merged
NotEvil merged 20 commits from feature/d01-component-system into develop 2026-04-14 00:54:17 +00:00
2 changed files with 12 additions and 9 deletions
Showing only changes of commit bfcc20d242 - Show all commits

View File

@@ -105,8 +105,13 @@ public record DataDrivenItemDefinition(
Map<ComponentType, JsonObject> componentConfigs
) {
/** Compact constructor: default null componentConfigs to empty immutable map. */
public DataDrivenItemDefinition {
if (componentConfigs == null) componentConfigs = Map.of();
}
/** Check whether this definition declares a given component type. */
public boolean hasComponent(ComponentType type) {
return componentConfigs != null && componentConfigs.containsKey(type);
return componentConfigs.containsKey(type);
}
}

View File

@@ -185,7 +185,6 @@ public final class DataDrivenItemRegistry {
DataDrivenItemDefinition def = entry.getValue();
Map<ComponentType, IItemComponent> components =
new EnumMap<>(ComponentType.class);
if (def.componentConfigs() != null) {
for (Map.Entry<ComponentType, JsonObject> compEntry :
def.componentConfigs().entrySet()) {
components.put(
@@ -193,7 +192,6 @@ public final class DataDrivenItemRegistry {
compEntry.getKey().create(compEntry.getValue())
);
}
}
holders.put(
entry.getKey(),
components.isEmpty()