Search in sources :

Example 1 with ExplosiveHandlerGeneric

use of com.builtbroken.mc.prefab.explosive.ExplosiveHandlerGeneric in project Engine by VoltzEngine-Project.

the class TestExplosiveRegistry method testRegisterExplosiveItem.

@Test
public void testRegisterExplosiveItem() {
    setUpForEntireClass();
    IExplosiveHandler TNT = new ExplosiveHandlerGeneric("tnt", BlastBasic.class, 1);
    ExplosiveRegistry.registerOrGetExplosive(References.DOMAIN, "TNT", TNT);
    ExplosiveRegistry.registerExplosiveItem(new ItemStack(Blocks.tnt), ExplosiveRegistry.get("TNT"), 2);
    assertTrue(ExplosiveRegistry.get("TNT") == TNT);
    assertTrue(ExplosiveRegistry.get(new ItemStack(Blocks.tnt)) == TNT);
    assertEquals(ExplosiveRegistry.getExplosiveSize(new ItemStack(Blocks.tnt)), 2.0);
    assertTrue(ExplosiveRegistry.getItems(TNT).contains(new ItemStackWrapper(new ItemStack(Blocks.tnt))));
    ItemStack stack = new ItemStack(explosive);
    explosive.setExplosive(stack, TNT, 3, null);
    ExplosiveRegistry.registerExplosiveItem(stack);
    assertTrue(ExplosiveRegistry.get(stack) == TNT);
    assertTrue(ExplosiveRegistry.getExplosiveSize(stack) == 3);
    assertTrue(ExplosiveRegistry.getItems(TNT).contains(new ItemStackWrapper(stack)));
}
Also used : ExplosiveHandlerGeneric(com.builtbroken.mc.prefab.explosive.ExplosiveHandlerGeneric) IExplosiveHandler(com.builtbroken.mc.api.explosive.IExplosiveHandler) ItemStack(net.minecraft.item.ItemStack) ItemStackWrapper(com.builtbroken.mc.prefab.items.ItemStackWrapper) Test(org.junit.Test) AbstractTest(com.builtbroken.mc.testing.junit.AbstractTest)

Aggregations

IExplosiveHandler (com.builtbroken.mc.api.explosive.IExplosiveHandler)1 ExplosiveHandlerGeneric (com.builtbroken.mc.prefab.explosive.ExplosiveHandlerGeneric)1 ItemStackWrapper (com.builtbroken.mc.prefab.items.ItemStackWrapper)1 AbstractTest (com.builtbroken.mc.testing.junit.AbstractTest)1 ItemStack (net.minecraft.item.ItemStack)1 Test (org.junit.Test)1