Search in sources :

Example 1 with MultiBlockMachine

use of io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine in project Slimefun4 by Slimefun.

the class GiveCommand method giveItem.

private void giveItem(CommandSender sender, Player p, SlimefunItem sfItem, String[] args) {
    if (sfItem instanceof MultiBlockMachine) {
        Slimefun.getLocalization().sendMessage(sender, "guide.cheat.no-multiblocks");
    } else {
        int amount = parseAmount(args);
        if (amount > 0) {
            Slimefun.getLocalization().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
            Map<Integer, ItemStack> excess = p.getInventory().addItem(new CustomItemStack(sfItem.getItem(), amount));
            if (Slimefun.getCfg().getBoolean("options.drop-excess-sf-give-items") && !excess.isEmpty()) {
                for (ItemStack is : excess.values()) {
                    p.getWorld().dropItem(p.getLocation(), is);
                }
            }
            Slimefun.getLocalization().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
        } else {
            Slimefun.getLocalization().sendMessage(sender, "messages.invalid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
        }
    }
}
Also used : CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) ItemStack(org.bukkit.inventory.ItemStack) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) MultiBlockMachine(io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine)

Example 2 with MultiBlockMachine

use of io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine in project SupplementalServiceableness by NCBPFluffyBear.

the class SupServItemSetup method setup.

