2021-03-01 11:56:30 +01:00
|
|
|
package com.minelittlepony.unicopia.item;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import com.minelittlepony.unicopia.item.toxin.ToxicHolder;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemGroup;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2022-03-26 22:51:34 +01:00
|
|
|
import net.minecraft.item.Items;
|
2021-03-01 11:56:30 +01:00
|
|
|
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
|
|
|
import net.minecraft.util.Identifier;
|
|
|
|
import net.minecraft.util.collection.DefaultedList;
|
|
|
|
import net.minecraft.util.registry.Registry;
|
|
|
|
|
|
|
|
public interface UItemGroups {
|
|
|
|
ItemGroup ALL_ITEMS = FabricItemGroupBuilder.create(new Identifier("unicopia", "items")).appendItems(list -> {
|
2022-03-26 22:51:34 +01:00
|
|
|
list.add(Items.APPLE.getDefaultStack());
|
2021-03-01 11:56:30 +01:00
|
|
|
|
|
|
|
DefaultedList<ItemStack> defs = DefaultedList.of();
|
|
|
|
UItems.ITEMS.stream()
|
|
|
|
.filter(item -> !(item instanceof ChameleonItem) || ((ChameleonItem)item).isFullyDisguised())
|
|
|
|
.forEach(item -> {
|
|
|
|
item.appendStacks(ItemGroup.SEARCH, defs);
|
|
|
|
});
|
|
|
|
list.addAll(defs);
|
|
|
|
}).icon(UItems.EMPTY_JAR::getDefaultStack).build();
|
|
|
|
ItemGroup HORSE_FEED = FabricItemGroupBuilder.create(new Identifier("unicopia", "horsefeed")).appendItems(list -> {
|
|
|
|
list.addAll(Registry.ITEM.stream()
|
|
|
|
.map(Item::getDefaultStack)
|
2022-03-26 22:51:34 +01:00
|
|
|
.filter(item -> item.getItem() instanceof ToxicHolder && ((ToxicHolder)item.getItem()).getToxic(item).isPresent())
|
2021-03-01 11:56:30 +01:00
|
|
|
.collect(Collectors.toList()));
|
|
|
|
}).icon(UItems.ZAP_APPLE::getDefaultStack).build();
|
|
|
|
|
|
|
|
static void bootstrap() {}
|
|
|
|
}
|