Search in sources :

Example 1 with AlchemyCircleRenderer

use of WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer in project BloodMagic by WayofTime.

the class RenderAlchemyArray method render.

@Override
public void render(TileAlchemyArray alchemyArray, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    ItemStack inputStack = alchemyArray.getStackInSlot(0);
    ItemStack catalystStack = alchemyArray.getStackInSlot(1);
    int craftTime = alchemyArray.activeCounter;
    AlchemyCircleRenderer renderer = AlchemyArrayRecipeRegistry.getAlchemyCircleRenderer(inputStack, catalystStack);
    if (renderer == AlchemyArrayRecipeRegistry.DEFAULT_RENDERER) {
        RecipeAlchemyArray recipe = BloodMagicAPI.INSTANCE.getRecipeRegistrar().getAlchemyArray(inputStack, catalystStack);
        if (recipe != null)
            renderer = new AlchemyCircleRenderer(recipe.getCircleTexture());
    }
    renderer.renderAt(alchemyArray, x, y, z, (craftTime > 0 ? craftTime + partialTicks : 0));
}
Also used : AlchemyCircleRenderer(WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer) RecipeAlchemyArray(WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray) ItemStack(net.minecraft.item.ItemStack)

Example 2 with AlchemyCircleRenderer

use of WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer in project BloodMagic by WayofTime.

the class AlchemyArrayRecipeRegistry method registerRecipe.

public static void registerRecipe(ItemStack inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource) {
    AlchemyCircleRenderer circleRenderer = arrayResource == null ? DEFAULT_RENDERER : new AlchemyCircleRenderer(arrayResource);
    registerRecipe(Collections.singletonList(inputStacks), catalystStack, arrayEffect, circleRenderer);
}
Also used : AlchemyCircleRenderer(WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer)

Example 3 with AlchemyCircleRenderer

use of WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer in project BloodMagic by WayofTime.

the class BookUtils method getAlchemyPage.

public static PageAlchemyArray getAlchemyPage(String key) {
    ItemStack[] recipe = AlchemyArrayRecipeRegistry.getRecipeForArrayEffect(key);
    if (recipe[0] != null) {
        ItemStack inputStack = recipe[0];
        ItemStack catalystStack = recipe[1];
        AlchemyCircleRenderer renderer = AlchemyArrayRecipeRegistry.getAlchemyCircleRenderer(inputStack, catalystStack);
        if (renderer instanceof DualAlchemyCircleRenderer) {
            List<ResourceLocation> resources = new ArrayList<>();
            resources.add(((DualAlchemyCircleRenderer) renderer).arrayResource);
            resources.add(((DualAlchemyCircleRenderer) renderer).secondaryArrayResource);
            return new PageAlchemyArray(resources, inputStack, catalystStack);
        } else {
            return new PageAlchemyArray(renderer.arrayResource, inputStack, catalystStack);
        }
    }
    return null;
}
Also used : DualAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer) AlchemyCircleRenderer(WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer) PageAlchemyArray(WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray) ResourceLocation(net.minecraft.util.ResourceLocation) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) DualAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer)

Example 4 with AlchemyCircleRenderer

use of WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer in project BloodMagic by WayofTime.

the class BookUtils method getAlchemyPage.

public static PageAlchemyArray getAlchemyPage(ItemStack outputStack) {
    ItemStack[] recipe = AlchemyArrayRecipeRegistry.getRecipeForOutputStack(outputStack);
    if (recipe[0] != null) {
        ItemStack inputStack = recipe[0];
        ItemStack catalystStack = recipe[1];
        AlchemyCircleRenderer renderer = AlchemyArrayRecipeRegistry.getAlchemyCircleRenderer(inputStack, catalystStack);
        if (renderer != null) {
            if (renderer instanceof DualAlchemyCircleRenderer) {
                List<ResourceLocation> resources = new ArrayList<>();
                resources.add(((DualAlchemyCircleRenderer) renderer).arrayResource);
                resources.add(((DualAlchemyCircleRenderer) renderer).secondaryArrayResource);
                return new PageAlchemyArray(resources, inputStack, catalystStack, outputStack);
            } else {
                return new PageAlchemyArray(renderer.arrayResource, inputStack, catalystStack, outputStack);
            }
        }
    }
    return null;
}
Also used : DualAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer) AlchemyCircleRenderer(WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer) PageAlchemyArray(WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray) ResourceLocation(net.minecraft.util.ResourceLocation) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) DualAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer)

Example 5 with AlchemyCircleRenderer

use of WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer in project BloodMagic by WayofTime.

the class AlchemyArrayRecipeRegistry method registerRecipe.

public static void registerRecipe(List<ItemStack> inputStacks, ItemStack catalystStack, AlchemyArrayEffect arrayEffect, ResourceLocation arrayResource) {
    AlchemyCircleRenderer circleRenderer = arrayResource == null ? DEFAULT_RENDERER : new AlchemyCircleRenderer(arrayResource);
    registerRecipe(inputStacks, catalystStack, arrayEffect, circleRenderer);
}
Also used : AlchemyCircleRenderer(WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer)

Aggregations

AlchemyCircleRenderer (WayofTime.bloodmagic.alchemyArray.AlchemyCircleRenderer)6 ItemStack (net.minecraft.item.ItemStack)3 DualAlchemyCircleRenderer (WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer)2 PageAlchemyArray (WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray)2 ArrayList (java.util.ArrayList)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 RecipeAlchemyArray (WayofTime.bloodmagic.api.impl.recipe.RecipeAlchemyArray)1