public static void setup(@Nonnull SupServPlugin plugin) {
    new LavaSponge(SupServItems.SUPSERV_CATEGORY, SupServItems.LAVA_SPONGE, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { null, new ItemStack(Material.BROWN_WOOL), null, new ItemStack(Material.BROWN_WOOL), new ItemStack(Material.OBSIDIAN), new ItemStack(Material.BROWN_WOOL), null, new ItemStack(Material.BROWN_WOOL), null }, new SlimefunItemStack(SupServItems.LAVA_SPONGE, 8)).register(plugin);
    new NonInteractableItem(SupServItems.SUPSERV_CATEGORY, SupServItems.CHIPPED_WITHER_SKELETON_SKULL, RecipeType.MAGIC_WORKBENCH, new ItemStack[] { SlimefunItems.COMPRESSED_CARBON, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.COMPRESSED_CARBON, new ItemStack(Material.SKELETON_SKULL), SlimefunItems.COMPRESSED_CARBON, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.COMPRESSED_CARBON, SlimefunItems.COMPRESSED_CARBON }).register(plugin);
    new NonInteractableItem(SupServItems.SUPSERV_CATEGORY, SupServItems.FRAGMENTED_WITHER_SKELETON_SKULL, RecipeType.MAGIC_WORKBENCH, Utils.build3x3Recipe(SupServItems.CHIPPED_WITHER_SKELETON_SKULL)).register(plugin);
    new NonInteractableItem(SupServItems.SUPSERV_CATEGORY, SupServItems.WITHER_SKELETON_SKULL, RecipeType.MAGIC_WORKBENCH, new ItemStack[] { SupServItems.FRAGMENTED_WITHER_SKELETON_SKULL, SupServItems.FRAGMENTED_WITHER_SKELETON_SKULL, null, SupServItems.FRAGMENTED_WITHER_SKELETON_SKULL, SupServItems.FRAGMENTED_WITHER_SKELETON_SKULL, null, null, null, null }, new ItemStack(Material.WITHER_SKELETON_SKULL)).register(plugin);
    new NonInteractableItem(SupServItems.SUPSERV_CATEGORY, SupServItems.CONDENSED_NETHER_STAR_BLOCK, RecipeType.ENHANCED_CRAFTING_TABLE, Utils.build3x3Recipe(new ItemStack(Material.NETHER_STAR))).register(plugin);
    new NonInteractableItem(SupServItems.SUPSERV_CATEGORY, SupServItems.INGOT_OF_AFTERLIFE, RecipeType.MAGIC_WORKBENCH, Utils.build3x3Recipe(SlimefunItems.ESSENCE_OF_AFTERLIFE)).register(plugin);
    new NonInteractableItem(SupServItems.SUPSERV_CATEGORY, SupServItems.DRAGON_ESSENCE, RecipeType.ANCIENT_ALTAR, new ItemStack[] { SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.DRAGON_BREATH), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.DRAGON_BREATH), new ItemStack(Material.NETHER_STAR), new ItemStack(Material.DRAGON_BREATH), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.DRAGON_BREATH), SlimefunItems.ENDER_LUMP_3 }).register(plugin);
    new NonInteractableItem(SupServItems.SUPSERV_CATEGORY, SupServItems.DRAGON_EGG, RecipeType.ANCIENT_ALTAR, new ItemStack[] { SupServItems.INGOT_OF_AFTERLIFE, SupServItems.DRAGON_ESSENCE, SupServItems.INGOT_OF_AFTERLIFE, SupServItems.DRAGON_ESSENCE, SupServItems.CONDENSED_NETHER_STAR_BLOCK, SupServItems.DRAGON_ESSENCE, SupServItems.INGOT_OF_AFTERLIFE, SupServItems.DRAGON_ESSENCE, SupServItems.INGOT_OF_AFTERLIFE }, new ItemStack(Material.DRAGON_EGG)).register(plugin);
    // Tools
    new WateringCan(SupServItems.SUPSERV_CATEGORY, SupServItems.WATERING_CAN, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { new ItemStack(Material.STONE), null, new ItemStack(Material.STONE), new ItemStack(Material.STONE), new ItemStack(Material.WATER_BUCKET), new ItemStack(Material.STONE), null, new ItemStack(Material.STONE), null }, WateringCan.canType.STONE).register(plugin);
    new WateringCan(SupServItems.SUPSERV_CATEGORY, SupServItems.WATERING_CAN_IRON, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { new ItemStack(Material.IRON_INGOT), null, new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), SupServItems.WATERING_CAN, new ItemStack(Material.IRON_INGOT), null, new ItemStack(Material.IRON_INGOT), null }, WateringCan.canType.IRON).register(plugin);
    new WateringCan(SupServItems.SUPSERV_CATEGORY, SupServItems.WATERING_CAN_GOLD, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { SlimefunItems.GOLD_16K, null, SlimefunItems.GOLD_16K, SlimefunItems.GOLD_16K, SupServItems.WATERING_CAN_IRON, SlimefunItems.GOLD_16K, null, SlimefunItems.GOLD_16K, null }, WateringCan.canType.GOLD).register(plugin);
    new WateringCan(SupServItems.SUPSERV_CATEGORY, SupServItems.WATERING_CAN_DIAMOND, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { SlimefunItems.SYNTHETIC_DIAMOND, null, SlimefunItems.SYNTHETIC_DIAMOND, SlimefunItems.SYNTHETIC_DIAMOND, SupServItems.WATERING_CAN_GOLD, SlimefunItems.SYNTHETIC_DIAMOND, null, SlimefunItems.SYNTHETIC_DIAMOND, null }, WateringCan.canType.DIAMOND).register(plugin);
    new WateringCan(SupServItems.SUPSERV_CATEGORY, SupServItems.WATERING_CAN_EMERALD, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { SlimefunItems.SYNTHETIC_EMERALD, null, SlimefunItems.SYNTHETIC_EMERALD, SlimefunItems.SYNTHETIC_EMERALD, SupServItems.WATERING_CAN_DIAMOND, SlimefunItems.SYNTHETIC_EMERALD, null, SlimefunItems.SYNTHETIC_EMERALD, null }, WateringCan.canType.EMERALD).register(plugin);
    new WateringCan(SupServItems.SUPSERV_CATEGORY, SupServItems.WATERING_CAN_NETHERITE, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { null, null, null, null, SupServItems.WATERING_CAN_EMERALD, new ItemStack(Material.NETHERITE_INGOT), null, null, null }, WateringCan.canType.NETHERITE).register(plugin);
    // Extra recipe watering can to accept watering can Fluffymachines
    if (plugin.getServer().getPluginManager().isPluginEnabled("FluffyMachines")) {
        new WateringCan(SupServItems.SUPSERV_CATEGORY, SupServItems.WATERING_CAN_IRON_FM, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { new ItemStack(Material.IRON_INGOT), null, new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT), SlimefunItem.getById("WATERING_CAN").getItem(), new ItemStack(Material.IRON_INGOT), null, new ItemStack(Material.IRON_INGOT), null }, WateringCan.canType.IRON, SupServItems.WATERING_CAN_IRON.clone()).register(plugin);
    }
    new FarmersHoe(SupServItems.SUPSERV_CATEGORY, SupServItems.FARMERS_HOE, RecipeType.ANCIENT_ALTAR, new ItemStack[] { SlimefunItems.EARTH_RUNE, SlimefunItems.WATER_RUNE, SlimefunItems.EARTH_RUNE, new ItemStack(Material.BONE_BLOCK), new ItemStack(Material.IRON_HOE), new ItemStack(Material.BONE_BLOCK), SlimefunItems.EARTH_RUNE, SlimefunItems.WATER_RUNE, SlimefunItems.EARTH_RUNE }).register(plugin);
    new AdvancedElectricComposter(SupServItems.SUPSERV_CATEGORY, SupServItems.ADVANCED_ELECTRIC_COMPOSTER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { new ItemStack(Material.NETHER_BRICK_SLAB), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.NETHER_BRICK_SLAB), new ItemStack(Material.NETHER_BRICK_SLAB), SlimefunItem.getById("ELECTRIC_COMPOSTER_2").getItem(), new ItemStack(Material.NETHER_BRICK_SLAB), new ItemStack(Material.NETHER_BRICK_SLAB), SlimefunItems.ADVANCED_CIRCUIT_BOARD, new ItemStack(Material.NETHER_BRICK_SLAB) }).register(plugin);
    new ExpGenerator(SupServItems.SUPSERV_CATEGORY, SupServItems.EXP_GENERATOR, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { new ItemStack(Material.OBSIDIAN), SlimefunItems.ELECTRO_MAGNET, new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN), SlimefunItems.EXP_COLLECTOR, new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.OBSIDIAN) }).register(plugin);
    new Baler(SupServItems.SUPSERV_CATEGORY, SupServItems.BALER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { new ItemStack(Material.OAK_PLANKS), SlimefunItems.ELECTRO_MAGNET, new ItemStack(Material.OAK_PLANKS), new ItemStack(Material.PISTON), SlimefunItems.CRAFTING_MOTOR, new ItemStack(Material.PISTON), new ItemStack(Material.OAK_PLANKS), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.OAK_PLANKS) }).register(plugin);
    new EndermanTether(SupServItems.SUPSERV_CATEGORY, SupServItems.ENDERMAN_TETHER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { SlimefunItems.ENDER_RUNE, new ItemStack(Material.CRYING_OBSIDIAN), SlimefunItems.ENDER_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.INFUSED_MAGNET, SlimefunItems.ENDER_LUMP_3, SlimefunItems.ENDER_RUNE, new ItemStack(Material.CRYING_OBSIDIAN), SlimefunItems.ENDER_RUNE }).register(plugin);
    new HeadGrinder(SupServItems.SUPSERV_CATEGORY, SupServItems.HEAD_GRINDER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.STONECUTTER), new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.PISTON), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.PISTON), new ItemStack(Material.IRON_BLOCK), SlimefunItems.MEDIUM_CAPACITOR, new ItemStack(Material.IRON_BLOCK) }).register(plugin);
    new Voltmeter(SupServItems.SUPSERV_CATEGORY, SupServItems.VOLTMETER, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, new ItemStack(Material.CLOCK), SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE }).register(plugin);
    new SlimefunItem(SupServItems.SUPSERV_CATEGORY, SupServItems.COMPRESSED_COBBLESTONE, RecipeType.COMPRESSOR, new ItemStack[] { new ItemStack(Material.COBBLESTONE, 9) }).register(plugin);
    new SlimefunItem(SupServItems.SUPSERV_CATEGORY, SupServItems.DOUBLE_COMPRESSED_COBBLESTONE, RecipeType.COMPRESSOR, new ItemStack[] { new CustomItemStack(SupServItems.COMPRESSED_COBBLESTONE, 9) }).register(plugin);
    new SlimefunItem(SupServItems.SUPSERV_CATEGORY, SupServItems.TRIPLE_COMPRESSED_COBBLESTONE, RecipeType.COMPRESSOR, new ItemStack[] { new CustomItemStack(SupServItems.DOUBLE_COMPRESSED_COBBLESTONE, 9) }).register(plugin);
    new SlimefunItem(SupServItems.SUPSERV_CATEGORY, SupServItems.QUADRUPLE_COMPRESSED_COBBLESTONE, RecipeType.COMPRESSOR, new ItemStack[] { new CustomItemStack(SupServItems.TRIPLE_COMPRESSED_COBBLESTONE, 9) }).register(plugin);
    new SlimefunItem(SupServItems.SUPSERV_CATEGORY, SupServItems.QUINTUPLE_COMPRESSED_COBBLESTONE, RecipeType.COMPRESSOR, new ItemStack[] { new CustomItemStack(SupServItems.QUADRUPLE_COMPRESSED_COBBLESTONE, 9) }).register(plugin);
    new SlimefunItem(SupServItems.SUPSERV_CATEGORY, SupServItems.SEXTUPLE_COMPRESSED_COBBLESTONE, RecipeType.COMPRESSOR, new ItemStack[] { new CustomItemStack(SupServItems.QUINTUPLE_COMPRESSED_COBBLESTONE, 9) }).register(plugin);
    new SlimefunItem(SupServItems.SUPSERV_CATEGORY, SupServItems.SEPTUPLE_COMPRESSED_COBBLESTONE, RecipeType.COMPRESSOR, new ItemStack[] { new CustomItemStack(SupServItems.SEXTUPLE_COMPRESSED_COBBLESTONE, 9) }).register(plugin);
    // Grind Stone
    ((MultiBlockMachine) SlimefunItems.GRIND_STONE.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.COMPRESSED_COBBLESTONE, 1) }, new ItemStack(Material.COBBLESTONE, 9));
    ((MultiBlockMachine) SlimefunItems.GRIND_STONE.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.DOUBLE_COMPRESSED_COBBLESTONE, 1) }, new SlimefunItemStack(SupServItems.COMPRESSED_COBBLESTONE, 9));
    ((MultiBlockMachine) SlimefunItems.GRIND_STONE.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.TRIPLE_COMPRESSED_COBBLESTONE, 1) }, new SlimefunItemStack(SupServItems.DOUBLE_COMPRESSED_COBBLESTONE, 9));
    ((MultiBlockMachine) SlimefunItems.GRIND_STONE.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.QUADRUPLE_COMPRESSED_COBBLESTONE, 1) }, new SlimefunItemStack(SupServItems.TRIPLE_COMPRESSED_COBBLESTONE, 9));
    ((MultiBlockMachine) SlimefunItems.GRIND_STONE.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.QUINTUPLE_COMPRESSED_COBBLESTONE, 1) }, new SlimefunItemStack(SupServItems.QUADRUPLE_COMPRESSED_COBBLESTONE, 9));
    ((MultiBlockMachine) SlimefunItems.GRIND_STONE.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.SEXTUPLE_COMPRESSED_COBBLESTONE, 1) }, new SlimefunItemStack(SupServItems.QUINTUPLE_COMPRESSED_COBBLESTONE, 9));
    ((MultiBlockMachine) SlimefunItems.GRIND_STONE.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.SEPTUPLE_COMPRESSED_COBBLESTONE, 1) }, new SlimefunItemStack(SupServItems.SEXTUPLE_COMPRESSED_COBBLESTONE, 9));
    ((MultiBlockMachine) SlimefunItems.GRIND_STONE.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.OCTUPLE_COMPRESSED_COBBLESTONE, 1) }, new SlimefunItemStack(SupServItems.SEPTUPLE_COMPRESSED_COBBLESTONE, 9));
    // Compressor
    ((MultiBlockMachine) SlimefunItems.COMPRESSOR.getItem()).addRecipe(new ItemStack[] { new ItemStack(Material.COBBLESTONE, 9) }, new SlimefunItemStack(SupServItems.COMPRESSED_COBBLESTONE, 1));
    ((MultiBlockMachine) SlimefunItems.COMPRESSOR.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.COMPRESSED_COBBLESTONE, 9) }, new SlimefunItemStack(SupServItems.DOUBLE_COMPRESSED_COBBLESTONE, 1));
    ((MultiBlockMachine) SlimefunItems.COMPRESSOR.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.DOUBLE_COMPRESSED_COBBLESTONE, 9) }, new SlimefunItemStack(SupServItems.TRIPLE_COMPRESSED_COBBLESTONE, 1));
    ((MultiBlockMachine) SlimefunItems.COMPRESSOR.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.TRIPLE_COMPRESSED_COBBLESTONE, 9) }, new SlimefunItemStack(SupServItems.QUADRUPLE_COMPRESSED_COBBLESTONE, 1));
    ((MultiBlockMachine) SlimefunItems.COMPRESSOR.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.QUADRUPLE_COMPRESSED_COBBLESTONE, 9) }, new SlimefunItemStack(SupServItems.QUINTUPLE_COMPRESSED_COBBLESTONE, 1));
    ((MultiBlockMachine) SlimefunItems.COMPRESSOR.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.QUINTUPLE_COMPRESSED_COBBLESTONE, 9) }, new SlimefunItemStack(SupServItems.SEXTUPLE_COMPRESSED_COBBLESTONE, 1));
    ((MultiBlockMachine) SlimefunItems.COMPRESSOR.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.SEXTUPLE_COMPRESSED_COBBLESTONE, 9) }, new SlimefunItemStack(SupServItems.SEPTUPLE_COMPRESSED_COBBLESTONE, 1));
    ((MultiBlockMachine) SlimefunItems.COMPRESSOR.getItem()).addRecipe(new ItemStack[] { new SlimefunItemStack(SupServItems.SEPTUPLE_COMPRESSED_COBBLESTONE, 9) }, new SlimefunItemStack(SupServItems.QUADRUPLE_COMPRESSED_COBBLESTONE, 1));
    new WitherProofBlock(SupServItems.SUPSERV_CATEGORY, SupServItems.WITHER_PROOF_SEA_LANTERN, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, new ItemStack(Material.SEA_LANTERN), SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN }, new SlimefunItemStack(SupServItems.WITHER_PROOF_SEA_LANTERN, 16)).register(plugin);
    new WitherProofBlock(SupServItems.SUPSERV_CATEGORY, SupServItems.WITHER_PROOF_GLOWSTONE, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, new ItemStack(Material.GLOWSTONE), SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN }, new SlimefunItemStack(SupServItems.WITHER_PROOF_GLOWSTONE, 16)).register(plugin);
    new WitherProofBlock(SupServItems.SUPSERV_CATEGORY, SupServItems.WITHER_PROOF_SHROOMLIGHT, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] { SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, new ItemStack(Material.SHROOMLIGHT), SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_OBSIDIAN }, new SlimefunItemStack(SupServItems.WITHER_PROOF_SHROOMLIGHT, 16)).register(plugin);
}
Also used : WitherProofBlock(io.github.thebusybiscuit.slimefun4.implementation.items.blocks.WitherProofBlock) EndermanTether(io.ncbpfluffybear.supserv.items.EndermanTether) NonInteractableItem(io.ncbpfluffybear.supserv.objects.NonInteractableItem) AdvancedElectricComposter(io.ncbpfluffybear.supserv.machines.AdvancedElectricComposter) Voltmeter(io.ncbpfluffybear.supserv.items.Voltmeter) FarmersHoe(io.ncbpfluffybear.supserv.items.FarmersHoe) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) HeadGrinder(io.ncbpfluffybear.supserv.machines.HeadGrinder) WateringCan(io.ncbpfluffybear.supserv.items.WateringCan) ExpGenerator(io.ncbpfluffybear.supserv.machines.ExpGenerator) Baler(io.ncbpfluffybear.supserv.machines.Baler) CustomItemStack(io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack) LavaSponge(io.ncbpfluffybear.supserv.items.LavaSponge) CustomItemStack(io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack) ItemStack(org.bukkit.inventory.ItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) MultiBlockMachine(io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)

