Search in sources :

Example 16 with BlockType

use of net.glowstone.block.blocktype.BlockType in project Glowstone by GlowstoneMC.

the class ItemSign method rightClickBlock.

@Override
public void rightClickBlock(GlowPlayer player, GlowBlock target, BlockFace face, ItemStack holding, Vector clickedLoc) {
    BlockType placeAs;
    if (face == BlockFace.UP) {
        placeAs = ItemTable.instance().getBlock(Material.SIGN_POST);
    } else if (face == BlockFace.DOWN) {
        return;
    } else {
        placeAs = ItemTable.instance().getBlock(Material.WALL_SIGN);
    }
    placeAs.rightClickBlock(player, target, face, holding, clickedLoc);
}
Also used : BlockType(net.glowstone.block.blocktype.BlockType)

Example 17 with BlockType

use of net.glowstone.block.blocktype.BlockType in project Glowstone by GlowstoneMC.

the class ItemTypesTest method hasAllMaterials.

@Test
public void hasAllMaterials() {
    ItemType type = table.getItem(material);
    // special cases
    if (material == Material.AIR) {
        assertThat("ItemType exists for air: " + type, type, nullValue());
        return;
    }
    // check that it exists
    assertThat("ItemType does not exist for " + material, type, notNullValue());
    // check that its block status is correct
    assertThat("Block status mismatch between " + material + "(" + material.isBlock() + ") and " + type, (type instanceof BlockType), is(material.isBlock()));
    // check that material returned matches
    assertThat("ItemType returned wrong material", type.getMaterial(), is(material));
    // check that max stack size matches
    assertThat("Maximum stack size was incorrect", type.getMaxStackSize(), is(material.getMaxStackSize()));
}
Also used : BlockType(net.glowstone.block.blocktype.BlockType) ItemType(net.glowstone.block.itemtype.ItemType) Test(org.junit.Test)

Aggregations

BlockType (net.glowstone.block.blocktype.BlockType)17 GlowBlock (net.glowstone.block.GlowBlock)8 Material (org.bukkit.Material)5 ItemType (net.glowstone.block.itemtype.ItemType)4 BlockFace (org.bukkit.block.BlockFace)4 Block (org.bukkit.block.Block)3 ItemStack (org.bukkit.inventory.ItemStack)3 GlowWorld (net.glowstone.GlowWorld)2 GlowBlockState (net.glowstone.block.GlowBlockState)2 ItemTable (net.glowstone.block.ItemTable)2 BlockLiquid (net.glowstone.block.blocktype.BlockLiquid)2 BlockEntity (net.glowstone.block.entity.BlockEntity)2 GlowPlayer (net.glowstone.entity.GlowPlayer)2 Action (org.bukkit.event.block.Action)2 PlayerInteractEvent (org.bukkit.event.player.PlayerInteractEvent)2 Test (org.junit.Test)2 DataInputStream (java.io.DataInputStream)1 IOException (java.io.IOException)1 BlockContainer (net.glowstone.block.blocktype.BlockContainer)1 ItemTimedUsage (net.glowstone.block.itemtype.ItemTimedUsage)1