Unicopia/src/main/java/com/minelittlepony/unicopia/item/UItemGroups.java

35 lines
1.5 KiB
Java
Raw Normal View History

package com.minelittlepony.unicopia.item;
import java.util.stream.Collectors;
import com.minelittlepony.unicopia.Unicopia;
2022-09-30 12:43:07 +02:00
import com.minelittlepony.unicopia.item.toxin.Toxic;
import com.minelittlepony.unicopia.item.toxin.ToxicHolder;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.registry.Registry;
public interface UItemGroups {
ItemGroup ALL_ITEMS = FabricItemGroupBuilder.create(Unicopia.id("items")).appendItems(list -> {
list.add(Items.APPLE.getDefaultStack());
DefaultedList<ItemStack> defs = DefaultedList.of();
UItems.ITEMS.stream()
.filter(item -> !(item instanceof ChameleonItem) || ((ChameleonItem)item).isFullyDisguised())
2022-09-30 12:43:07 +02:00
.forEach(item -> item.appendStacks(ItemGroup.SEARCH, defs));
list.addAll(defs);
}).icon(UItems.EMPTY_JAR::getDefaultStack).build();
ItemGroup HORSE_FEED = FabricItemGroupBuilder.create(Unicopia.id("horsefeed")).appendItems(list -> {
list.addAll(Registry.ITEM.stream()
.map(Item::getDefaultStack)
2022-09-30 12:43:07 +02:00
.filter(item -> ((ToxicHolder)item.getItem()).getToxic(item) != Toxic.EMPTY)
.collect(Collectors.toList()));
}).icon(UItems.ZAP_APPLE::getDefaultStack).build();
static void bootstrap() {}
}