Example 3 with MultiBlockMachine

use of io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine in project Slimefun4 by Slimefun.

the class SurvivalSlimefunGuide method displayItem.

private void displayItem(ChestMenu menu, PlayerProfile profile, Player p, Object item, ItemStack output, RecipeType recipeType, ItemStack[] recipe, AsyncRecipeChoiceTask task) {
    addBackButton(menu, 0, p, profile);
    MenuClickHandler clickHandler = (pl, slot, itemstack, action) -> {
        try {
            if (itemstack != null && itemstack.getType() != Material.BARRIER) {
                displayItem(profile, itemstack, 0, true);
            }
        } catch (Exception | LinkageError x) {
            printErrorMessage(pl, x);
        }
        return false;
    };
    boolean isSlimefunRecipe = item instanceof SlimefunItem;
    for (int i = 0; i < 9; i++) {
        ItemStack recipeItem = getDisplayItem(p, isSlimefunRecipe, recipe[i]);
        menu.addItem(recipeSlots[i], recipeItem, clickHandler);
        if (recipeItem != null && item instanceof MultiBlockMachine) {
            for (Tag<Material> tag : MultiBlock.getSupportedTags()) {
                if (tag.isTagged(recipeItem.getType())) {
                    task.add(recipeSlots[i], tag);
                    break;
                }
            }
        }
    }
    menu.addItem(10, recipeType.getItem(p), ChestMenuUtils.getEmptyClickHandler());
    menu.addItem(16, output, ChestMenuUtils.getEmptyClickHandler());
}
Also used : ItemFlag(org.bukkit.inventory.ItemFlag) MaterialChoice(org.bukkit.inventory.RecipeChoice.MaterialChoice) Arrays(java.util.Arrays) SlimefunGuideSettings(io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings) Player(org.bukkit.entity.Player) ItemUtils(io.github.bakedlibs.dough.items.ItemUtils) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault) Inventory(org.bukkit.inventory.Inventory) PlayerProfile(io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile) RecipeType(io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType) Locale(java.util.Locale) SlimefunGuideMode(io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode) MinecraftRecipe(io.github.bakedlibs.dough.recipes.MinecraftRecipe) Recipe(org.bukkit.inventory.Recipe) Material(org.bukkit.Material) ChatInput(io.github.bakedlibs.dough.chat.ChatInput) SlimefunGuideImplementation(io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation) ItemGroup(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup) ChestMenuUtils(io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils) Sound(org.bukkit.Sound) SlimefunAddon(io.github.thebusybiscuit.slimefun4.api.SlimefunAddon) Research(io.github.thebusybiscuit.slimefun4.api.researches.Research) ChatUtils(io.github.thebusybiscuit.slimefun4.utils.ChatUtils) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) Slimefun(io.github.thebusybiscuit.slimefun4.implementation.Slimefun) Optional(java.util.Optional) ChestMenu(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu) Validate(org.apache.commons.lang.Validate) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) LockedItemGroup(io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup) SlimefunGuideItem(io.github.thebusybiscuit.slimefun4.utils.itemstack.SlimefunGuideItem) Tag(org.bukkit.Tag) RecipeChoice(org.bukkit.inventory.RecipeChoice) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) AsyncRecipeChoiceTask(io.github.thebusybiscuit.slimefun4.implementation.tasks.AsyncRecipeChoiceTask) MenuClickHandler(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler) RecipeDisplayItem(io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem) MultiBlock(io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlock) LinkedList(java.util.LinkedList) Nonnull(javax.annotation.Nonnull) FlexItemGroup(io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) MultiBlockMachine(io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine) SubItemGroup(io.github.thebusybiscuit.slimefun4.api.items.groups.SubItemGroup) ChatColor(org.bukkit.ChatColor) GuideHistory(io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory) SlimefunGuide(io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide) MenuClickHandler(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler) Material(org.bukkit.Material) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) ItemStack(org.bukkit.inventory.ItemStack) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) MultiBlockMachine(io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine)

