Search in sources :

Example 1 with GearShieldItem

use of net.silentchaos512.gear.item.gear.GearShieldItem in project Silent-Gear by SilentChaos512.

the class ColorHandlers method onItemColors.

public static void onItemColors(ColorHandlerEvent.Item event) {
    ItemColors itemColors = event.getItemColors();
    if (itemColors == null) {
        SilentGear.LOGGER.error("ItemColors is null?", new IllegalStateException("wat?"));
        return;
    }
    // Tools, armor, shields, etc.
    ForgeRegistries.ITEMS.getValues().stream().filter(item -> item instanceof GearArmorItem || item instanceof GearShieldItem).map(item -> (ICoreItem) item).forEach(item -> itemColors.register(item.getItemColors(), item));
    Registration.getItems(item -> item instanceof IColoredMaterialItem).forEach(item -> {
        IColoredMaterialItem coloredMaterialItem = (IColoredMaterialItem) item;
        itemColors.register(coloredMaterialItem::getColor, item);
    });
}
Also used : SilentGear(net.silentchaos512.gear.SilentGear) GearData(net.silentchaos512.gear.util.GearData) IColoredMaterialItem(net.silentchaos512.gear.item.IColoredMaterialItem) ItemRegistryObject(net.silentchaos512.lib.registry.ItemRegistryObject) Item(net.minecraft.world.item.Item) GearShieldItem(net.silentchaos512.gear.item.gear.GearShieldItem) HashMap(java.util.HashMap) GearArmorItem(net.silentchaos512.gear.item.gear.GearArmorItem) ItemColors(net.minecraft.client.color.item.ItemColors) PartType(net.silentchaos512.gear.api.part.PartType) Registration(net.silentchaos512.gear.init.Registration) ICoreItem(net.silentchaos512.gear.api.item.ICoreItem) Color(net.silentchaos512.utils.Color) Map(java.util.Map) ItemStack(net.minecraft.world.item.ItemStack) ColorHandlerEvent(net.minecraftforge.client.event.ColorHandlerEvent) ItemColor(net.minecraft.client.color.item.ItemColor) ForgeRegistries(net.minecraftforge.registries.ForgeRegistries) GearShieldItem(net.silentchaos512.gear.item.gear.GearShieldItem) ItemColors(net.minecraft.client.color.item.ItemColors) GearArmorItem(net.silentchaos512.gear.item.gear.GearArmorItem) ICoreItem(net.silentchaos512.gear.api.item.ICoreItem) IColoredMaterialItem(net.silentchaos512.gear.item.IColoredMaterialItem)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 ItemColor (net.minecraft.client.color.item.ItemColor)1 ItemColors (net.minecraft.client.color.item.ItemColors)1 Item (net.minecraft.world.item.Item)1 ItemStack (net.minecraft.world.item.ItemStack)1 ColorHandlerEvent (net.minecraftforge.client.event.ColorHandlerEvent)1 ForgeRegistries (net.minecraftforge.registries.ForgeRegistries)1 SilentGear (net.silentchaos512.gear.SilentGear)1 ICoreItem (net.silentchaos512.gear.api.item.ICoreItem)1 PartType (net.silentchaos512.gear.api.part.PartType)1 Registration (net.silentchaos512.gear.init.Registration)1 IColoredMaterialItem (net.silentchaos512.gear.item.IColoredMaterialItem)1 GearArmorItem (net.silentchaos512.gear.item.gear.GearArmorItem)1 GearShieldItem (net.silentchaos512.gear.item.gear.GearShieldItem)1 GearData (net.silentchaos512.gear.util.GearData)1 ItemRegistryObject (net.silentchaos512.lib.registry.ItemRegistryObject)1 Color (net.silentchaos512.utils.Color)1