Search in sources :

Example 1 with NetRecipe

use of betterwithaddons.crafting.recipes.NetRecipe in project BetterWithAddons by DaedalusGame.

the class FireNet method add.

@ZenMethod
public static void add(IItemStack[] outputs, @NotNull IIngredient input) {
    NetRecipe r = new NetRecipe(BlockNettedScreen.SifterType.FIRE, new IngredientCraftTweaker(input), 0, CraftTweakerMC.getItemStacks(outputs));
    CraftTweaker.LATE_ACTIONS.add(new Add(r));
}
Also used : NetRecipe(betterwithaddons.crafting.recipes.NetRecipe) IngredientCraftTweaker(betterwithaddons.util.IngredientCraftTweaker) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 2 with NetRecipe

use of betterwithaddons.crafting.recipes.NetRecipe in project BetterWithAddons by DaedalusGame.

the class WaterNet method add.

@ZenMethod
public static void add(IItemStack[] outputs, @NotNull IIngredient input) {
    NetRecipe r = new NetRecipe(BlockNettedScreen.SifterType.WATER, new IngredientCraftTweaker(input), 0, CraftTweakerMC.getItemStacks(outputs));
    CraftTweaker.LATE_ACTIONS.add(new Add(r));
}
Also used : NetRecipe(betterwithaddons.crafting.recipes.NetRecipe) IngredientCraftTweaker(betterwithaddons.util.IngredientCraftTweaker) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 3 with NetRecipe

use of betterwithaddons.crafting.recipes.NetRecipe in project BetterWithAddons by DaedalusGame.

the class TileEntityNettedScreen method captureDroppedItems.

private boolean captureDroppedItems() {
    List<EntityItem> items = this.getCaptureItems(world, pos);
    if (items.size() > 0) {
        for (EntityItem item : items) {
            ItemStack stack = item.getItem();
            if (stack.getItem() == Item.getItemFromBlock(Blocks.SAND))
                handleSandCase(item);
        }
        CraftingManagerNet manager = getCraftingManager(getSifterType());
        if (manager != null) {
            NetRecipe recipe = manager.getMostValidRecipe(items, getSandCount());
            if (recipe != null) {
                List<ItemStack> ret = recipe.getOutput();
                if (ret != null && ret.size() > 0) {
                    ItemUtil.consumeItem(items, recipe.input);
                    world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
                    for (int i = 0; i < ret.size(); i++) {
                        ItemStack item = ret.get(i);
                        if (item.isEmpty())
                            continue;
                        EntityItem result = new EntityItem(world, pos.getX() + 0.5f, pos.getY() + (i % 2 == 0 ? 1.2f : -0.5f), pos.getZ() + 0.5f, item.copy());
                        result.setDefaultPickupDelay();
                        if (!world.isRemote) {
                            world.spawnEntity(result);
                        }
                    }
                    if (recipe.getSandRequired() > 0)
                        increaseSandCount(-recipe.getSandRequired());
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : NetRecipe(betterwithaddons.crafting.recipes.NetRecipe) CraftingManagerNet(betterwithaddons.crafting.manager.CraftingManagerNet) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem)

Example 4 with NetRecipe

use of betterwithaddons.crafting.recipes.NetRecipe in project BetterWithAddons by DaedalusGame.

the class SandNet method add.

@ZenMethod
public static void add(IItemStack[] outputs, @NotNull IIngredient input, int sand) {
    NetRecipe r = new NetRecipe(BlockNettedScreen.SifterType.SAND, new IngredientCraftTweaker(input), sand, CraftTweakerMC.getItemStacks(outputs));
    CraftTweaker.LATE_ACTIONS.add(new Add(r));
}
Also used : NetRecipe(betterwithaddons.crafting.recipes.NetRecipe) IngredientCraftTweaker(betterwithaddons.util.IngredientCraftTweaker) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Aggregations

NetRecipe (betterwithaddons.crafting.recipes.NetRecipe)4 IngredientCraftTweaker (betterwithaddons.util.IngredientCraftTweaker)3 ZenMethod (stanhebben.zenscript.annotations.ZenMethod)3 CraftingManagerNet (betterwithaddons.crafting.manager.CraftingManagerNet)1 EntityItem (net.minecraft.entity.item.EntityItem)1 ItemStack (net.minecraft.item.ItemStack)1