Example 4 with MultiBlockMachine

use of io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine in project Slimefun4 by Slimefun.

the class SurvivalSlimefunGuide method displaySlimefunItem.

private void displaySlimefunItem(ChestMenu menu, ItemGroup itemGroup, Player p, PlayerProfile profile, SlimefunItem sfitem, int page, int index) {
    Research research = sfitem.getResearch();
    if (isSurvivalMode() && !hasPermission(p, sfitem)) {
        List<String> message = Slimefun.getPermissionsService().getLore(sfitem);
        menu.addItem(index, new CustomItemStack(ChestMenuUtils.getNoPermissionItem(), sfitem.getItemName(), message.toArray(new String[0])));
        menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
    } else if (isSurvivalMode() && research != null && !profile.hasUnlocked(research)) {
        menu.addItem(index, new CustomItemStack(ChestMenuUtils.getNotResearchedItem(), ChatColor.WHITE + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + Slimefun.getLocalization().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level(s)"));
        menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
            research.unlockFromGuide(this, p, profile, sfitem, itemGroup, page);
            return false;
        });
    } else {
        menu.addItem(index, sfitem.getItem());
        menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
            try {
                if (isSurvivalMode()) {
                    displayItem(profile, sfitem, true);
                } else {
                    if (sfitem instanceof MultiBlockMachine) {
                        Slimefun.getLocalization().sendMessage(pl, "guide.cheat.no-multiblocks");
                    } else {
                        ItemStack clonedItem = sfitem.getItem().clone();
                        if (action.isShiftClicked()) {
                            clonedItem.setAmount(clonedItem.getMaxStackSize());
                        }
                        pl.getInventory().addItem(clonedItem);
                    }
                }
            } catch (Exception | LinkageError x) {
                printErrorMessage(pl, x);
            }
            return false;
        });
    }
}
Also used : ItemFlag(org.bukkit.inventory.ItemFlag) MaterialChoice(org.bukkit.inventory.RecipeChoice.MaterialChoice) Arrays(java.util.Arrays) SlimefunGuideSettings(io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings) Player(org.bukkit.entity.Player) ItemUtils(io.github.bakedlibs.dough.items.ItemUtils) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault) Inventory(org.bukkit.inventory.Inventory) PlayerProfile(io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile) RecipeType(io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType) Locale(java.util.Locale) SlimefunGuideMode(io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode) MinecraftRecipe(io.github.bakedlibs.dough.recipes.MinecraftRecipe) Recipe(org.bukkit.inventory.Recipe) Material(org.bukkit.Material) ChatInput(io.github.bakedlibs.dough.chat.ChatInput) SlimefunGuideImplementation(io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation) ItemGroup(io.github.thebusybiscuit.slimefun4.api.items.ItemGroup) ChestMenuUtils(io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils) Sound(org.bukkit.Sound) SlimefunAddon(io.github.thebusybiscuit.slimefun4.api.SlimefunAddon) Research(io.github.thebusybiscuit.slimefun4.api.researches.Research) ChatUtils(io.github.thebusybiscuit.slimefun4.utils.ChatUtils) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) Slimefun(io.github.thebusybiscuit.slimefun4.implementation.Slimefun) Optional(java.util.Optional) ChestMenu(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu) Validate(org.apache.commons.lang.Validate) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) LockedItemGroup(io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup) SlimefunGuideItem(io.github.thebusybiscuit.slimefun4.utils.itemstack.SlimefunGuideItem) Tag(org.bukkit.Tag) RecipeChoice(org.bukkit.inventory.RecipeChoice) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) AsyncRecipeChoiceTask(io.github.thebusybiscuit.slimefun4.implementation.tasks.AsyncRecipeChoiceTask) MenuClickHandler(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler) RecipeDisplayItem(io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem) MultiBlock(io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlock) LinkedList(java.util.LinkedList) Nonnull(javax.annotation.Nonnull) FlexItemGroup(io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) MultiBlockMachine(io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine) SubItemGroup(io.github.thebusybiscuit.slimefun4.api.items.groups.SubItemGroup) ChatColor(org.bukkit.ChatColor) GuideHistory(io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory) SlimefunGuide(io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) Research(io.github.thebusybiscuit.slimefun4.api.researches.Research) ItemStack(org.bukkit.inventory.ItemStack) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) MultiBlockMachine(io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine)

