aboutsummaryrefslogtreecommitdiff
path: root/default-plugin/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-06-21 00:01:14 +0800
committershedaniel <daniel@shedaniel.me>2023-05-29 21:04:21 +0800
commite86c691c13b95834e89fe072b0a30e00e0da3ea8 (patch)
treeab4a535a579745bf8dcb43aea74b4008ce6361d2 /default-plugin/src/main/java
parent5b984916ba16c3b00e5e149661e35702338e325d (diff)
downloadRoughlyEnoughItems-e86c691c13b95834e89fe072b0a30e00e0da3ea8.tar.gz
RoughlyEnoughItems-e86c691c13b95834e89fe072b0a30e00e0da3ea8.tar.bz2
RoughlyEnoughItems-e86c691c13b95834e89fe072b0a30e00e0da3ea8.zip
Add tag helper methods in EntryIngredients
Diffstat (limited to 'default-plugin/src/main/java')
-rw-r--r--default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java32
1 files changed, 14 insertions, 18 deletions
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
index 8a61e3354..a27966800 100644
--- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
+++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
@@ -43,7 +43,7 @@ import me.shedaniel.rei.api.client.registry.screen.ExclusionZones;
import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry;
import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRegistry;
import me.shedaniel.rei.api.common.entry.EntryIngredient;
-import me.shedaniel.rei.api.common.util.CollectionUtils;
+import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks;
import me.shedaniel.rei.impl.ClientInternals;
@@ -185,27 +185,23 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
registry.addWorkstations(PATHING, EntryStacks.of(item));
}
});
- TagCollection<Item> itemTagCollection = Minecraft.getInstance().getConnection().getTags().getItems();
- Tag<Item> axesTag = itemTagCollection.getTag(new ResourceLocation("c", "axes"));
- if (axesTag != null) {
- for (Item item : axesTag.getValues()) {
- if (axes.add(item)) registry.addWorkstations(STRIPPING, EntryStacks.of(item));
+ for (EntryStack<?> stack : getTag(new ResourceLocation("c", "axes"))) {
+ if (axes.add(stack.<ItemStack>castValue().getItem())) {
+ registry.addWorkstations(STRIPPING, stack);
}
}
- Tag<Item> hoesTag = itemTagCollection.getTag(new ResourceLocation("c", "hoes"));
- if (hoesTag != null) {
- for (Item item : hoesTag.getValues()) {
- if (hoes.add(item)) registry.addWorkstations(TILLING, EntryStacks.of(item));
- }
+ for (EntryStack<?> stack : getTag(new ResourceLocation("c", "hoes"))) {
+ if (hoes.add(stack.<ItemStack>castValue().getItem())) registry.addWorkstations(TILLING, stack);
}
- Tag<Item> shovelsTag = itemTagCollection.getTag(new ResourceLocation("c", "shovels"));
- if (shovelsTag != null) {
- for (Item item : shovelsTag.getValues()) {
- if (shovels.add(item)) registry.addWorkstations(PATHING, EntryStacks.of(item));
- }
+ for (EntryStack<?> stack : getTag(new ResourceLocation("c", "shovels"))) {
+ if (shovels.add(stack.<ItemStack>castValue().getItem())) registry.addWorkstations(PATHING, stack);
}
}
+ private static EntryIngredient getTag(ResourceLocation tagId) {
+ return EntryIngredients.ofItemTag(TagKey.create(Registry.ITEM_REGISTRY, tagId));
+ }
+
@Override
public void registerDisplays(DisplayRegistry registry) {
registry.registerRecipeFiller(CraftingRecipe.class, RecipeType.CRAFTING, DefaultCraftingDisplay::of);
@@ -254,8 +250,8 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin
DummyShovelItem.getPathBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
registry.add(new DefaultPathingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue().getBlock())));
});
- registry.add(new DefaultBeaconBaseDisplay(CollectionUtils.map(Lists.newArrayList(BlockTags.BEACON_BASE_BLOCKS.getValues()), ItemStack::new)));
- registry.add(new DefaultBeaconPaymentDisplay(CollectionUtils.map(Lists.newArrayList(ItemTags.BEACON_PAYMENT_ITEMS.getValues()), ItemStack::new)));
+ registry.add(new DefaultBeaconBaseDisplay(Collections.singletonList(EntryIngredients.ofItemTag(BlockTags.BEACON_BASE_BLOCKS)), Collections.emptyList()));
+ registry.add(new DefaultBeaconPaymentDisplay(Collections.singletonList(EntryIngredients.ofItemTag(ItemTags.BEACON_PAYMENT_ITEMS)), Collections.emptyList()));
if (Platform.isFabric()) {
Set<Potion> potions = Sets.newLinkedHashSet();
for (Ingredient container : PotionBrewing.ALLOWED_CONTAINERS) {