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());
}
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());
}
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());
}
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());
}
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);
}
}
}
Aggregations