Search in sources :

Example 41 with Tile

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

the class AbstractTileTest method testGetCollisionBounds.

@Test
public void testGetCollisionBounds() {
    FakeWorld world = FakeWorld.newWorld("TestGetCollisionBounds");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    Cube cube = tile.getCollisionBounds();
    if (cube != null) {
    //TODO test too see if cube is valid
    }
}
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 42 with Tile

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

the class AbstractTileTest method testCanPlaceBlockOnSide.

@Test
public void testCanPlaceBlockOnSide() {
    FakeWorld world = FakeWorld.newWorld("TestCanplaceBlockOnSide");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
        tile.canPlaceBlockOnSide(dir);
    }
}
Also used : FakeWorld(com.builtbroken.mc.testing.junit.world.FakeWorld) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) 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 43 with Tile

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

the class AbstractTileTest method testHasSpecialRenderer.

@Test
public void testHasSpecialRenderer() {
    FakeWorld world = FakeWorld.newWorld("TestHasSpecialRenderer");
    world.setBlock(0, 0, 0, block);
    Tile tile = ((Tile) world.getTileEntity(0, 0, 0));
    tile.hasSpecialRenderer();
}
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 44 with Tile

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

the class BlockRenderHandler method renderInventoryBlock.

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    if (block instanceof BlockTile) {
        Tile tile = ((BlockTile) block).staticTile;
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glPushAttrib(GL11.GL_TEXTURE_BIT);
        GL11.glPushMatrix();
        tile.renderInventory(new ItemStack(block, 1, metadata));
        GL11.glPopMatrix();
        GL11.glPopAttrib();
    }
}
Also used : BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) BlockTile(com.builtbroken.mc.prefab.tile.BlockTile) Tile(com.builtbroken.mc.prefab.tile.Tile) ItemStack(net.minecraft.item.ItemStack)

Example 45 with Tile

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

the class AbstractTileTest method testOnPlayerRightClickWrench.

@Test
public void testOnPlayerRightClickWrench() {
    world.setBlock(0, 0, 0, block);
    Tile tile = (Tile) world.getTileEntity(0, 0, 0);
    try {
        Method method = Tile.class.getDeclaredMethod("onPlayerRightClickWrench", EntityPlayer.class, Integer.TYPE, Pos.class);
        method.setAccessible(true);
        for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            //We divide the face of the tile into 256 sub sections
            for (int i = 0; i <= 256; i++) {
                method.invoke(tile, player, dir.ordinal(), getNextClick(dir, i));
            }
        }
    } catch (NoSuchMethodException e) {
        fail("Could not find method onPlayerRightClickWrench");
    } catch (InvocationTargetException e) {
        fail("Failed to invoke method onPlayerRightClickWrench");
    } catch (IllegalAccessException e) {
        fail("Couldn't access method onPlayerRightClickWrench");
    }
}
Also used : ForgeDirection(net.minecraftforge.common.util.ForgeDirection) 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)

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