Skip to content

Commit

Permalink
Add a tag that contains all mekanism units (mekanism/Mekanism-Feature…
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster committed Aug 20, 2024
1 parent 780413a commit a02920d
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 5 deletions.
19 changes: 19 additions & 0 deletions src/api/java/mekanism/api/MekanismAPITags.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.world.damagesource.DamageType;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;

/**
* Provides access to pre-existing tag keys for various functionality that we use tags for.
Expand Down Expand Up @@ -91,6 +92,24 @@ private static TagKey<Chemical> tag(String name) {
}
}

/**
* @since 10.7.0
*/
public static class Items {

private Items() {
}

/**
* Contains all mekanism modules.
*/
public static final TagKey<Item> MEKA_UNITS = tag("unit");

private static TagKey<Item> tag(String name) {
return TagKey.create(Registries.ITEM, rl(name));
}
}

public static class MobEffects {

private MobEffects() {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions src/datagen/generated/mekanism/data/mekanism/tags/item/unit.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import mekanism.api.MekanismAPITags;
import mekanism.common.content.gear.IModuleItem;
import mekanism.common.tag.BaseTagProvider;
import mekanism.generators.common.registries.GeneratorsBlocks;
import mekanism.generators.common.registries.GeneratorsChemicals;
import mekanism.generators.common.registries.GeneratorsFluids;
import mekanism.generators.common.registries.GeneratorsItems;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
Expand Down Expand Up @@ -60,6 +63,8 @@ protected void registerTags(HolderLookup.Provider registries) {

addToTag(FRAMEABLE, GeneratorsBlocks.REACTOR_GLASS, GeneratorsBlocks.LASER_FOCUS_MATRIX);
addToTag(FB_BE_WHITELIST, GeneratorsBlocks.REACTOR_GLASS, GeneratorsBlocks.LASER_FOCUS_MATRIX);

getItemBuilder(MekanismAPITags.Items.MEKA_UNITS).add(GeneratorsItems.ITEMS.getEntries().stream().filter(item -> item.get() instanceof IModuleItem).toList());
}

private void addBoxBlacklist() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ protected void addTranslations() {
}

private void addTags() {
addTag(MekanismAPITags.Items.MEKA_UNITS, "Meka Units");
addTag(MekanismTags.Items.CONFIGURATORS, "Configurators");
addTag(MekanismTags.Items.TOOLS_WRENCH, "Wrenches");
addTag(MekanismTags.Items.PERSONAL_STORAGE, "Personal Storage");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import mekanism.api.chemical.Chemical;
import mekanism.api.providers.IItemProvider;
import mekanism.common.Mekanism;
import mekanism.common.content.gear.IModuleItem;
import mekanism.common.registration.impl.BlockRegistryObject;
import mekanism.common.registration.impl.ItemRegistryObject;
import mekanism.common.registration.impl.SlurryRegistryObject;
Expand Down Expand Up @@ -165,6 +166,8 @@ protected void registerTags(HolderLookup.Provider registries) {

addToTag(FRAMEABLE, MekanismBlocks.STRUCTURAL_GLASS);
addToTag(FB_BE_WHITELIST, MekanismBlocks.STRUCTURAL_GLASS);

getItemBuilder(MekanismAPITags.Items.MEKA_UNITS).add(MekanismItems.ITEMS.getEntries().stream().filter(item -> item.get() instanceof IModuleItem).toList());
}

private void addEntities() {
Expand Down

0 comments on commit a02920d

Please sign in to comment.