Java Code Examples for net.minecraft.block.material.Material#PISTON

The following examples show how to use net.minecraft.block.material.Material#PISTON . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToolWrench.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean canMineBlock(IBlockState blockState, ItemStack stack) {
    Block block = blockState.getBlock();
    String tool = block.getHarvestTool(blockState);
    return (tool != null && tool.equals("wrench"))
        || blockState.getMaterial() == Material.PISTON
        || block == Blocks.HOPPER
        || block == Blocks.DISPENSER
        || block == Blocks.DROPPER
        || blockState.getMaterial() == Material.IRON;
}
 
Example 2
Source File: FWBlock.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static Material getMcMaterial(Block dummy) {
	if (dummy.components.has(BlockProperty.Opacity.class) || dummy.components.has(BlockProperty.Replaceable.class)) {
		// TODO allow color selection
		return new ProxyMaterial(MapColor.GRAY,
			dummy.components.getOp(BlockProperty.Opacity.class),
			dummy.components.getOp(BlockProperty.Replaceable.class));
	} else {
		return Material.PISTON;
	}
}
 
Example 3
Source File: ItemEnderTool.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean canHarvestBlock(IBlockState state, ItemStack stack)
{
    if (this.isToolBroken(stack))
    {
        return false;
    }

    ToolType tool = ToolType.fromStack(stack);

    if (tool.equals(ToolType.PICKAXE)) // Ender Pickaxe
    {
        if (state.getMaterial() == Material.ROCK
            || state.getMaterial() == Material.GLASS
            || state.getMaterial() == Material.ICE
            || state.getMaterial() == Material.PACKED_ICE
            || state.getMaterial() == Material.REDSTONE_LIGHT
            || state.getMaterial() == Material.PISTON
            || state.getMaterial() == Material.IRON
            || state.getMaterial() == Material.ANVIL)
        {
            //System.out.println("canHarvestBlock(): true; Pickaxe");
            return true;
        }
    }
    else if (tool.equals(ToolType.AXE)) // Ender Axe
    {
        if (state.getMaterial() == Material.WOOD
            || state.getMaterial() == Material.LEAVES
            || state.getMaterial() == Material.GOURD
            || state.getMaterial() == Material.CARPET
            || state.getMaterial() == Material.CLOTH
            || state.getMaterial() == Material.PLANTS
            || state.getMaterial() == Material.VINE)
        {
            //System.out.println("canHarvestBlock(): true; Axe");
            return true;
        }
    }
    else if (tool.equals(ToolType.SHOVEL)) // Ender Shovel
    {
        if (state.getMaterial() == Material.GROUND
            || state.getMaterial() == Material.GRASS
            || state.getMaterial() == Material.SAND
            || state.getMaterial() == Material.SNOW
            || state.getMaterial() == Material.CRAFTED_SNOW
            || state.getMaterial() == Material.CLAY)
        {
            //System.out.println("canHarvestBlock(): true; Shovel");
            return true;
        }
    }

    //System.out.println("canHarvestBlock(): false");
    return false;
}