-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #7946
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/generated/resources/data/ae2/tags/data_component_type/exported_settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"values": [ | ||
"ae2:exported_config_inv", | ||
"ae2:exported_custom_name", | ||
"ae2:exported_level_emitter_value", | ||
"ae2:exported_p2p_frequency", | ||
"ae2:exported_p2p_type", | ||
"ae2:exported_patterns", | ||
"ae2:exported_priority", | ||
"ae2:exported_push_direction", | ||
"ae2:exported_settings", | ||
"ae2:exported_settings_source", | ||
"ae2:exported_upgrades" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/appeng/datagen/providers/tags/DataComponentTypeTagProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package appeng.datagen.providers.tags; | ||
|
||
import java.util.IdentityHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.core.component.DataComponentType; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.data.PackOutput; | ||
import net.minecraft.data.tags.TagsProvider; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.neoforged.neoforge.common.data.ExistingFileHelper; | ||
|
||
import appeng.api.ids.AEComponents; | ||
import appeng.core.AppEng; | ||
|
||
public class DataComponentTypeTagProvider extends TagsProvider<DataComponentType<?>> { | ||
public DataComponentTypeTagProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, | ||
@Nullable ExistingFileHelper existingFileHelper) { | ||
super(output, Registries.DATA_COMPONENT_TYPE, registries, AppEng.MOD_ID, existingFileHelper); | ||
} | ||
|
||
@Override | ||
protected void addTags(HolderLookup.Provider registries) { | ||
|
||
Map<DataComponentType<?>, ResourceKey<DataComponentType<?>>> componentKeys = new IdentityHashMap<>(); | ||
for (var entry : AEComponents.DR.getEntries()) { | ||
componentKeys.put(entry.get(), entry.getKey()); | ||
} | ||
|
||
var exportedComponents = List.of( | ||
AEComponents.EXPORTED_CONFIG_INV, | ||
AEComponents.EXPORTED_CUSTOM_NAME, | ||
AEComponents.EXPORTED_LEVEL_EMITTER_VALUE, | ||
AEComponents.EXPORTED_P2P_FREQUENCY, | ||
AEComponents.EXPORTED_P2P_TYPE, | ||
AEComponents.EXPORTED_PATTERNS, | ||
AEComponents.EXPORTED_PRIORITY, | ||
AEComponents.EXPORTED_PUSH_DIRECTION, | ||
AEComponents.EXPORTED_SETTINGS, | ||
AEComponents.EXPORTED_SETTINGS_SOURCE, | ||
AEComponents.EXPORTED_UPGRADES); | ||
for (var exportedComponent : exportedComponents) { | ||
var key = Objects.requireNonNull(componentKeys.get(exportedComponent)); | ||
tag(ConventionTags.EXPORTED_SETTINGS).add(key); | ||
} | ||
} | ||
} |