Search in sources :

Example 51 with Tile

use of com.builtbroken.mc.prefab.tile.Tile in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testGetSelectBounds.

@Test
public void testGetSelectBounds() {
    FakeWorld world = FakeWorld.newWorld("TestGetSelectBounds");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    Cube cube = tile.getSelectBounds();
    assertTrue(cube != null);
//TODO add check to ensure cube size and values are good
}
Also used : Cube(com.builtbroken.mc.imp.transform.region.Cube) FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Test(org.junit.Test)

Example 52 with Tile

use of com.builtbroken.mc.prefab.tile.Tile in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testGetSideIcon.

@Test
public void testGetSideIcon() {
    FakeWorld world = FakeWorld.newWorld("TestGetSideIcon");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    tile.registerIcons(new SudoIconReg());
    try {
        Method method = Tile.class.getDeclaredMethod("getSideIcon", Integer.TYPE, Integer.TYPE);
        method.setAccessible(true);
        for (int i = 0; i < 6; i++) {
            method.invoke(tile, 0, i);
        }
    } catch (NoSuchMethodException e) {
        fail("Could not find method getTextureName");
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        fail("Failed to invoke method getTextureName");
    } catch (IllegalAccessException e) {
        fail("Couldn't access method getTextureName");
    }
}
Also used : SudoIconReg(com.builtbroken.mc.testing.junit.icons.SudoIconReg) FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) Test(org.junit.Test)

Example 53 with Tile

use of com.builtbroken.mc.prefab.tile.Tile in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testOnFillRain.

@Test
public void testOnFillRain() {
    FakeWorld world = FakeWorld.newWorld("TestOnFillRain");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    tile.onFillRain();
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Test(org.junit.Test)

Example 54 with Tile

use of com.builtbroken.mc.prefab.tile.Tile in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testUpdateLight.

@Test
public void testUpdateLight() {
    FakeWorld world = FakeWorld.newWorld("TestUpdateLight");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    try {
        Method method = Tile.class.getDeclaredMethod("updateLight");
        method.setAccessible(true);
        method.invoke(tile);
    } catch (NoSuchMethodException e) {
        fail("Could not find method updateLight");
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        fail("Failed to invoke method updateLight");
    } catch (IllegalAccessException e) {
        fail("Couldn't access method updateLight");
    }
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) Test(org.junit.Test)

Example 55 with Tile

use of com.builtbroken.mc.prefab.tile.Tile in project Engine by VoltzEngine-Project.

the class AbstractTileTest method testDoCleanupCheck.

@Test
public void testDoCleanupCheck() {
    FakeWorld world = FakeWorld.newWorld("TestDoCleanupCheck");
    world.setBlock(0, 0, 0, block);
    Tile tile = (Tile) world.getTileEntity(0, 0, 0);
    tile.doCleanupCheck();
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) PacketTile(com.builtbroken.mc.core.network.packet.PacketTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) Test(org.junit.Test)

Aggregations

BlockTile (com.builtbroken.mc.prefab.tile.BlockTile)93 Tile (com.builtbroken.mc.prefab.tile.Tile)93 PacketTile (com.builtbroken.mc.core.network.packet.PacketTile)88 Test (org.junit.Test)88 FakeWorld (com.builtbroken.mc.testing.junit.world.FakeWorld)85 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 Method (java.lang.reflect.Method)8 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)6 ItemStack (net.minecraft.item.ItemStack)5 Pos (com.builtbroken.mc.imp.transform.vector.Pos)4 SudoIconReg (com.builtbroken.mc.testing.junit.icons.SudoIconReg)4 Cube (com.builtbroken.mc.imp.transform.region.Cube)3 ArrayList (java.util.ArrayList)2 TileEntity (net.minecraft.tileentity.TileEntity)2 Location (com.builtbroken.mc.imp.transform.vector.Location)1 Block (net.minecraft.block.Block)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)1 Explosion (net.minecraft.world.Explosion)1