Example 5 with MultiBlockMachine

use of io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine in project SupremeExpansion by RelativoBR.

the class MultiBlockGearFabricator method interactGearMachine.

public static void interactGearMachine(SupremeExpansion plugin, MultiBlockMachine machine, Player p, Block b) {
    Block dispenser = b.getRelative(BlockFace.UP);
    if (!dispenser.isEmpty()) {
        BlastFurnace blastFurnace = (BlastFurnace) PaperLib.getBlockState(b.getRelative(BlockFace.DOWN), false).getState();
        FurnaceInventory furnaceInventory = blastFurnace.getInventory();
        Inventory inv = ((Dispenser) dispenser.getState()).getInventory();
        List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
        recipe: for (ItemStack[] input : inputs) {
            for (int i = 0; i < inv.getContents().length; i++) {
                if (!SlimefunUtils.isItemSimilar(inv.getContents()[i], input[i], false, true)) {
                    continue recipe;
                }
            }
            ItemStack output = RecipeType.getRecipeOutputList(machine, input);
            SlimefunItem outputItem = SlimefunItem.getByItem(output);
            if (outputItem == null || outputItem.canUse(p, true)) {
                if (furnaceInventory.getResult() != null) {
                    Slimefun.getLocalization().sendMessage(p, "machines.full-inventory", true);
                    return;
                }
                for (int i = 0; i < inv.getContents().length; i++) {
                    ItemStack item = inv.getItem(i);
                    if (item != null) {
                        ItemUtils.consumeItem(item, input[i].getAmount(), false);
                    }
                }
                Bukkit.getScheduler().runTaskLater(plugin, () -> p.getWorld().playSound(dispenser.getLocation(), Sound.BLOCK_LAVA_EXTINGUISH, 1F, 1F), 55L);
                for (int i = 1; i < 7; i++) {
                    Bukkit.getScheduler().runTaskLater(plugin, () -> p.getWorld().playSound(dispenser.getLocation(), Sound.BLOCK_METAL_PLACE, 7F, 1F), i * 5L);
                }
                if (furnaceInventory.getResult() == null) {
                    furnaceInventory.setResult(output);
                }
            }
            return;
        }
    }
    Slimefun.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
}
Also used : Dispenser(org.bukkit.block.Dispenser) FurnaceInventory(org.bukkit.inventory.FurnaceInventory) BlastFurnace(org.bukkit.block.BlastFurnace) Block(org.bukkit.block.Block) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) ItemStack(org.bukkit.inventory.ItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) Inventory(org.bukkit.inventory.Inventory) FurnaceInventory(org.bukkit.inventory.FurnaceInventory)

Aggregations

ItemStack (org.bukkit.inventory.ItemStack)6 SlimefunItem (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem)5 MultiBlockMachine (io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine)5 CustomItemStack (io.github.bakedlibs.dough.items.CustomItemStack)3 ArrayList (java.util.ArrayList)3 Player (org.bukkit.entity.Player)3 Inventory (org.bukkit.inventory.Inventory)3 ChatInput (io.github.bakedlibs.dough.chat.ChatInput)2 ItemUtils (io.github.bakedlibs.dough.items.ItemUtils)2 MinecraftRecipe (io.github.bakedlibs.dough.recipes.MinecraftRecipe)2 SlimefunAddon (io.github.thebusybiscuit.slimefun4.api.SlimefunAddon)2 ItemGroup (io.github.thebusybiscuit.slimefun4.api.items.ItemGroup)2 FlexItemGroup (io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup)2 LockedItemGroup (io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup)2 SubItemGroup (io.github.thebusybiscuit.slimefun4.api.items.groups.SubItemGroup)2 PlayerProfile (io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile)2 RecipeType (io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType)2 Research (io.github.thebusybiscuit.slimefun4.api.researches.Research)2 RecipeDisplayItem (io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem)2 GuideHistory (io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory)2