use of io.github.bakedlibs.dough.items.CustomItemStack in project Slimefun4 by Slimefun.
the class TestMultiblockListener method load.
@BeforeAll
public static void load() {
server = MockBukkit.mock();
plugin = MockBukkit.load(Slimefun.class);
listener = new MultiBlockListener(plugin);
SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "MULTIBLOCK_LISTENER_TEST", new CustomItemStack(Material.DIAMOND, "&9Some multiblock item"));
multiblock = new MultiBlock(item, new Material[] { null, Material.EMERALD_BLOCK, null, null, Material.DIAMOND_BLOCK, null, null, Material.LAPIS_BLOCK, null }, BlockFace.SELF);
Slimefun.getRegistry().getMultiBlocks().add(multiblock);
}
use of io.github.bakedlibs.dough.items.CustomItemStack in project Slimefun4 by Slimefun.
the class TestPiglinListener method testPiglinInteractWithSlimefunItem.
@ParameterizedTest
@EnumSource(value = EquipmentSlot.class, names = { "HAND", "OFF_HAND" })
void testPiglinInteractWithSlimefunItem(EquipmentSlot hand) {
SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "PIGLIN_GIVE_" + hand.name(), new CustomItemStack(Material.GOLD_INGOT, "&6Piglin Bait"));
item.register(plugin);
PlayerInteractEntityEvent event = createInteractEvent(hand, item.getItem());
listener.onInteract(event);
Assertions.assertTrue(event.isCancelled());
}
use of io.github.bakedlibs.dough.items.CustomItemStack in project Slimefun4 by Slimefun.
the class TestIronGolemListener method testWithSlimefunIron.
@Test
@DisplayName("Test Iron Golem Healing with Slimefun Items being cancelled")
void testWithSlimefunIron() {
SlimefunItem slimefunItem = TestUtilities.mockSlimefunItem(plugin, "SLIMEFUN_IRON", new CustomItemStack(Material.IRON_INGOT, "&cSlimefun Iron"));
slimefunItem.register(plugin);
// The Event should be cancelled, we do not wanna use Slimefun Items for this
PlayerInteractEntityEvent event = callIronGolemEvent(EquipmentSlot.HAND, slimefunItem.getItem());
Assertions.assertTrue(event.isCancelled());
PlayerInteractEntityEvent event2 = callIronGolemEvent(EquipmentSlot.OFF_HAND, slimefunItem.getItem());
Assertions.assertTrue(event2.isCancelled());
}
use of io.github.bakedlibs.dough.items.CustomItemStack in project Slimefun4 by Slimefun.
the class TestItemPickupListener method testAltarProbeForInventories.
@ParameterizedTest
@ValueSource(booleans = { true, false })
void testAltarProbeForInventories(boolean flag) {
Inventory inventory = new HopperInventoryMock(null);
ItemStack stack;
if (flag) {
stack = new CustomItemStack(Material.DIAMOND, AncientPedestal.ITEM_PREFIX + System.nanoTime());
} else {
stack = new CustomItemStack(Material.DIAMOND, "&5Just a normal named diamond");
}
AtomicBoolean removed = new AtomicBoolean(false);
Item item = new ItemEntityMock(server, UUID.randomUUID(), stack) {
@Override
public void remove() {
removed.set(true);
}
};
InventoryPickupItemEvent event = new InventoryPickupItemEvent(inventory, item);
listener.onHopperPickup(event);
Assertions.assertEquals(flag, event.isCancelled());
Assertions.assertEquals(flag, removed.get());
}
use of io.github.bakedlibs.dough.items.CustomItemStack in project Slimefun4 by Slimefun.
the class TestMultiBlocks method testSymmetry.
@Test
@DisplayName("Test symmetric MultiBlocks")
void testSymmetry() {
SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "MULTIBLOCK_TEST", new CustomItemStack(Material.BRICK, "&5Multiblock Test"));
MultiBlock multiblock = new MultiBlock(item, new Material[] { null, null, null, Material.DIAMOND_BLOCK, null, Material.DIAMOND_BLOCK, null, Material.DISPENSER, null }, BlockFace.DOWN);
Assertions.assertTrue(multiblock.isSymmetric());
MultiBlock multiblock2 = new MultiBlock(item, new Material[] { Material.EMERALD_BLOCK, null, null, Material.EMERALD_BLOCK, null, Material.DIAMOND_BLOCK, Material.EMERALD_BLOCK, Material.DISPENSER, null }, BlockFace.DOWN);
Assertions.assertFalse(multiblock2.isSymmetric());
}
Aggregations