Search in sources :

Example 21 with ItemStackWrapper

use of com.builtbroken.mc.prefab.items.ItemStackWrapper 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

ItemStackWrapper (com.builtbroken.mc.prefab.items.ItemStackWrapper)21 ItemStack (net.minecraft.item.ItemStack)17 IExplosiveHandler (com.builtbroken.mc.api.explosive.IExplosiveHandler)3 HashMap (java.util.HashMap)2 Block (net.minecraft.block.Block)2 Item (net.minecraft.item.Item)2 ITexturedExplosiveHandler (com.builtbroken.mc.api.explosive.ITexturedExplosiveHandler)1 IItemHasMass (com.builtbroken.mc.api.items.IItemHasMass)1 IExplosiveContainerItem (com.builtbroken.mc.api.items.explosives.IExplosiveContainerItem)1 ExplosiveHandlerGeneric (com.builtbroken.mc.prefab.explosive.ExplosiveHandlerGeneric)1 AbstractTest (com.builtbroken.mc.testing.junit.AbstractTest)1 ArrayList (java.util.ArrayList)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 IIcon (net.minecraft.util.IIcon)1 Test (org.junit.Test)1