Search in sources :

Example 1 with ItemGeneratedLiqueur

use of cc.lasmgratel.foodcraftreloaded.minecraft.common.item.food.ItemGeneratedLiqueur in project FoodCraft-Reloaded by LasmGratel.

the class RegisterLoader method detectAndRegisterLiqueur.

public void detectAndRegisterLiqueur(RegistryEvent.Register<Item> event) {
    event.getRegistry().getKeys().stream().filter(s -> s.getResourcePath().contains("liqueur")).map(ForgeRegistries.ITEMS::getValue).collect(Collectors.toList()).forEach(liqueur -> {
        for (LiqueurType liqueurType : LiqueurTypes.values()) {
            if (liqueurType == LiqueurTypes.NORMAL)
                continue;
            ItemGeneratedLiqueur typedLiqueur = new ItemGeneratedLiqueur(MathHelper.floor(liqueurType.getHealModifier() * ((ItemFood) liqueur).getHealAmount(new ItemStack(liqueur))));
            typedLiqueur.setLiqueurType(liqueurType);
            typedLiqueur.setItemStackDisplayNameCallback(liqueur::getItemStackDisplayName);
            typedLiqueur.setRegistryName(liqueur.getRegistryName().getResourceDomain(), liqueurType.getUnlocalizedName() + "_" + liqueur.getRegistryName().getResourcePath());
            typedLiqueur.setUnlocalizedName(liqueur.getUnlocalizedName());
            event.getRegistry().register(typedLiqueur);
            OreDictionary.registerOre("listAll" + StringUtils.capitalize(liqueurType.getUnlocalizedName()) + "liqueur", typedLiqueur);
            OreDictionary.registerOre("listAllliqueur", typedLiqueur);
            OreDictionary.registerOre("listAllfoods", typedLiqueur);
            if (liqueur instanceof CustomModelMasking)
                FoodCraftReloadedMod.getLoader(LiqueurLoader.class).get().getLiqueurCustomModelMap().put(typedLiqueur, (CustomModelMasking) liqueur);
        }
    });
}
Also used : ItemGeneratedLiqueur(cc.lasmgratel.foodcraftreloaded.minecraft.common.item.food.ItemGeneratedLiqueur) Item(net.minecraft.item.Item) LiqueurTypes(cc.lasmgratel.foodcraftreloaded.minecraft.api.capability.liqueur.LiqueurTypes) ModelRegistryEvent(net.minecraftforge.client.event.ModelRegistryEvent) ItemFood(net.minecraft.item.ItemFood) FoodCraftReloadedMod(cc.lasmgratel.foodcraftreloaded.minecraft.common.FoodCraftReloadedMod) StringUtils(org.apache.commons.lang3.StringUtils) Collectors(java.util.stream.Collectors) LiqueurType(cc.lasmgratel.foodcraftreloaded.minecraft.api.capability.liqueur.LiqueurType) ItemStack(net.minecraft.item.ItemStack) MinecraftForge(net.minecraftforge.common.MinecraftForge) Load(cc.lasmgratel.foodcraftreloaded.minecraft.common.util.loader.annotation.Load) LoaderState(net.minecraftforge.fml.common.LoaderState) Side(net.minecraftforge.fml.relauncher.Side) OreDictionary(net.minecraftforge.oredict.OreDictionary) CustomModelMasking(cc.lasmgratel.foodcraftreloaded.minecraft.client.util.masking.CustomModelMasking) MathHelper(net.minecraft.util.math.MathHelper) ForgeRegistries(net.minecraftforge.fml.common.registry.ForgeRegistries) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) RegistryEvent(net.minecraftforge.event.RegistryEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) LiqueurLoader(cc.lasmgratel.foodcraftreloaded.minecraft.common.loader.LiqueurLoader) ItemGeneratedLiqueur(cc.lasmgratel.foodcraftreloaded.minecraft.common.item.food.ItemGeneratedLiqueur) CustomModelMasking(cc.lasmgratel.foodcraftreloaded.minecraft.client.util.masking.CustomModelMasking) LiqueurType(cc.lasmgratel.foodcraftreloaded.minecraft.api.capability.liqueur.LiqueurType) ItemStack(net.minecraft.item.ItemStack)

Aggregations

LiqueurType (cc.lasmgratel.foodcraftreloaded.minecraft.api.capability.liqueur.LiqueurType)1 LiqueurTypes (cc.lasmgratel.foodcraftreloaded.minecraft.api.capability.liqueur.LiqueurTypes)1 CustomModelMasking (cc.lasmgratel.foodcraftreloaded.minecraft.client.util.masking.CustomModelMasking)1 FoodCraftReloadedMod (cc.lasmgratel.foodcraftreloaded.minecraft.common.FoodCraftReloadedMod)1 ItemGeneratedLiqueur (cc.lasmgratel.foodcraftreloaded.minecraft.common.item.food.ItemGeneratedLiqueur)1 LiqueurLoader (cc.lasmgratel.foodcraftreloaded.minecraft.common.loader.LiqueurLoader)1 Load (cc.lasmgratel.foodcraftreloaded.minecraft.common.util.loader.annotation.Load)1 Collectors (java.util.stream.Collectors)1 Item (net.minecraft.item.Item)1 ItemFood (net.minecraft.item.ItemFood)1 ItemStack (net.minecraft.item.ItemStack)1 MathHelper (net.minecraft.util.math.MathHelper)1 ModelRegistryEvent (net.minecraftforge.client.event.ModelRegistryEvent)1 MinecraftForge (net.minecraftforge.common.MinecraftForge)1 RegistryEvent (net.minecraftforge.event.RegistryEvent)1 LoaderState (net.minecraftforge.fml.common.LoaderState)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 ForgeRegistries (net.minecraftforge.fml.common.registry.ForgeRegistries)1 Side (net.minecraftforge.fml.relauncher.Side)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1