Search in sources :

Example 1 with DryingRecipe

use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.

the class CTDrying method removeRecipe.

@ZenMethod
public static void removeRecipe(IItemStack output) {
    if (output == null)
        throw new IllegalArgumentException("Output not allowed to be empty");
    ArrayList<DryingRecipe> removeList = new ArrayList<>();
    RegistriesFL.DRYING.getValuesCollection().stream().filter(x -> x.getOutputItem(ItemStack.EMPTY).isItemEqual(InputHelper.toStack(output))).forEach(removeList::add);
    for (DryingRecipe recipe : removeList) {
        CraftTweakerAPI.apply(new IAction() {

            @Override
            public void apply() {
                IForgeRegistryModifiable<DryingRecipe> DRYING = (IForgeRegistryModifiable<DryingRecipe>) RegistriesFL.DRYING;
                DRYING.remove(recipe.getRegistryName());
            }

            @Override
            public String describe() {
                return "Removing Drying recipe for output " + output.getDisplayName();
            }
        });
    }
}
Also used : DryingRecipe(com.eerussianguy.firmalife.recipe.DryingRecipe) CTHelper(net.dries007.tfc.compat.crafttweaker.CTHelper) IAction(crafttweaker.IAction) ZenClass(stanhebben.zenscript.annotations.ZenClass) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) CraftTweakerAPI(crafttweaker.CraftTweakerAPI) IIngredient(crafttweaker.api.item.IIngredient) IItemStack(crafttweaker.api.item.IItemStack) ResourceLocation(net.minecraft.util.ResourceLocation) ZenMethod(stanhebben.zenscript.annotations.ZenMethod) IForgeRegistryModifiable(net.minecraftforge.registries.IForgeRegistryModifiable) InputHelper(com.blamejared.mtlib.helpers.InputHelper) RegistriesFL(com.eerussianguy.firmalife.init.RegistriesFL) ZenRegister(crafttweaker.annotations.ZenRegister) IForgeRegistryModifiable(net.minecraftforge.registries.IForgeRegistryModifiable) IAction(crafttweaker.IAction) DryingRecipe(com.eerussianguy.firmalife.recipe.DryingRecipe) ArrayList(java.util.ArrayList) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 2 with DryingRecipe

use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.

the class TELeafMat method dry.

private void dry() {
    ItemStack input = inventory.getStackInSlot(0);
    if (!input.isEmpty()) {
        DryingRecipe recipe = DryingRecipe.get(input);
        if (recipe != null && !world.isRemote) {
            inventory.setStackInSlot(0, HelpersFL.updateFoodFuzzed(input, recipe.getOutputItem(input)));
            setAndUpdateSlots(0);
            markForSync();
        }
    }
    markDirty();
}
Also used : DryingRecipe(com.eerussianguy.firmalife.recipe.DryingRecipe) ItemStack(net.minecraft.item.ItemStack)

Example 3 with DryingRecipe

use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.

the class TELeafMat method setDuration.

private void setDuration() {
    ItemStack input = inventory.getStackInSlot(0);
    int recipeTime = 0;
    if (!input.isEmpty() && !world.isRemote) {
        DryingRecipe recipe = DryingRecipe.get(input);
        if (recipe != null) {
            recipeTime = DryingRecipe.getDuration(recipe);
        }
    }
    tickGoal = recipeTime;
}
Also used : DryingRecipe(com.eerussianguy.firmalife.recipe.DryingRecipe) ItemStack(net.minecraft.item.ItemStack)

Example 4 with DryingRecipe

use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.

the class LeafMatProvider method getTooltip.

@Nonnull
@Override
public List<String> getTooltip(World world, @Nonnull BlockPos pos, @Nonnull NBTTagCompound nbt) {
    List<String> currentTooltip = new ArrayList<>();
    TileEntity te = world.getTileEntity(pos);
    if (te instanceof TELeafMat) {
        TELeafMat leafMat = (TELeafMat) te;
        ItemStack mainSlot = leafMat.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).getStackInSlot(0);
        DryingRecipe recipe = DryingRecipe.get(mainSlot);
        if (!mainSlot.isEmpty() && recipe != null) {
            long remainingTicks = leafMat.getTicksRemaining();
            switch(ConfigTFC.Client.TOOLTIP.timeTooltipMode) {
                case NONE:
                    break;
                case TICKS:
                    currentTooltip.add(new TextComponentTranslation("waila.tfc.devices.ticks_remaining", remainingTicks).getFormattedText());
                case MINECRAFT_HOURS:
                    long remainingHours = Math.round(remainingTicks / (float) ICalendar.TICKS_IN_HOUR);
                    currentTooltip.add(new TextComponentTranslation("waila.tfc.devices.hours_remaining", remainingHours).getFormattedText());
                    break;
                case REAL_MINUTES:
                    long remainingMinutes = Math.round(remainingTicks / 1200.0f);
                    currentTooltip.add(new TextComponentTranslation("waila.tfc.devices.minutes_remaining", remainingMinutes).getFormattedText());
                    break;
            }
            currentTooltip.add(new TextComponentTranslation(recipe.getOutputItem(mainSlot).getTranslationKey() + ".name").getFormattedText());
        }
    }
    return currentTooltip;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ArrayList(java.util.ArrayList) DryingRecipe(com.eerussianguy.firmalife.recipe.DryingRecipe) ItemStack(net.minecraft.item.ItemStack) TELeafMat(com.eerussianguy.firmalife.te.TELeafMat) Nonnull(javax.annotation.Nonnull)

Example 5 with DryingRecipe

use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.

the class CTDrying method addRecipe.

@ZenMethod
public static void addRecipe(String recipe_name, IIngredient input, IItemStack output, int duration) {
    DryingRecipe recipe = new DryingRecipe(CTHelper.getInternalIngredient(input), InputHelper.toStack(output), duration).setRegistryName(recipe_name);
    CraftTweakerAPI.apply(new IAction() {

        @Override
        public void apply() {
            RegistriesFL.DRYING.register(recipe);
        }

        @Override
        public String describe() {
            return "Adding Drying recipe " + recipe.getRegistryName().toString();
        }
    });
}
Also used : IAction(crafttweaker.IAction) DryingRecipe(com.eerussianguy.firmalife.recipe.DryingRecipe) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Aggregations

DryingRecipe (com.eerussianguy.firmalife.recipe.DryingRecipe)6 ItemStack (net.minecraft.item.ItemStack)5 IAction (crafttweaker.IAction)2 ArrayList (java.util.ArrayList)2 ZenMethod (stanhebben.zenscript.annotations.ZenMethod)2 InputHelper (com.blamejared.mtlib.helpers.InputHelper)1 RegistriesFL (com.eerussianguy.firmalife.init.RegistriesFL)1 TELeafMat (com.eerussianguy.firmalife.te.TELeafMat)1 CraftTweakerAPI (crafttweaker.CraftTweakerAPI)1 ZenRegister (crafttweaker.annotations.ZenRegister)1 IIngredient (crafttweaker.api.item.IIngredient)1 IItemStack (crafttweaker.api.item.IItemStack)1 Nonnull (javax.annotation.Nonnull)1 CTHelper (net.dries007.tfc.compat.crafttweaker.CTHelper)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 IForgeRegistryModifiable (net.minecraftforge.registries.IForgeRegistryModifiable)1 ZenClass (stanhebben.zenscript.annotations.ZenClass)1