Search in sources :

Example 6 with VanillaItem

use of io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem in project Slimefun4 by Slimefun.

the class TestCraftingTableListener method testPreCraftEventWithVanillaItem.

@Test
void testPreCraftEventWithVanillaItem() {
    VanillaItem item = TestUtilities.mockVanillaItem(plugin, Material.GOLD_INGOT, true);
    item.register(plugin);
    PrepareItemCraftEvent event = mockPreCraftingEvent(item.getItem());
    Assertions.assertNotNull(event.getInventory().getResult());
}
Also used : PrepareItemCraftEvent(org.bukkit.event.inventory.PrepareItemCraftEvent) VanillaItem(io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem) Test(org.junit.jupiter.api.Test)

Example 7 with VanillaItem

use of io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem in project Slimefun4 by Slimefun.

the class TestAnvilListener method testAnvilWithVanillaItem.

@Test
void testAnvilWithVanillaItem() {
    VanillaItem item = TestUtilities.mockVanillaItem(plugin, Material.IRON_SWORD, true);
    item.register(plugin);
    InventoryClickEvent event = mockAnvilEvent(item.getItem());
    Assertions.assertEquals(Result.DEFAULT, event.getResult());
}
Also used : InventoryClickEvent(org.bukkit.event.inventory.InventoryClickEvent) VanillaItem(io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem) Test(org.junit.jupiter.api.Test)

Example 8 with VanillaItem

use of io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem in project Slimefun4 by Slimefun.

the class TestBrewingStandListener method testBrewingWithVanillaItem.

@Test
void testBrewingWithVanillaItem() {
    VanillaItem item = TestUtilities.mockVanillaItem(plugin, Material.BLAZE_POWDER, true);
    item.register(plugin);
    InventoryClickEvent event = mockBrewingEvent(item.getItem());
    Assertions.assertEquals(Result.ALLOW, event.getResult());
}
Also used : InventoryClickEvent(org.bukkit.event.inventory.InventoryClickEvent) VanillaItem(io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem) Test(org.junit.jupiter.api.Test)

Example 9 with VanillaItem

use of io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem in project Slimefun4 by Slimefun.

the class TestSlimefunItemRegistration method testVanillaItemFallback.

@Test
@DisplayName("Test VanillaItem falling back to vanilla.")
void testVanillaItemFallback() {
    VanillaItem item = TestUtilities.mockVanillaItem(plugin, Material.ACACIA_SIGN, false);
    item.register(plugin);
    Assertions.assertTrue(item.isUseableInWorkbench());
    Assertions.assertEquals(ItemState.VANILLA_FALLBACK, item.getState());
    Assertions.assertTrue(item.isDisabled());
}
Also used : VanillaItem(io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 10 with VanillaItem

use of io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem in project Slimefun4 by Slimefun.

the class SlimefunItemSetup method registerArmorSet.

@ParametersAreNonnullByDefault
private static void registerArmorSet(ItemGroup itemGroup, ItemStack baseComponent, ItemStack[] items, String idSyntax, boolean vanilla, PotionEffect[][] effects, SlimefunAddon addon) {
    String[] components = new String[] { "_HELMET", "_CHESTPLATE", "_LEGGINGS", "_BOOTS" };
    List<ItemStack[]> recipes = new ArrayList<>();
    recipes.add(new ItemStack[] { baseComponent, baseComponent, baseComponent, baseComponent, null, baseComponent, null, null, null });
    recipes.add(new ItemStack[] { baseComponent, null, baseComponent, baseComponent, baseComponent, baseComponent, baseComponent, baseComponent, baseComponent });
    recipes.add(new ItemStack[] { baseComponent, baseComponent, baseComponent, baseComponent, null, baseComponent, baseComponent, null, baseComponent });
    recipes.add(new ItemStack[] { null, null, null, baseComponent, null, baseComponent, baseComponent, null, baseComponent });
    for (int i = 0; i < 4; i++) {
        if (vanilla) {
            new VanillaItem(itemGroup, items[i], idSyntax + components[i], RecipeType.ARMOR_FORGE, recipes.get(i)).register(addon);
        } else if (i < effects.length && effects[i].length > 0) {
            new SlimefunArmorPiece(itemGroup, new SlimefunItemStack(idSyntax + components[i], items[i]), RecipeType.ARMOR_FORGE, recipes.get(i), effects[i]).register(addon);
        } else {
            new SlimefunItem(itemGroup, new SlimefunItemStack(idSyntax + components[i], items[i]), RecipeType.ARMOR_FORGE, recipes.get(i)).register(addon);
        }
    }
}
Also used : SlimefunArmorPiece(io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece) ArrayList(java.util.ArrayList) SlimefunItem(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem) Splint(io.github.thebusybiscuit.slimefun4.implementation.items.medical.Splint) VanillaItem(io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault)

Aggregations

VanillaItem (io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem)14 Test (org.junit.jupiter.api.Test)10 InventoryClickEvent (org.bukkit.event.inventory.InventoryClickEvent)5 SlimefunItem (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem)3 ItemStack (org.bukkit.inventory.ItemStack)3 DisplayName (org.junit.jupiter.api.DisplayName)3 CustomItemStack (io.github.bakedlibs.dough.items.CustomItemStack)2 SlimefunItemStack (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)2 SlimefunArmorPiece (io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece)2 ParametersAreNonnullByDefault (javax.annotation.ParametersAreNonnullByDefault)2 MinecraftVersion (io.github.thebusybiscuit.slimefun4.api.MinecraftVersion)1 ItemGroup (io.github.thebusybiscuit.slimefun4.api.items.ItemGroup)1 RecipeType (io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType)1 RainbowTickHandler (io.github.thebusybiscuit.slimefun4.core.handlers.RainbowTickHandler)1 RadioactiveItem (io.github.thebusybiscuit.slimefun4.implementation.items.RadioactiveItem)1 AncientAltar (io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAltar)1 AncientPedestal (io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientPedestal)1 AndroidInterface (io.github.thebusybiscuit.slimefun4.implementation.items.androids.AndroidInterface)1 ButcherAndroid (io.github.thebusybiscuit.slimefun4.implementation.items.androids.ButcherAndroid)1 FarmerAndroid (io.github.thebusybiscuit.slimefun4.implementation.items.androids.FarmerAndroid)1